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

Unified Diff: gm/display_json_results.py

Issue 16155002: Split GM json schema out of display_json_results.py, for sharing with other tools (Closed) Base URL: http://skia.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 7 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 | « no previous file | gm/gm_expectations.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gm/display_json_results.py
===================================================================
--- gm/display_json_results.py (revision 9289)
+++ gm/display_json_results.py (working copy)
@@ -18,19 +18,13 @@
__author__ = 'Elliot Poger'
-import json
+# system-level imports
import sys
+# local imports
+import gm_json
-# These constants must be kept in sync with the kJsonKey_ constants in
-# gm_expectations.cpp !
-JSONKEY_ACTUALRESULTS = 'actual-results'
-JSONKEY_ACTUALRESULTS_FAILED = 'failed'
-JSONKEY_ACTUALRESULTS_FAILUREIGNORED = 'failure-ignored'
-JSONKEY_ACTUALRESULTS_NOCOMPARISON = 'no-comparison'
-JSONKEY_ACTUALRESULTS_SUCCEEDED = 'succeeded'
-
class ResultAccumulator(object):
"""Object that accumulates results of a given type, and can generate a
summary upon request."""
@@ -85,23 +79,23 @@
# Map labels within the JSON file to the ResultAccumulator for each label.
results_map = {
- JSONKEY_ACTUALRESULTS_FAILED:
+ gm_json.JSONKEY_ACTUALRESULTS_FAILED:
ResultAccumulator(name='ExpectationsMismatch',
do_list=True, do_fail=True),
- JSONKEY_ACTUALRESULTS_FAILUREIGNORED:
+ gm_json.JSONKEY_ACTUALRESULTS_FAILUREIGNORED:
ResultAccumulator(name='IgnoredExpectationsMismatch',
do_list=True, do_fail=False),
- JSONKEY_ACTUALRESULTS_NOCOMPARISON:
+ gm_json.JSONKEY_ACTUALRESULTS_NOCOMPARISON:
ResultAccumulator(name='MissingExpectations',
do_list=False, do_fail=False),
- JSONKEY_ACTUALRESULTS_SUCCEEDED:
+ gm_json.JSONKEY_ACTUALRESULTS_SUCCEEDED:
ResultAccumulator(name='Passed',
do_list=False, do_fail=False),
}
success = True
- json_dict = json.load(open(filepath))
- actual_results = json_dict[JSONKEY_ACTUALRESULTS]
+ json_dict = gm_json.Load(filepath)
+ actual_results = json_dict[gm_json.JSONKEY_ACTUALRESULTS]
for label, accumulator in results_map.iteritems():
results = actual_results[label]
if results:
« no previous file with comments | « no previous file | gm/gm_expectations.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698