| Index: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py
|
| diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py
|
| index 2ac11cc4dd15aabd94359249237005d4af2e19de..fd1ef505d237ad188664b01987a0a5068addd00d 100644
|
| --- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py
|
| +++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/port/base_unittest.py
|
| @@ -88,24 +88,20 @@ class PortTest(unittest.TestCase):
|
| port = self.make_port(executive=executive_mock.MockExecutive2(exception=OSError))
|
| oc = OutputCapture()
|
| oc.capture_output()
|
| - self.assertEqual(port.pretty_patch_text("patch.txt"),
|
| - port._pretty_patch_error_html)
|
| + self.assertEqual(port.pretty_patch_text("patch.txt"), port._pretty_patch_error_html)
|
|
|
| # This tests repeated calls to make sure we cache the result.
|
| - self.assertEqual(port.pretty_patch_text("patch.txt"),
|
| - port._pretty_patch_error_html)
|
| + self.assertEqual(port.pretty_patch_text("patch.txt"), port._pretty_patch_error_html)
|
| oc.restore_output()
|
|
|
| def test_pretty_patch_script_error(self):
|
| # FIXME: This is some ugly white-box test hacking ...
|
| port = self.make_port(executive=executive_mock.MockExecutive2(exception=ScriptError))
|
| port._pretty_patch_available = True
|
| - self.assertEqual(port.pretty_patch_text("patch.txt"),
|
| - port._pretty_patch_error_html)
|
| + self.assertEqual(port.pretty_patch_text("patch.txt"), port._pretty_patch_error_html)
|
|
|
| # This tests repeated calls to make sure we cache the result.
|
| - self.assertEqual(port.pretty_patch_text("patch.txt"),
|
| - port._pretty_patch_error_html)
|
| + self.assertEqual(port.pretty_patch_text("patch.txt"), port._pretty_patch_error_html)
|
|
|
| def test_wdiff_text(self):
|
| port = self.make_port()
|
| @@ -129,8 +125,7 @@ class PortTest(unittest.TestCase):
|
| # encoding (and be stored as str objects), test unicode inputs just to
|
| # be safe.
|
| port.diff_text(u'exp', 'act', 'exp.txt', 'act.txt')
|
| - port.diff_text(
|
| - u'a\xac\u1234\u20ac\U00008000', 'act', 'exp.txt', 'act.txt')
|
| + port.diff_text(u'a\xac\u1234\u20ac\U00008000', 'act', 'exp.txt', 'act.txt')
|
|
|
| # And make sure we actually get diff output.
|
| diff = port.diff_text('foo', 'bar', 'exp.txt', 'act.txt')
|
| @@ -196,54 +191,44 @@ class PortTest(unittest.TestCase):
|
| test_file = 'fast/test.html'
|
|
|
| # No additional platform directory
|
| - self.assertEqual(
|
| - port.expected_baselines(test_file, '.txt'),
|
| - [(None, 'fast/test-expected.txt')])
|
| + self.assertEqual(port.expected_baselines(test_file, '.txt'), [(None, 'fast/test-expected.txt')])
|
| self.assertEqual(port.baseline_path(), 'LayoutTests/platform/foo')
|
|
|
| # Simple additional platform directory
|
| port._options.additional_platform_directory = ['/tmp/local-baselines']
|
| port._filesystem.write_text_file('/tmp/local-baselines/fast/test-expected.txt', 'foo')
|
| - self.assertEqual(
|
| - port.expected_baselines(test_file, '.txt'),
|
| - [('/tmp/local-baselines', 'fast/test-expected.txt')])
|
| + self.assertEqual(port.expected_baselines(test_file, '.txt'), [('/tmp/local-baselines', 'fast/test-expected.txt')])
|
| self.assertEqual(port.baseline_path(), '/tmp/local-baselines')
|
|
|
| # Multiple additional platform directories
|
| port._options.additional_platform_directory = ['/foo', '/tmp/local-baselines']
|
| - self.assertEqual(
|
| - port.expected_baselines(test_file, '.txt'),
|
| - [('/tmp/local-baselines', 'fast/test-expected.txt')])
|
| + self.assertEqual(port.expected_baselines(test_file, '.txt'), [('/tmp/local-baselines', 'fast/test-expected.txt')])
|
| self.assertEqual(port.baseline_path(), '/foo')
|
|
|
| def test_nonexistant_expectations(self):
|
| port = self.make_port(port_name='foo')
|
| port.expectations_files = lambda: ['/mock-checkout/third_party/WebKit/LayoutTests/platform/exists/TestExpectations', '/mock-checkout/third_party/WebKit/LayoutTests/platform/nonexistant/TestExpectations']
|
| port._filesystem.write_text_file('/mock-checkout/third_party/WebKit/LayoutTests/platform/exists/TestExpectations', '')
|
| - self.assertEqual('\n'.join(port.expectations_dict().keys()), '/mock-checkout/third_party/WebKit/LayoutTests/platform/exists/TestExpectations')
|
| + self.assertEqual('\n'.join(port.expectations_dict().keys()),
|
| + '/mock-checkout/third_party/WebKit/LayoutTests/platform/exists/TestExpectations')
|
|
|
| def test_additional_expectations(self):
|
| port = self.make_port(port_name='foo')
|
| port.port_name = 'foo'
|
| port._filesystem.write_text_file('/mock-checkout/third_party/WebKit/LayoutTests/platform/foo/TestExpectations', '')
|
| - port._filesystem.write_text_file(
|
| - '/tmp/additional-expectations-1.txt', 'content1\n')
|
| - port._filesystem.write_text_file(
|
| - '/tmp/additional-expectations-2.txt', 'content2\n')
|
| + port._filesystem.write_text_file('/tmp/additional-expectations-1.txt', 'content1\n')
|
| + port._filesystem.write_text_file('/tmp/additional-expectations-2.txt', 'content2\n')
|
| port._filesystem.write_text_file('/mock-checkout/third_party/WebKit/LayoutTests/FlagExpectations/special-flag', 'content3')
|
|
|
| self.assertEqual('\n'.join(port.expectations_dict().values()), '')
|
|
|
| - port._options.additional_expectations = [
|
| - '/tmp/additional-expectations-1.txt']
|
| + port._options.additional_expectations = ['/tmp/additional-expectations-1.txt']
|
| self.assertEqual('\n'.join(port.expectations_dict().values()), 'content1\n')
|
|
|
| - port._options.additional_expectations = [
|
| - '/tmp/nonexistent-file', '/tmp/additional-expectations-1.txt']
|
| + port._options.additional_expectations = ['/tmp/nonexistent-file', '/tmp/additional-expectations-1.txt']
|
| self.assertEqual('\n'.join(port.expectations_dict().values()), 'content1\n')
|
|
|
| - port._options.additional_expectations = [
|
| - '/tmp/additional-expectations-1.txt', '/tmp/additional-expectations-2.txt']
|
| + port._options.additional_expectations = ['/tmp/additional-expectations-1.txt', '/tmp/additional-expectations-2.txt']
|
| self.assertEqual('\n'.join(port.expectations_dict().values()), 'content1\n\ncontent2\n')
|
|
|
| port._options.additional_driver_flag = ['--special-flag']
|
| @@ -304,27 +289,28 @@ class PortTest(unittest.TestCase):
|
|
|
| def test_parse_reftest_list(self):
|
| port = self.make_port(with_tests=True)
|
| - port.host.filesystem.files['bar/reftest.list'] = "\n".join(["== test.html test-ref.html",
|
| - "",
|
| - "# some comment",
|
| - "!= test-2.html test-notref.html # more comments",
|
| - "== test-3.html test-ref.html",
|
| - "== test-3.html test-ref2.html",
|
| - "!= test-3.html test-notref.html",
|
| - "fuzzy(80,500) == test-3 test-ref.html"])
|
| + port.host.filesystem.files['bar/reftest.list'] = "\n".join(
|
| + ["== test.html test-ref.html", "", "# some comment", "!= test-2.html test-notref.html # more comments",
|
| + "== test-3.html test-ref.html", "== test-3.html test-ref2.html", "!= test-3.html test-notref.html",
|
| + "fuzzy(80,500) == test-3 test-ref.html"])
|
|
|
| # Note that we don't support the syntax in the last line; the code should ignore it, rather than crashing.
|
|
|
| reftest_list = Port._parse_reftest_list(port.host.filesystem, 'bar')
|
| self.assertEqual(reftest_list, {'bar/test.html': [('==', 'bar/test-ref.html')],
|
| - 'bar/test-2.html': [('!=', 'bar/test-notref.html')],
|
| - 'bar/test-3.html': [('==', 'bar/test-ref.html'), ('==', 'bar/test-ref2.html'), ('!=', 'bar/test-notref.html')]})
|
| + 'bar/test-2.html': [('!=', 'bar/test-notref.html')],
|
| + 'bar/test-3.html': [('==', 'bar/test-ref.html'), ('==', 'bar/test-ref2.html'),
|
| + ('!=', 'bar/test-notref.html')]})
|
|
|
| def test_reference_files(self):
|
| port = self.make_port(with_tests=True)
|
| - self.assertEqual(port.reference_files('passes/svgreftest.svg'), [('==', port.layout_tests_dir() + '/passes/svgreftest-expected.svg')])
|
| - self.assertEqual(port.reference_files('passes/xhtreftest.svg'), [('==', port.layout_tests_dir() + '/passes/xhtreftest-expected.html')])
|
| - self.assertEqual(port.reference_files('passes/phpreftest.php'), [('!=', port.layout_tests_dir() + '/passes/phpreftest-expected-mismatch.svg')])
|
| + self.assertEqual(
|
| + port.reference_files('passes/svgreftest.svg'), [('==', port.layout_tests_dir() + '/passes/svgreftest-expected.svg')])
|
| + self.assertEqual(
|
| + port.reference_files('passes/xhtreftest.svg'), [('==', port.layout_tests_dir() + '/passes/xhtreftest-expected.html')])
|
| + self.assertEqual(
|
| + port.reference_files('passes/phpreftest.php'), [('!=',
|
| + port.layout_tests_dir() + '/passes/phpreftest-expected-mismatch.svg')])
|
|
|
| def test_operating_system(self):
|
| self.assertEqual('mac', self.make_port().operating_system())
|
| @@ -422,8 +408,8 @@ class PortTest(unittest.TestCase):
|
| def test_good_virtual_test_suite_file(self):
|
| port = self.make_port()
|
| fs = port._filesystem
|
| - fs.write_text_file(fs.join(port.layout_tests_dir(), 'VirtualTestSuites'),
|
| - '[{"prefix": "bar", "base": "fast/bar", "args": ["--bar"]}]')
|
| + fs.write_text_file(
|
| + fs.join(port.layout_tests_dir(), 'VirtualTestSuites'), '[{"prefix": "bar", "base": "fast/bar", "args": ["--bar"]}]')
|
|
|
| # If this call returns successfully, we found and loaded the LayoutTests/VirtualTestSuites.
|
| _ = port.virtual_test_suites()
|
| @@ -431,8 +417,7 @@ class PortTest(unittest.TestCase):
|
| def test_virtual_test_suite_file_is_not_json(self):
|
| port = self.make_port()
|
| fs = port._filesystem
|
| - fs.write_text_file(fs.join(port.layout_tests_dir(), 'VirtualTestSuites'),
|
| - '{[{[')
|
| + fs.write_text_file(fs.join(port.layout_tests_dir(), 'VirtualTestSuites'), '{[{[')
|
| self.assertRaises(ValueError, port.virtual_test_suites)
|
|
|
| def test_missing_virtual_test_suite_file(self):
|
|
|