Title: [94458] trunk/Tools
Revision
94458
Author
[email protected]
Date
2011-09-02 15:33: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

Unreviewed.  Fixing typo from previous commit.

Turns out there was *no* unittesting of WebKitDriver.  Added a basic test of _read_block
which exercises the code I previously made a typo in.

* Scripts/webkitpy/layout_tests/port/webkit.py:
* Scripts/webkitpy/layout_tests/port/webkit_unittest.py:

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (94457 => 94458)


--- trunk/Tools/ChangeLog	2011-09-02 22:32:44 UTC (rev 94457)
+++ trunk/Tools/ChangeLog	2011-09-02 22:33:59 UTC (rev 94458)
@@ -3,6 +3,19 @@
         Reshuffle some code in WebKitDriver._read_block in preparation for reading stderr/stdout separately
         https://bugs.webkit.org/show_bug.cgi?id=67530
 
+        Unreviewed.  Fixing typo from previous commit.
+
+        Turns out there was *no* unittesting of WebKitDriver.  Added a basic test of _read_block
+        which exercises the code I previously made a typo in.
+
+        * Scripts/webkitpy/layout_tests/port/webkit.py:
+        * Scripts/webkitpy/layout_tests/port/webkit_unittest.py:
+
+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.

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py (94457 => 94458)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py	2011-09-02 22:32:44 UTC (rev 94457)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit.py	2011-09-02 22:33:59 UTC (rev 94458)
@@ -533,7 +533,7 @@
                 eof = True
                 line = chomped_line[:-4]
 
-            if line.startswith(TYPE_HEADER) and content_type is None:
+            if line.startswith(self.TYPE_HEADER) and content_type is None:
                 content_type = line.split()[1]
             elif line.startswith(self.ENCODING_HEADER) and encoding is None:
                 encoding = line.split()[1]

Modified: trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit_unittest.py (94457 => 94458)


--- trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit_unittest.py	2011-09-02 22:32:44 UTC (rev 94457)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/port/webkit_unittest.py	2011-09-02 22:33:59 UTC (rev 94458)
@@ -31,7 +31,7 @@
 from webkitpy.common.system.outputcapture import OutputCapture
 
 from webkitpy.layout_tests.models.test_configuration import TestConfiguration
-from webkitpy.layout_tests.port.webkit import WebKitPort
+from webkitpy.layout_tests.port.webkit import WebKitPort, WebKitDriver
 from webkitpy.layout_tests.port import port_testcase
 
 from webkitpy.tool.mocktool import MockExecutive, MockOptions, MockUser
@@ -197,3 +197,29 @@
         # Mock out _apache_config_file_name_for_platform to ignore the passed sys.platform value.
         port._apache_config_file_name_for_platform = lambda platform: 'httpd.conf'
         self.assertEquals(port._path_to_apache_config_file(), '/mock-checkout/LayoutTests/http/conf/httpd.conf')
+
+
+class MockServerProcess(object):
+    def __init__(self, lines=None):
+        self.timed_out = False
+        self.crashed = False
+        self.lines = lines or []
+
+    def read_line(self, timeout):
+        return self.lines.pop(0)
+
+
+class WebKitDriverTest(unittest.TestCase):
+    def test_read_block(self):
+        port = TestWebKitPort()
+        driver = WebKitDriver(port, 0)
+        driver._server_process = MockServerProcess([
+            'ActualHash: foobar',
+            'Content-Type: my_type',
+            'Content-Transfer-Encoding: none',
+            "#EOF",
+        ])
+        content_block = driver._read_block(0)
+        self.assertEquals(content_block.content_type, 'my_type')
+        self.assertEquals(content_block.encoding, 'none')
+        self.assertEquals(content_block.content_hash, 'foobar')
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to