| OLD | NEW |
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 1 # Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 import unittest | 5 import unittest |
| 6 | 6 |
| 7 from webkitpy.w3c.deps_updater import DepsUpdater | 7 from webkitpy.w3c.deps_updater import DepsUpdater |
| 8 from webkitpy.common.host_mock import MockHost | 8 from webkitpy.common.host_mock import MockHost |
| 9 from webkitpy.common.system.filesystem_mock import MockFileSystem | 9 from webkitpy.common.system.filesystem_mock import MockFileSystem |
| 10 | 10 |
| 11 | 11 |
| 12 class DepsUpdaterTest(unittest.TestCase): | 12 class DepsUpdaterTest(unittest.TestCase): |
| 13 | 13 |
| 14 def test_is_manual_test_regular_test(self): | 14 def test_is_manual_test_regular_test(self): |
| 15 # TODO(qyearsley): Refactor these tests to re-use the MockFileSystem fro
m the MockHost. |
| 15 updater = DepsUpdater(MockHost()) | 16 updater = DepsUpdater(MockHost()) |
| 16 fs = MockFileSystem() | 17 fs = MockFileSystem() |
| 17 dirname = '/mock-checkout/third_party/WebKit/LayoutTests/imported/wpt/a' | 18 dirname = '/mock-checkout/third_party/WebKit/LayoutTests/imported/wpt/a' |
| 18 self.assertFalse(updater.is_manual_test(fs, dirname, 'test.html')) | 19 self.assertFalse(updater.is_manual_test(fs, dirname, 'test.html')) |
| 19 self.assertFalse(updater.is_manual_test(fs, dirname, 'manual-foo.htm')) | 20 self.assertFalse(updater.is_manual_test(fs, dirname, 'manual-foo.htm')) |
| 20 self.assertFalse(updater.is_manual_test(fs, dirname, 'script.js')) | 21 self.assertFalse(updater.is_manual_test(fs, dirname, 'script.js')) |
| 21 self.assertFalse(updater.is_manual_test(fs, dirname, 'foo')) | 22 self.assertFalse(updater.is_manual_test(fs, dirname, 'foo')) |
| 22 | 23 |
| 23 def test_is_manual_test_no_automation_file(self): | 24 def test_is_manual_test_no_automation_file(self): |
| 24 updater = DepsUpdater(MockHost()) | 25 updater = DepsUpdater(MockHost()) |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 def test_parse_directory_owners(self): | 59 def test_parse_directory_owners(self): |
| 59 updater = DepsUpdater(MockHost()) | 60 updater = DepsUpdater(MockHost()) |
| 60 data_file = [ | 61 data_file = [ |
| 61 {'notification-email': 'charizard@gmail.com', 'directory': 'foo/bar'
}, | 62 {'notification-email': 'charizard@gmail.com', 'directory': 'foo/bar'
}, |
| 62 {'notification-email': 'blastoise@gmail.com', 'directory': 'foo/baz'
}, | 63 {'notification-email': 'blastoise@gmail.com', 'directory': 'foo/baz'
}, |
| 63 {'notification-email': '', 'directory': 'gol/bat'}, | 64 {'notification-email': '', 'directory': 'gol/bat'}, |
| 64 ] | 65 ] |
| 65 self.assertEqual( | 66 self.assertEqual( |
| 66 updater.parse_directory_owners(data_file), | 67 updater.parse_directory_owners(data_file), |
| 67 {'foo/bar': 'charizard@gmail.com', 'foo/baz': 'blastoise@gmail.com'}
) | 68 {'foo/bar': 'charizard@gmail.com', 'foo/baz': 'blastoise@gmail.com'}
) |
| 69 |
| 70 def test_update_test_expectations(self): |
| 71 host = MockHost() |
| 72 host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/Tes
tExpectations'] = ( |
| 73 'Bug(test) some/test/a.html [ Failure ]\n' |
| 74 'Bug(test) some/test/b.html [ Failure ]\n' |
| 75 'Bug(test) some/test/c.html [ Failure ]\n') |
| 76 host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/Vir
tualTestSuites'] = '[]' |
| 77 host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/new
/a.html'] = '' |
| 78 host.filesystem.files['/mock-checkout/third_party/WebKit/LayoutTests/new
/b.html'] = '' |
| 79 updater = DepsUpdater(host) |
| 80 deleted_tests = ['some/test/b.html'] |
| 81 renamed_test_pairs = { |
| 82 'some/test/a.html': 'new/a.html', |
| 83 'some/test/c.html': 'new/c.html', |
| 84 } |
| 85 updater.update_test_expectations(deleted_tests, renamed_test_pairs) |
| 86 self.assertMultiLineEqual( |
| 87 host.filesystem.read_text_file('/mock-checkout/third_party/WebKit/La
youtTests/TestExpectations'), |
| 88 ('Bug(test) new/a.html [ Failure ]\n' |
| 89 'Bug(test) new/c.html [ Failure ]\n')) |
| OLD | NEW |