Title: [94453] trunk/Tools
- Revision
- 94453
- Author
- [email protected]
- Date
- 2011-09-02 15:19:59 -0700 (Fri, 02 Sep 2011)
Log Message
Reshuffle some code in WebKitDriver._read_block in preparation for reading stderr/stdout separately
https://bugs.webkit.org/show_bug.cgi?id=67530
Reviewed by Adam Barth.
No functional change, just reshuffling code.
* Scripts/webkitpy/layout_tests/port/webkit.py:
Modified Paths
Diff
Modified: trunk/Tools/ChangeLog (94452 => 94453)
--- trunk/Tools/ChangeLog 2011-09-02 22:09:34 UTC (rev 94452)
+++ trunk/Tools/ChangeLog 2011-09-02 22:19:59 UTC (rev 94453)
@@ -1,3 +1,14 @@
+2011-09-02 Eric Seidel <[email protected]>
+
+ Reshuffle some code in WebKitDriver._read_block in preparation for reading stderr/stdout separately
+ https://bugs.webkit.org/show_bug.cgi?id=67530
+
+ Reviewed by Adam Barth.
+
+ No functional change, just reshuffling code.
+
+ * Scripts/webkitpy/layout_tests/port/webkit.py:
+
2011-09-02 Darin Adler <[email protected]>
Added Subversion ignore for .pyc generated files.
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py (94452 => 94453)
--- trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py 2011-09-02 22:09:34 UTC (rev 94452)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py 2011-09-02 22:19:59 UTC (rev 94453)
@@ -509,44 +509,46 @@
crash=self.detected_crash(), test_time=time.time() - start_time,
timeout=self._server_process.timed_out, error=error)
+ LENGTH_HEADER = 'Content-Length: '
+ HASH_HEADER = 'ActualHash: '
+ TYPE_HEADER = 'Content-Type: '
+ ENCODING_HEADER = 'Content-Transfer-Encoding: '
+
+ def _read_line_until(self, deadline):
+ return self._server_process.read_line(deadline - time.time())
+
def _read_block(self, deadline):
- LENGTH_HEADER = 'Content-Length: '
- HASH_HEADER = 'ActualHash: '
- TYPE_HEADER = 'Content-Type: '
- ENCODING_HEADER = 'Content-Transfer-Encoding: '
content_type = None
encoding = None
content_hash = None
content_length = None
# Content is treated as binary data even though the text output is usually UTF-8.
- content = ''
- timeout = deadline - time.time()
- line = self._server_process.read_line(timeout)
+ content = str() # FIXME: Should be bytearray() once we require Python 2.6.
+ line = self._read_line_until(deadline - time.time())
eof = False
while (not self._server_process.timed_out and not self.detected_crash() and not eof):
- chomped_line = line.rstrip()
+ chomped_line = line.rstrip() # FIXME: This will remove trailing lines from test output. Is that right?
if chomped_line.endswith("#EOF"):
eof = True
line = chomped_line[:-4]
if line.startswith(TYPE_HEADER) and content_type is None:
content_type = line.split()[1]
- elif line.startswith(ENCODING_HEADER) and encoding is None:
+ elif line.startswith(self.ENCODING_HEADER) and encoding is None:
encoding = line.split()[1]
- elif line.startswith(LENGTH_HEADER) and content_length is None:
- timeout = deadline - time.time()
- content_length = int(line[len(LENGTH_HEADER):])
- # FIXME: Technically there should probably be another blank
- # line here, but DRT doesn't write one.
- content = self._server_process.read(timeout, content_length)
- elif line.startswith(HASH_HEADER):
+ elif line.startswith(self.LENGTH_HEADER) and content_length is None:
+ content_length = int(line[len(self.LENGTH_HEADER):])
+ # FIXME: In real HTTP there should probably be a blank line
+ # after headers before content, but DRT doesn't write one.
+ content = self._server_process.read(deadline - time.time(), content_length)
+ elif line.startswith(self.HASH_HEADER):
content_hash = line.split()[1]
elif line:
content += line
- if not eof:
- line = self._server_process.read_line(timeout)
- timeout = deadline - time.time()
+ if eof:
+ break
+ line = self._read_line_until(deadline)
return ContentBlock(content_type, encoding, content_hash, content)
def stop(self):
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes