[SCM] WebKit Debian packaging branch, webkit-1.3, updated. upstream/1.3.7-4207-g178b198

dpranke at chromium.org dpranke at chromium.org
Mon Feb 21 00:12:58 UTC 2011


The following commit has been merged in the webkit-1.3 branch:
commit 11560ff567a4096e4d02e11384b52aa106906278
Author: dpranke at chromium.org <dpranke at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jan 28 21:34:02 2011 +0000

    2011-01-28  Dirk Pranke  <dpranke at chromium.org>
    
            Reviewed by Tony Chang.
    
            new-run-webkit-tests: add a "mock DRT" port implementation
            and a separate class that emulates what we expect the
            DumpRenderTree behavior to be.
    
            This will eventually replace port/dryrun.py and allow us to get
            better test coverage of the new-run-webkit-tests code as well as
            a reference for what new-run-webkit-tests expects from DRT.
    
            This is the first attempt at this, and it is pretty bare-boned. It
            really only has been tested on the 'mac' port (and a little on
            the 'chromium-mac' port.
    
            https://bugs.webkit.org/show_bug.cgi?id=53126
    
            * Scripts/webkitpy/common/system/filesystem_mock.py:
            * Scripts/webkitpy/layout_tests/port/dryrun.py:
            * Scripts/webkitpy/layout_tests/port/factory.py:
            * Scripts/webkitpy/layout_tests/port/mock_drt.py: Added.
            * Scripts/webkitpy/layout_tests/port/mock_drt_unittest.py: Added.
            * Scripts/webkitpy/layout_tests/port/test.py:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@76982 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/Tools/ChangeLog b/Tools/ChangeLog
index 5c8c2de..2dcbc68 100644
--- a/Tools/ChangeLog
+++ b/Tools/ChangeLog
@@ -1,3 +1,28 @@
+2011-01-28  Dirk Pranke  <dpranke at chromium.org>
+
+        Reviewed by Tony Chang.
+
+        new-run-webkit-tests: add a "mock DRT" port implementation
+        and a separate class that emulates what we expect the
+        DumpRenderTree behavior to be.
+
+        This will eventually replace port/dryrun.py and allow us to get
+        better test coverage of the new-run-webkit-tests code as well as
+        a reference for what new-run-webkit-tests expects from DRT.
+
+        This is the first attempt at this, and it is pretty bare-boned. It
+        really only has been tested on the 'mac' port (and a little on
+        the 'chromium-mac' port.
+
+        https://bugs.webkit.org/show_bug.cgi?id=53126
+
+        * Scripts/webkitpy/common/system/filesystem_mock.py:
+        * Scripts/webkitpy/layout_tests/port/dryrun.py:
+        * Scripts/webkitpy/layout_tests/port/factory.py:
+        * Scripts/webkitpy/layout_tests/port/mock_drt.py: Added.
+        * Scripts/webkitpy/layout_tests/port/mock_drt_unittest.py: Added.
+        * Scripts/webkitpy/layout_tests/port/test.py:
+
 2011-01-28  Pratik Solanki  <psolanki at apple.com>
 
         Unreviewed. Removing .swp file checked in by mistake.
diff --git a/Tools/Scripts/webkitpy/common/system/filesystem_mock.py b/Tools/Scripts/webkitpy/common/system/filesystem_mock.py
index 8ec31de..610fd66 100644
--- a/Tools/Scripts/webkitpy/common/system/filesystem_mock.py
+++ b/Tools/Scripts/webkitpy/common/system/filesystem_mock.py
@@ -216,7 +216,7 @@ class MockFileSystem(object):
         return WritableFileObject(self, path, append)
 
     def read_text_file(self, path):
-        return self.read_binary_file(path)
+        return self.read_binary_file(path).decode('utf-8')
 
     def read_binary_file(self, path):
         # Intentionally raises KeyError if we don't recognize the path.
@@ -245,7 +245,7 @@ class MockFileSystem(object):
         return (path[0:idx], path[idx:])
 
     def write_text_file(self, path, contents):
-        return self.write_binary_file(path, contents)
+        return self.write_binary_file(path, contents.encode('utf-8'))
 
     def write_binary_file(self, path, contents):
         self.files[path] = contents
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/dryrun.py b/Tools/Scripts/webkitpy/layout_tests/port/dryrun.py
index 4ed34e6..01dea8e 100644
--- a/Tools/Scripts/webkitpy/layout_tests/port/dryrun.py
+++ b/Tools/Scripts/webkitpy/layout_tests/port/dryrun.py
@@ -71,6 +71,12 @@ class DryRunPort(object):
     def __getattr__(self, name):
         return getattr(self.__delegate, name)
 
+    def acquire_http_lock(self):
+        pass
+
+    def release_http_lock(self):
+        pass
+
     def check_build(self, needs_http):
         return True
 
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/factory.py b/Tools/Scripts/webkitpy/layout_tests/port/factory.py
index 675e0c0..7ae6eb6 100644
--- a/Tools/Scripts/webkitpy/layout_tests/port/factory.py
+++ b/Tools/Scripts/webkitpy/layout_tests/port/factory.py
@@ -76,6 +76,9 @@ def _get_kwargs(**kwargs):
     elif port_to_use.startswith('dryrun'):
         import dryrun
         maker = dryrun.DryRunPort
+    elif port_to_use.startswith('mock-'):
+        import mock_drt
+        maker = mock_drt.MockDRTPort
     elif port_to_use.startswith('mac'):
         import mac
         maker = mac.MacPort
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/mock_drt.py b/Tools/Scripts/webkitpy/layout_tests/port/mock_drt.py
new file mode 100644
index 0000000..a261aa2
--- /dev/null
+++ b/Tools/Scripts/webkitpy/layout_tests/port/mock_drt.py
@@ -0,0 +1,204 @@
+#!/usr/bin/env python
+# Copyright (C) 2011 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the Google name nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""
+This is an implementation of the Port interface that overrides other
+ports and changes the Driver binary to "MockDRT".
+"""
+
+import logging
+import optparse
+import os
+import sys
+
+from webkitpy.layout_tests.port import base
+from webkitpy.layout_tests.port import factory
+
+_log = logging.getLogger(__name__)
+
+
+class MockDRTPort(object):
+    """MockPort implementation of the Port interface."""
+
+    def __init__(self, **kwargs):
+        prefix = 'mock-'
+        if 'port_name' in kwargs:
+            kwargs['port_name'] = kwargs['port_name'][len(prefix):]
+        self.__delegate = factory.get(**kwargs)
+
+    def __getattr__(self, name):
+        return getattr(self.__delegate, name)
+
+    def acquire_http_lock(self):
+        pass
+
+    def release_http_lock(self):
+        pass
+
+    def check_build(self, needs_http):
+        return True
+
+    def check_sys_deps(self, needs_http):
+        return True
+
+    def driver_cmd_line(self):
+        driver = self.create_driver(0)
+        return driver.cmd_line()
+
+    def _path_to_driver(self):
+        return os.path.abspath(__file__)
+
+    def create_driver(self, worker_number):
+        # We need to create a driver object as the delegate would, but
+        # overwrite the path to the driver binary in its command line. We do
+        # this by actually overwriting its cmd_line() method with a proxy
+        # method that splices in the mock_drt path and command line arguments
+        # in place of the actual path to the driver binary.
+
+        # FIXME: This doesn't yet work for Chromium test_shell ports.
+        def overriding_cmd_line():
+            cmd = self.__original_driver_cmd_line()
+            index = cmd.index(self.__delegate._path_to_driver())
+            cmd[index:index + 1] = [sys.executable, self._path_to_driver(),
+                                    '--platform', self.name()]
+            return cmd
+
+        delegated_driver = self.__delegate.create_driver(worker_number)
+        self.__original_driver_cmd_line = delegated_driver.cmd_line
+        delegated_driver.cmd_line = overriding_cmd_line
+        return delegated_driver
+
+    def start_helper(self):
+        pass
+
+    def start_http_server(self):
+        pass
+
+    def start_websocket_server(self):
+        pass
+
+    def stop_helper(self):
+        pass
+
+    def stop_http_server(self):
+        pass
+
+    def stop_websocket_server(self):
+        pass
+
+
+def main(argv, stdin, stdout, stderr):
+    """Run the tests."""
+
+    options, args = parse_options(argv)
+    drt = MockDRT(options, args, stdin, stdout, stderr)
+    return drt.run()
+
+
+def parse_options(argv):
+    # FIXME: We need to figure out how to handle variants that have
+    # different command-line conventions.
+    option_list = [
+        optparse.make_option('--platform', action='store',
+                             help='platform to emulate'),
+        optparse.make_option('--layout-tests', action='store_true',
+                             default=True, help='run layout tests'),
+        optparse.make_option('--pixel-tests', action='store_true',
+                             default=False,
+                             help='output image for pixel tests'),
+    ]
+    option_parser = optparse.OptionParser(option_list=option_list)
+    return option_parser.parse_args(argv)
+
+
+class MockDRT(object):
+    def __init__(self, options, args, stdin, stdout, stderr):
+        self._options = options
+        self._args = args
+        self._stdout = stdout
+        self._stdin = stdin
+        self._stderr = stderr
+
+        port_name = None
+        if options.platform:
+            port_name = options.platform
+        self._port = factory.get(port_name, options=options)
+
+    def run(self):
+        while True:
+            line = self._stdin.readline()
+            if not line:
+                break
+
+            url, expected_checksum = self.parse_input(line)
+            self.run_one_test(url, expected_checksum)
+        return 0
+
+    def parse_input(self, line):
+        line = line.strip()
+        if "'" in line:
+            return line.split("'", 1)
+        return (line, None)
+
+    def raw_bytes(self, unicode_str):
+        return unicode_str.encode('utf-8')
+
+    def run_one_test(self, url, expected_checksum):
+        port = self._port
+        if url.startswith('http'):
+            test_name = port.uri_to_test_name(url)
+            test_path = port._filesystem.join(port.layout_tests_dir(), test_name)
+        else:
+            test_path = url
+
+        actual_text_bytes = self.raw_bytes(port.expected_text(test_path))
+        if self._options.pixel_tests and expected_checksum:
+            actual_checksum_bytes = self.raw_bytes(port.expected_checksum(test_path))
+            actual_image_bytes = port.expected_image(test_path)
+
+        self._stdout.write('Content-Type: text/plain\n')
+        self._stdout.write(actual_text_bytes)
+        self._stdout.write('#EOF\n')
+
+        if self._options.pixel_tests and expected_checksum:
+            expected_checksum_bytes = self.raw_bytes(expected_checksum)
+            self._stdout.write('\n')
+            self._stdout.write('ActualHash: %s\n' % actual_checksum_bytes)
+            self._stdout.write('ExpectedHash: %s\n' % expected_checksum_bytes)
+            if actual_checksum_bytes != expected_checksum_bytes:
+                self._stdout.write('Content-Type: image/png\n')
+                self._stdout.write('Content-Length: %s\n\n' % len(actual_image_bytes))
+                self._stdout.write(actual_image_bytes)
+        self._stdout.write('#EOF\n')
+        self._stdout.flush()
+        self._stderr.flush()
+
+
+if __name__ == '__main__':
+    sys.exit(main(sys.argv[1:], sys.stdin, sys.stdout, sys.stderr))
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/mock_drt_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/mock_drt_unittest.py
new file mode 100644
index 0000000..3e89264
--- /dev/null
+++ b/Tools/Scripts/webkitpy/layout_tests/port/mock_drt_unittest.py
@@ -0,0 +1,193 @@
+#!/usr/bin/env python
+# Copyright (C) 2011 Google Inc. All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+#     * Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#     * Redistributions in binary form must reproduce the above
+# copyright notice, this list of conditions and the following disclaimer
+# in the documentation and/or other materials provided with the
+# distribution.
+#     * Neither the name of Google Inc. nor the names of its
+# contributors may be used to endorse or promote products derived from
+# this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+"""Unit tests for MockDRT."""
+
+import unittest
+
+from webkitpy.common import newstringio
+
+from webkitpy.layout_tests.port import mock_drt
+from webkitpy.layout_tests.port import factory
+from webkitpy.layout_tests.port import port_testcase
+
+
+class MockDRTPortTest(port_testcase.PortTestCase):
+    def make_port(self):
+        return mock_drt.MockDRTPort()
+
+    def test_port_name_in_constructor(self):
+        self.assertTrue(mock_drt.MockDRTPort(port_name='mock-test'))
+
+    def test_acquire_http_lock(self):
+        # Only checking that no exception is raised.
+        self.make_port().acquire_http_lock()
+
+    def test_release_http_lock(self):
+        # Only checking that no exception is raised.
+        self.make_port().release_http_lock()
+
+    def test_check_build(self):
+        port = self.make_port()
+        self.assertTrue(port.check_build(True))
+
+    def test_check_sys_deps(self):
+        port = self.make_port()
+        self.assertTrue(port.check_sys_deps(True))
+
+    def test_start_helper(self):
+        # Only checking that no exception is raised.
+        self.make_port().start_helper()
+
+    def test_start_http_server(self):
+        # Only checking that no exception is raised.
+        self.make_port().start_http_server()
+
+    def test_start_websocket_server(self):
+        # Only checking that no exception is raised.
+        self.make_port().start_websocket_server()
+
+    def test_stop_helper(self):
+        # Only checking that no exception is raised.
+        self.make_port().stop_helper()
+
+    def test_stop_http_server(self):
+        # Only checking that no exception is raised.
+        self.make_port().stop_http_server()
+
+    def test_stop_websocket_server(self):
+        # Only checking that no exception is raised.
+        self.make_port().stop_websocket_server()
+
+
+class MockDRTTest(unittest.TestCase):
+    def setUp(self):
+        self._port = factory.get('test')
+        self._layout_tests_dir = self._port.layout_tests_dir()
+
+    def to_path(self, test_name):
+        return self._port._filesystem.join(self._layout_tests_dir, test_name)
+
+    def input_line(self, test_name, checksum=None):
+        url = self._port.filename_to_uri(self.to_path(test_name))
+        if url.startswith('file:///'):
+            url = url[len('file:///') - 1:]
+
+        if checksum:
+            return url + "'" + checksum + '\n'
+        return url + '\n'
+
+    def make_drt(self, input_string, extra_args=None):
+        args = ['--platform', 'test', '-']
+        extra_args = extra_args or []
+        args += extra_args
+        stdin = newstringio.StringIO(input_string)
+        stdout = newstringio.StringIO()
+        stderr = newstringio.StringIO()
+        options, args = mock_drt.parse_options(args)
+        drt = mock_drt.MockDRT(options, args, stdin, stdout, stderr)
+        return (drt, stdout, stderr)
+
+    def make_input_output(self, test_name, pixel_tests, expected_checksum,
+                          drt_output, drt_input=None):
+        path = self.to_path(test_name)
+        if pixel_tests:
+            if not expected_checksum:
+                expected_checksum = self._port.expected_checksum(path)
+        if not drt_input:
+            drt_input = self.input_line(test_name, expected_checksum)
+        text_output = self._port.expected_text(path)
+
+        if not drt_output:
+            if pixel_tests:
+                drt_output = [
+                    'Content-Type: text/plain\n',
+                    text_output.encode('utf-8'),
+                    '#EOF\n',
+                    '\n',
+                    'ActualHash: %s\n' % expected_checksum.encode('utf-8'),
+                    'ExpectedHash: %s\n' % expected_checksum.encode('utf-8'),
+                    '#EOF\n']
+            else:
+                drt_output = [
+                    'Content-Type: text/plain\n',
+                    text_output.encode('utf-8'),
+                    '#EOF\n',
+                    '#EOF\n']
+
+        return (drt_input, drt_output)
+
+    def assertTest(self, test_name, pixel_tests, expected_checksum=None, drt_output=None):
+        drt_input, drt_output = self.make_input_output(test_name, pixel_tests,
+            expected_checksum, drt_output)
+        extra_args = []
+        if pixel_tests:
+            extra_args = ['--pixel-tests']
+        drt, stdout, stderr = self.make_drt(drt_input, extra_args)
+        res = drt.run()
+        self.assertEqual(res, 0)
+
+        # We use the StringIO.buflist here instead of getvalue() because
+        # the StringIO might be a mix of unicode/ascii and 8-bit strings.
+        self.assertEqual(stdout.buflist, drt_output)
+        self.assertEqual(stderr.getvalue(), '')
+
+    def test_main(self):
+        stdin = newstringio.StringIO()
+        stdout = newstringio.StringIO()
+        stderr = newstringio.StringIO()
+        res = mock_drt.main(['--platform', 'test', '-'], stdin, stdout, stderr)
+        self.assertEqual(res, 0)
+        self.assertEqual(stdout.getvalue(), '')
+        self.assertEqual(stderr.getvalue(), '')
+
+    def test_pixeltest_passes(self):
+        # This also tests that we handle HTTP: test URLs properly.
+        self.assertTest('http/tests/passes/text.html', True)
+
+    def test_pixeltest__fails(self):
+        self.assertTest('failures/expected/checksum.html', pixel_tests=True,
+            expected_checksum='wrong-checksum',
+            drt_output=['Content-Type: text/plain\n',
+                        'checksum-txt',
+                        '#EOF\n',
+                        '\n',
+                        'ActualHash: checksum-checksum\n',
+                        'ExpectedHash: wrong-checksum\n',
+                        'Content-Type: image/png\n',
+                        'Content-Length: 13\n\n',
+                        'checksum\x8a-png',
+                        '#EOF\n'])
+
+    def test_textonly(self):
+        self.assertTest('passes/image.html', False)
+
+
+if __name__ == '__main__':
+    unittest.main()
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/test.py b/Tools/Scripts/webkitpy/layout_tests/port/test.py
index a9d5884..577fe57 100644
--- a/Tools/Scripts/webkitpy/layout_tests/port/test.py
+++ b/Tools/Scripts/webkitpy/layout_tests/port/test.py
@@ -52,9 +52,17 @@ class TestInstance:
         self.keyboard = False
         self.error = ''
         self.timeout = False
-        self.actual_text = self.base + '-txt\n'
-        self.actual_checksum = self.base + '-checksum\n'
-        self.actual_image = self.base + '-png\n'
+
+        # The values of each field are treated as raw byte strings. They
+        # will be converted to unicode strings where appropriate using
+        # MockFileSystem.read_text_file().
+        self.actual_text = self.base + '-txt'
+        self.actual_checksum = self.base + '-checksum'
+
+        # We add the '\x8a' for the image file to prevent the value from
+        # being treated as UTF-8 (the character is invalid)
+        self.actual_image = self.base + '\x8a' + '-png'
+
         self.expected_text = self.actual_text
         self.expected_checksum = self.actual_checksum
         self.expected_image = self.actual_image
@@ -85,53 +93,44 @@ class TestList:
 def unit_test_list():
     tests = TestList()
     tests.add('failures/expected/checksum.html',
-                actual_checksum='checksum_fail-checksum')
+              actual_checksum='checksum_fail-checksum')
     tests.add('failures/expected/crash.html', crash=True)
     tests.add('failures/expected/exception.html', exception=True)
     tests.add('failures/expected/timeout.html', timeout=True)
     tests.add('failures/expected/hang.html', hang=True)
-    tests.add('failures/expected/missing_text.html',
-                expected_text=None)
+    tests.add('failures/expected/missing_text.html', expected_text=None)
     tests.add('failures/expected/image.html',
-                actual_image='image_fail-png',
-                expected_image='image-png')
+              actual_image='image_fail-png',
+              expected_image='image-png')
     tests.add('failures/expected/image_checksum.html',
-                actual_checksum='image_checksum_fail-checksum',
-                actual_image='image_checksum_fail-png')
-    tests.add('failures/expected/keyboard.html',
-                keyboard=True)
-    tests.add('failures/expected/missing_check.html',
-                expected_checksum=None)
-    tests.add('failures/expected/missing_image.html',
-                expected_image=None)
-    tests.add('failures/expected/missing_text.html',
-                expected_text=None)
+              actual_checksum='image_checksum_fail-checksum',
+              actual_image='image_checksum_fail-png')
+    tests.add('failures/expected/keyboard.html', keyboard=True)
+    tests.add('failures/expected/missing_check.html', expected_checksum=None)
+    tests.add('failures/expected/missing_image.html', expected_image=None)
+    tests.add('failures/expected/missing_text.html', expected_text=None)
     tests.add('failures/expected/newlines_leading.html',
-                expected_text="\nfoo\n",
-                actual_text="foo\n")
+              expected_text="\nfoo\n", actual_text="foo\n")
     tests.add('failures/expected/newlines_trailing.html',
-                expected_text="foo\n\n",
-                actual_text="foo\n")
+              expected_text="foo\n\n", actual_text="foo\n")
     tests.add('failures/expected/newlines_with_excess_CR.html',
-                expected_text="foo\r\r\r\n",
-                actual_text="foo\n")
-    tests.add('failures/expected/text.html',
-                actual_text='text_fail-png')
+              expected_text="foo\r\r\r\n", actual_text="foo\n")
+    tests.add('failures/expected/text.html', actual_text='text_fail-png')
     tests.add('failures/unexpected/crash.html', crash=True)
     tests.add('failures/unexpected/text-image-checksum.html',
-                actual_text='text-image-checksum_fail-txt',
-                actual_checksum='text-image-checksum_fail-checksum')
+              actual_text='text-image-checksum_fail-txt',
+              actual_checksum='text-image-checksum_fail-checksum')
     tests.add('failures/unexpected/timeout.html', timeout=True)
     tests.add('http/tests/passes/text.html')
     tests.add('http/tests/ssl/text.html')
     tests.add('passes/error.html', error='stuff going to stderr')
     tests.add('passes/image.html')
     tests.add('passes/platform_image.html')
+
     # Text output files contain "\r\n" on Windows.  This may be
     # helpfully filtered to "\r\r\n" by our Python/Cygwin tooling.
     tests.add('passes/text.html',
-                expected_text='\nfoo\n\n',
-                actual_text='\nfoo\r\n\r\r\n')
+              expected_text='\nfoo\n\n', actual_text='\nfoo\r\n\r\r\n')
     tests.add('websocket/tests/passes/text.html')
     return tests
 
@@ -210,6 +209,11 @@ class TestPort(base.Port):
         base.Port.__init__(self, port_name=port_name, filesystem=filesystem, user=user,
                            **kwargs)
 
+    def _path_to_driver(self):
+        # This routine shouldn't normally be called, but it is called by
+        # the mock_drt Driver. We return something, but make sure it's useless.
+        return 'junk'
+
     def baseline_path(self):
         return self._filesystem.join(self.layout_tests_dir(), 'platform',
                                      self.name() + self.version())
@@ -224,7 +228,7 @@ class TestPort(base.Port):
                    diff_filename=None):
         diffed = actual_contents != expected_contents
         if diffed and diff_filename:
-            self._filesystem.write_text_file(diff_filename,
+            self._filesystem.write_binary_file(diff_filename,
                 "< %s\n---\n> %s\n" % (expected_contents, actual_contents))
         return diffed
 
@@ -290,7 +294,7 @@ class TestDriver(base.Driver):
         self._port = port
 
     def cmd_line(self):
-        return ['None']
+        return [self._port._path_to_driver()]
 
     def poll(self):
         return True

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list