| 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): | |
| 15 # TODO(qyearsley): Refactor these tests to re-use the MockFileSystem fro
m the MockHost. | |
| 16 updater = DepsUpdater(MockHost()) | |
| 17 fs = updater.host.filesystem | |
| 18 dirname = '/mock-checkout/third_party/WebKit/LayoutTests/imported/wpt/a' | |
| 19 self.assertFalse(updater.is_manual_test(fs, dirname, 'test.html')) | |
| 20 self.assertFalse(updater.is_manual_test(fs, dirname, 'manual-foo.htm')) | |
| 21 self.assertFalse(updater.is_manual_test(fs, dirname, 'script.js')) | |
| 22 self.assertFalse(updater.is_manual_test(fs, dirname, 'foo')) | |
| 23 | |
| 24 def test_is_manual_test_no_automation_file(self): | |
| 25 updater = DepsUpdater(MockHost()) | |
| 26 fs = updater.host.filesystem | |
| 27 dirname = '/mock-checkout/third_party/WebKit/LayoutTests/imported/wpt/a' | |
| 28 self.assertTrue(updater.is_manual_test(fs, dirname, 'test-manual.html')) | |
| 29 self.assertTrue(updater.is_manual_test(fs, dirname, 'test-manual.htm')) | |
| 30 self.assertTrue(updater.is_manual_test(fs, dirname, 'test-manual.xht')) | |
| 31 | |
| 32 def test_is_manual_test_with_corresponding_automation_file(self): | |
| 33 updater = DepsUpdater(MockHost()) | |
| 34 imported_dir = '/mock-checkout/third_party/WebKit/LayoutTests/imported/' | |
| 35 fs = updater.host.filesystem | |
| 36 fs.files = { | |
| 37 imported_dir + 'wpt_automation/a/x-manual-input.js': '', | |
| 38 imported_dir + 'wpt_automation/a/y-manual-automation.js': '', | |
| 39 } | |
| 40 self.assertTrue(updater.is_manual_test(fs, imported_dir + 'wpt/a', 'x-ma
nual.html')) | |
| 41 self.assertFalse(updater.is_manual_test(fs, imported_dir + 'wpt/a', 'y-m
anual.html')) | |
| 42 | |
| 43 def test_generate_email_list(self): | 14 def test_generate_email_list(self): |
| 44 updater = DepsUpdater(MockHost()) | 15 updater = DepsUpdater(MockHost()) |
| 45 changed_files = [ | 16 changed_files = [ |
| 46 'third_party/WebKit/LayoutTests/foo/bar/file.html', | 17 'third_party/WebKit/LayoutTests/foo/bar/file.html', |
| 47 'third_party/WebKit/LayoutTests/foo/bar/otherfile.html', | 18 'third_party/WebKit/LayoutTests/foo/bar/otherfile.html', |
| 48 'third_party/WebKit/LayoutTests/foo/baz/files.html', | 19 'third_party/WebKit/LayoutTests/foo/baz/files.html', |
| 49 'some/non-test.file', | 20 'some/non-test.file', |
| 50 ] | 21 ] |
| 51 directory_to_owner = { | 22 directory_to_owner = { |
| 52 'foo/bar': 'me@gmail.com', | 23 'foo/bar': 'me@gmail.com', |
| (...skipping 28 matching lines...) Expand all Loading... |
| 81 deleted_tests = ['some/test/b.html'] | 52 deleted_tests = ['some/test/b.html'] |
| 82 renamed_test_pairs = { | 53 renamed_test_pairs = { |
| 83 'some/test/a.html': 'new/a.html', | 54 'some/test/a.html': 'new/a.html', |
| 84 'some/test/c.html': 'new/c.html', | 55 'some/test/c.html': 'new/c.html', |
| 85 } | 56 } |
| 86 updater.update_all_test_expectations_files(deleted_tests, renamed_test_p
airs) | 57 updater.update_all_test_expectations_files(deleted_tests, renamed_test_p
airs) |
| 87 self.assertMultiLineEqual( | 58 self.assertMultiLineEqual( |
| 88 host.filesystem.read_text_file('/mock-checkout/third_party/WebKit/La
youtTests/TestExpectations'), | 59 host.filesystem.read_text_file('/mock-checkout/third_party/WebKit/La
youtTests/TestExpectations'), |
| 89 ('Bug(test) new/a.html [ Failure ]\n' | 60 ('Bug(test) new/a.html [ Failure ]\n' |
| 90 'Bug(test) new/c.html [ Failure ]\n')) | 61 'Bug(test) new/c.html [ Failure ]\n')) |
| OLD | NEW |