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

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/common/net/layouttestresults.py

Issue 2069743002: Rebaseline the actual missing results only (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
Index: third_party/WebKit/Tools/Scripts/webkitpy/common/net/layouttestresults.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/layouttestresults.py b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/layouttestresults.py
index 20fcbaf41a8d5cd6339c66da34d9be1fe924dbbb..a5d493a1f5d40ed263de0bd4b7facae1f608a28c 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/common/net/layouttestresults.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/common/net/layouttestresults.py
@@ -37,50 +37,41 @@ from webkitpy.layout_tests.models.test_expectations import TestExpectations
_log = logging.getLogger(__name__)
-# These are helper functions for navigating the results json structure.
-def for_each_test(tree, handler, prefix=''):
- for key in tree:
- new_prefix = (prefix + '/' + key) if prefix else key
- if 'actual' not in tree[key]:
- for_each_test(tree[key], handler, new_prefix)
- else:
- handler(new_prefix, tree[key])
-
-
-def result_for_test(tree, test):
- parts = test.split('/')
- for part in parts:
- if part not in tree:
- return None
- tree = tree[part]
- return tree
-
-
-class JSONTestResult(object):
+class LayoutTestResult(object):
def __init__(self, test_name, result_dict):
self._test_name = test_name
self._result_dict = result_dict
+ def result_dict(self):
+ return self._result_dict
+
+ def test_name(self):
+ return self._test_name
+
def did_pass_or_run_as_expected(self):
return self.did_pass() or self.did_run_as_expected()
def did_pass(self):
- return test_expectations.PASS in self._actual_as_tokens()
+ return 'PASS' in self.actual_results()
def did_run_as_expected(self):
return 'is_unexpected' not in self._result_dict
- def _tokenize(self, results_string):
- tokens = map(TestExpectations.expectation_from_string, results_string.split(' '))
- if None in tokens:
- _log.warning("Unrecognized result in %s" % results_string)
- return set(tokens)
+ def is_missing_image(self):
+ return 'is_missing_image' in self._result_dict
- @memoized
- def _actual_as_tokens(self):
- actual_results = self._result_dict['actual']
- return self._tokenize(actual_results)
+ def is_missing_text(self):
+ return 'is_missing_text' in self._result_dict
+
+ def is_missing_audio(self):
+ return 'is_missing_audio' in self._result_dict
+
+ def actual_results(self):
+ return self._result_dict['actual']
+
+ def expected_results(self):
+ return self._result_dict['expected']
# FIXME: This should be unified with ResultsSummary or other NRWT layout tests code
@@ -97,6 +88,7 @@ class LayoutTestResults(object):
json_dict = json.loads(content_string)
if not json_dict:
return None
+
return cls(json_dict)
def __init__(self, parsed_json):
@@ -111,8 +103,26 @@ class LayoutTestResults(object):
def chromium_revision(self):
return int(self._results["chromium_revision"])
- def actual_results(self, test):
- result = result_for_test(self._results["tests"], test)
- if result:
- return result["actual"]
- return ""
+ def result_for_test(self, test):
+ parts = test.split("/")
+ tree = self._test_result_tree()
+ for part in parts:
+ if part not in tree:
+ return None
+ tree = tree[part]
+ return LayoutTestResult(test, tree)
+
+ def for_each_test(self, handler):
+ LayoutTestResults._for_each_test(self._test_result_tree(), handler, '')
+
+ @staticmethod
+ def _for_each_test(tree, handler, prefix=''):
+ for key in tree:
+ new_prefix = (prefix + '/' + key) if prefix else key
+ if 'actual' not in tree[key]:
+ LayoutTestResults._for_each_test(tree[key], handler, new_prefix)
+ else:
+ handler(LayoutTestResult(new_prefix, tree[key]))
+
+ def _test_result_tree(self):
+ return self._results['tests']

Powered by Google App Engine
This is Rietveld 408576698