Index: Tools/Scripts/webkitpy/layout_tests/port/mock_drt_unittest.py |
diff --git a/Tools/Scripts/webkitpy/layout_tests/port/mock_drt_unittest.py b/Tools/Scripts/webkitpy/layout_tests/port/mock_drt_unittest.py |
index 1dde3b99514e9322c0a014afcdf5e37f1b8cf0e6..478d325b9cf9f68278ec0bd16b0c8097f9777ce0 100644 |
--- a/Tools/Scripts/webkitpy/layout_tests/port/mock_drt_unittest.py |
+++ b/Tools/Scripts/webkitpy/layout_tests/port/mock_drt_unittest.py |
@@ -76,20 +76,16 @@ class MockDRTPortTest(port_testcase.PortTestCase): |
class MockDRTTest(unittest.TestCase): |
- def input_line(self, port, test_name, checksum=None): |
+ def input_line(self, port, test_name, pixel_tests, checksum=None): |
url = port.create_driver(0).test_to_uri(test_name) |
if url.startswith('file://'): |
url = url[len('file://'):] |
- |
+ if pixel_tests: |
+ url += "'--pixel-test" |
if checksum: |
- return url + "'" + checksum + '\n' |
+ url += "'" + checksum |
return url + '\n' |
- def extra_args(self, pixel_tests): |
- if pixel_tests: |
- return ['--pixel-tests', '-'] |
- return ['-'] |
- |
def make_drt(self, options, args, host, stdin, stdout, stderr): |
return mock_drt.MockDRT(options, args, host, stdin, stdout, stderr) |
@@ -99,7 +95,7 @@ class MockDRTTest(unittest.TestCase): |
if not expected_checksum: |
expected_checksum = port.expected_checksum(test_name) |
if not drt_input: |
- drt_input = self.input_line(port, test_name, expected_checksum) |
+ drt_input = self.input_line(port, test_name, pixel_tests, expected_checksum) |
text_output = expected_text or port.expected_text(test_name) or '' |
if not drt_output: |
@@ -127,7 +123,7 @@ class MockDRTTest(unittest.TestCase): |
drt_input, drt_output = self.make_input_output(port, test_name, |
pixel_tests, expected_checksum, drt_output, drt_input=None, expected_text=expected_text) |
- args = ['--platform', port_name] + self.extra_args(pixel_tests) |
+ args = ['--dump-render-tree', '--platform', port_name, '-'] |
stdin = newstringio.StringIO(drt_input) |
stdout = newstringio.StringIO() |
stderr = newstringio.StringIO() |
@@ -141,7 +137,7 @@ class MockDRTTest(unittest.TestCase): |
# 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(), '' if options.test_shell else '#EOF\n') |
+ self.assertEqual(stderr.getvalue(), '#EOF\n') |
def test_main(self): |
host = MockSystemHost() |
@@ -149,7 +145,7 @@ class MockDRTTest(unittest.TestCase): |
stdin = newstringio.StringIO() |
stdout = newstringio.StringIO() |
stderr = newstringio.StringIO() |
- res = mock_drt.main(['--platform', 'test'] + self.extra_args(False), |
+ res = mock_drt.main(['--dump-render-tree', '--platform', 'test', '-'], |
host, stdin, stdout, stderr) |
self.assertEqual(res, 0) |
self.assertEqual(stdout.getvalue(), '') |
@@ -184,66 +180,19 @@ class MockDRTTest(unittest.TestCase): |
self.assertTest('failures/expected/missing_text.html', True) |
def test_reftest_match(self): |
- self.assertTest('passes/reftest.html', False, expected_checksum='mock-checksum', expected_text='reference text\n') |
self.assertTest('passes/reftest.html', True, expected_checksum='mock-checksum', expected_text='reference text\n') |
def test_reftest_mismatch(self): |
- self.assertTest('passes/mismatch.html', False, expected_checksum='mock-checksum', expected_text='reference text\n') |
self.assertTest('passes/mismatch.html', True, expected_checksum='mock-checksum', expected_text='reference text\n') |
- |
-class MockTestShellTest(MockDRTTest): |
- def extra_args(self, pixel_tests): |
- if pixel_tests: |
- return ['--pixel-tests=/tmp/png_result0.png'] |
- return [] |
- |
- def make_drt(self, options, args, host, stdin, stdout, stderr): |
- options.test_shell = True |
- |
- # We have to set these by hand because --platform test won't trigger |
- # the Chromium code paths. |
- options.pixel_path = '/tmp/png_result0.png' |
- options.pixel_tests = True |
- |
- return mock_drt.MockTestShell(options, args, host, stdin, stdout, stderr) |
- |
- def input_line(self, port, test_name, checksum=None): |
- url = port.create_driver(0).test_to_uri(test_name) |
- if checksum: |
- return url + ' 6000 ' + checksum + '\n' |
- return url + ' 6000\n' |
- |
- def expected_output(self, port, test_name, pixel_tests, text_output, expected_checksum): |
- url = port.create_driver(0).test_to_uri(test_name) |
- output = ['#URL:%s\n' % url] |
- if expected_checksum: |
- output.append('#MD5:%s\n' % expected_checksum) |
- if text_output: |
- output.append(text_output) |
- if not text_output.endswith('\n'): |
- output.append('\n') |
- output.append('#EOF\n') |
- return output |
- |
- def test_pixeltest__fails(self): |
- host = MockSystemHost() |
- url = '#URL:file://' |
- url = url + '%s/failures/expected/image_checksum.html' % PortFactory(host).get('test').layout_tests_dir() |
- self.assertTest('failures/expected/image_checksum.html', pixel_tests=True, |
- expected_checksum='image_checksum', |
- drt_output=[url + '\n', |
- '#MD5:image_checksum-checksum\n', |
- 'image_checksum-txt', |
- '\n', |
- '#EOF\n'], |
- host=host) |
- self.assertEqual(host.filesystem.written_files, |
- {'/tmp/png_result0.png': 'image_checksum\x8a-pngtEXtchecksum\x00image_checksum-checksum'}) |
- |
- def test_test_shell_parse_options(self): |
- options, args = mock_drt.parse_options(['--platform', 'mac', '--test-shell', |
- '--pixel-tests=/tmp/png_result0.png']) |
- self.assertTrue(options.test_shell) |
- self.assertTrue(options.pixel_tests) |
- self.assertEqual(options.pixel_path, '/tmp/png_result0.png') |
+ def test_audio(self): |
+ self.assertTest('passes/audio.html', pixel_tests=True, |
+ drt_output=['Content-Type: audio/wav\n', |
+ 'Content-Transfer-Encoding: base64\n', |
+ 'YXVkaW8td2F2', |
+ '\n', |
+ '#EOF\n', |
+ '#EOF\n']) |
+ |
+ def test_virtual(self): |
+ self.assertTest('virtual/passes/text.html', True) |