Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(278)

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater_unittest.py

Issue 2709103009: Fix specifier simplification and add test. (Closed)
Patch Set: Remove print statements, set MockPortFactory in mock_host method. Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater_unittest.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater_unittest.py
index b705cdef49291f6f83657cf49763eb6eb4c853f2..847eb2fa1aad1b82b82f5295a0159ce1a6c9b267 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater_unittest.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater_unittest.py
@@ -10,6 +10,7 @@ from webkitpy.common.net.buildbot_mock import MockBuildBot
from webkitpy.common.net.layout_test_results import LayoutTestResult, LayoutTestResults
from webkitpy.common.system.log_testing import LoggingTestCase
from webkitpy.layout_tests.builder_list import BuilderList
+from webkitpy.layout_tests.port.factory_mock import MockPortFactory
from webkitpy.w3c.wpt_expectations_updater import WPTExpectationsUpdater, MARKER_COMMENT
@@ -18,6 +19,7 @@ class WPTExpectationsUpdaterTest(LoggingTestCase):
def mock_host(self):
super(WPTExpectationsUpdaterTest, self).setUp()
host = MockHost()
+ host.port_factory = MockPortFactory(host)
host.builders = BuilderList({
'MOCK Try Mac10.10': {
'port_name': 'test-mac-mac10.10',
@@ -34,6 +36,11 @@ class WPTExpectationsUpdaterTest(LoggingTestCase):
'specifiers': ['Trusty', 'Release'],
'is_try_builder': True,
},
+ 'MOCK Try Precise': {
+ 'port_name': 'test-linux-precise',
+ 'specifiers': ['Precise', 'Release'],
+ 'is_try_builder': True,
+ },
'MOCK Try Win10': {
'port_name': 'test-win-win10',
'specifiers': ['Win10', 'Release'],
@@ -163,7 +170,7 @@ class WPTExpectationsUpdaterTest(LoggingTestCase):
self.assertEqual(
updater.create_line_list(results),
[
- 'crbug.com/test [ Linux ] external/fake/test/path.html [ Pass ]',
+ 'crbug.com/test [ Trusty ] external/fake/test/path.html [ Pass ]',
'crbug.com/test [ Mac10.11 ] external/fake/test/path.html [ Timeout ]',
'crbug.com/test [ Mac10.10 ] external/fake/test/zzzz.html [ Failure ]',
])
@@ -171,6 +178,7 @@ class WPTExpectationsUpdaterTest(LoggingTestCase):
def test_specifier_part(self):
updater = WPTExpectationsUpdater(self.mock_host())
self.assertEqual(updater.specifier_part(['test-mac-mac10.10'], 'x/y.html'), '[ Mac10.10 ]')
+ self.assertEqual(updater.specifier_part([], 'x/y.html'), '')
def test_skipped_specifiers_when_test_is_wontfix(self):
host = self.mock_host()
@@ -184,7 +192,7 @@ class WPTExpectationsUpdaterTest(LoggingTestCase):
macros = {
'mac': ['Mac10.10', 'mac10.11'],
'win': ['Win7', 'win10'],
- 'Linux': ['TRUSTY'],
+ 'Linux': ['Trusty'],
}
self.assertEqual(WPTExpectationsUpdater.simplify_specifiers(['mac10.10', 'mac10.11'], macros), ['Mac'])
self.assertEqual(WPTExpectationsUpdater.simplify_specifiers(['Mac10.10', 'Mac10.11', 'Trusty'], macros), ['Linux', 'Mac'])
@@ -193,6 +201,17 @@ class WPTExpectationsUpdaterTest(LoggingTestCase):
self.assertEqual(WPTExpectationsUpdater.simplify_specifiers(['a', 'b', 'c'], {}), ['A', 'B', 'C'])
self.assertEqual(WPTExpectationsUpdater.simplify_specifiers(['Mac', 'Win', 'Linux'], macros), [])
+ def test_specifier_part_with_skipped_test(self):
+ host = self.mock_host()
+ expectations_path = '/test.checkout/LayoutTests/NeverFixTests'
+ host.filesystem.files[expectations_path] = 'crbug.com/111 [ Linux Mac10.11 ] external/wpt/test.html [ WontFix ]\n'
+ host.filesystem.files['/test.checkout/LayoutTests/external/wpt/test.html'] = ''
+ updater = WPTExpectationsUpdater(host)
+ self.assertEqual(
+ updater.specifier_part(['test-mac-mac10.10', 'test-win-win7', 'test-win-win10'], 'external/wpt/test.html'), '')
+ self.assertEqual(
+ updater.specifier_part(['test-win-win7', 'test-win-win10'], 'external/wpt/another.html'), '[ Win ]')
+
def test_merge_dicts_with_conflict_raise_exception(self):
updater = WPTExpectationsUpdater(self.mock_host())
# Both dicts here have the key "one", and the value is not equal.
@@ -260,7 +279,8 @@ class WPTExpectationsUpdaterTest(LoggingTestCase):
def test_write_to_test_expectations_with_marker_comment(self):
host = self.mock_host()
- expectations_path = '/mock-checkout/third_party/WebKit/LayoutTests/TestExpectations'
+
+ expectations_path = host.port_factory.get().path_to_generic_test_expectations_file()
host.filesystem.files[expectations_path] = MARKER_COMMENT + '\n'
updater = WPTExpectationsUpdater(host)
line_list = ['crbug.com/123 [ Trusty ] fake/file/path.html [ Pass ]']
@@ -273,21 +293,21 @@ class WPTExpectationsUpdaterTest(LoggingTestCase):
def test_write_to_test_expectations_with_no_marker_comment(self):
host = self.mock_host()
- expectations_path = '/mock-checkout/third_party/WebKit/LayoutTests/TestExpectations'
- host.filesystem.files[expectations_path] = 'crbug.com/111 [ Trusty ]\n'
+ expectations_path = host.port_factory.get().path_to_generic_test_expectations_file()
+ host.filesystem.files[expectations_path] = 'crbug.com/111 [ Trusty ] foo/bar.html [ Failure ]\n'
updater = WPTExpectationsUpdater(host)
line_list = ['crbug.com/123 [ Trusty ] fake/file/path.html [ Pass ]']
updater.write_to_test_expectations(line_list)
value = host.filesystem.read_text_file(expectations_path)
self.assertMultiLineEqual(
value,
- ('crbug.com/111 [ Trusty ]\n'
+ ('crbug.com/111 [ Trusty ] foo/bar.html [ Failure ]\n'
'\n' + MARKER_COMMENT + '\n'
'crbug.com/123 [ Trusty ] fake/file/path.html [ Pass ]'))
def test_write_to_test_expectations_skips_existing_lines(self):
host = self.mock_host()
- expectations_path = '/mock-checkout/third_party/WebKit/LayoutTests/TestExpectations'
+ expectations_path = host.port_factory.get().path_to_generic_test_expectations_file()
host.filesystem.files[expectations_path] = 'crbug.com/111 dont/copy/me.html [ Failure ]\n'
updater = WPTExpectationsUpdater(host)
line_list = [
@@ -304,7 +324,7 @@ class WPTExpectationsUpdaterTest(LoggingTestCase):
def test_write_to_test_expectations_with_marker_and_no_lines(self):
host = self.mock_host()
- expectations_path = '/mock-checkout/third_party/WebKit/LayoutTests/TestExpectations'
+ expectations_path = host.port_factory.get().path_to_generic_test_expectations_file()
host.filesystem.files[expectations_path] = (
MARKER_COMMENT + '\n'
'crbug.com/123 [ Trusty ] fake/file/path.html [ Pass ]\n')
« no previous file with comments | « third_party/WebKit/Tools/Scripts/webkitpy/w3c/wpt_expectations_updater.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698