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

Side by Side Diff: gm/rebaseline_server/writable_expectations.py

Issue 491063002: rebaseline_server: if creating brand new expectations files, include the header (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 4 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 unified diff | Download patch
« no previous file with comments | « gm/rebaseline_server/compare_rendered_pictures.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 """ 3 """
4 Copyright 2014 Google Inc. 4 Copyright 2014 Google Inc.
5 5
6 Use of this source code is governed by a BSD-style license that can be 6 Use of this source code is governed by a BSD-style license that can be
7 found in the LICENSE file. 7 found in the LICENSE file.
8 8
9 Expectations on local disk that we can modify. 9 Expectations on local disk that we can modify.
10 """ 10 """
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 modifications: data[KEY__LIVE_EDITS__MODIFICATIONS] coming back from the 72 modifications: data[KEY__LIVE_EDITS__MODIFICATIONS] coming back from the
73 rebaseline_server UI frontend 73 rebaseline_server UI frontend
74 """ 74 """
75 logging.info('Reading in dicts from writable Skia checkout in %s ...' % 75 logging.info('Reading in dicts from writable Skia checkout in %s ...' %
76 self.root) 76 self.root)
77 dicts = results.BaseComparisons.read_dicts_from_root(self.root) 77 dicts = results.BaseComparisons.read_dicts_from_root(self.root)
78 78
79 # Make sure we have expected-results sections in all our output dicts. 79 # Make sure we have expected-results sections in all our output dicts.
80 for pathname, adict in dicts.iteritems(): 80 for pathname, adict in dicts.iteritems():
81 if not adict: 81 if not adict:
82 adict = {} 82 adict = {
83 # TODO(stephana): These values should be defined as constants
84 # somewhere, to be kept in sync between this file and
85 # compare_rendered_pictures.py.
86 gm_json.JSONKEY_HEADER: {
87 gm_json.JSONKEY_HEADER_TYPE: 'ChecksummedImages',
88 gm_json.JSONKEY_HEADER_REVISION: 1,
89 }
90 }
83 if not adict.get(gm_json.JSONKEY_EXPECTEDRESULTS, None): 91 if not adict.get(gm_json.JSONKEY_EXPECTEDRESULTS, None):
84 adict[gm_json.JSONKEY_EXPECTEDRESULTS] = {} 92 adict[gm_json.JSONKEY_EXPECTEDRESULTS] = {}
85 dicts[pathname] = adict 93 dicts[pathname] = adict
86 94
87 for modification in modifications: 95 for modification in modifications:
88 expectations = modification[imagepair.KEY__IMAGEPAIRS__EXPECTATIONS] 96 expectations = modification[imagepair.KEY__IMAGEPAIRS__EXPECTATIONS]
89 _add_image_info_to_expectations( 97 _add_image_info_to_expectations(
90 expectations=expectations, 98 expectations=expectations,
91 filepath=modification[imagepair.KEY__IMAGEPAIRS__IMAGE_B_URL]) 99 filepath=modification[imagepair.KEY__IMAGEPAIRS__IMAGE_B_URL])
92 extra_columns = modification[imagepair.KEY__IMAGEPAIRS__EXTRACOLUMNS] 100 extra_columns = modification[imagepair.KEY__IMAGEPAIRS__EXTRACOLUMNS]
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 be true. 174 be true.
167 175
168 Args: 176 Args:
169 expectations: the expectations dict to augment 177 expectations: the expectations dict to augment
170 filepath: relative path to the image file 178 filepath: relative path to the image file
171 """ 179 """
172 (checksum_algorithm, checksum_value) = FILEPATH_RE.match(filepath).groups() 180 (checksum_algorithm, checksum_value) = FILEPATH_RE.match(filepath).groups()
173 expectations[gm_json.JSONKEY_IMAGE_CHECKSUMALGORITHM] = checksum_algorithm 181 expectations[gm_json.JSONKEY_IMAGE_CHECKSUMALGORITHM] = checksum_algorithm
174 expectations[gm_json.JSONKEY_IMAGE_CHECKSUMVALUE] = checksum_value 182 expectations[gm_json.JSONKEY_IMAGE_CHECKSUMVALUE] = checksum_value
175 expectations[gm_json.JSONKEY_IMAGE_FILEPATH] = filepath 183 expectations[gm_json.JSONKEY_IMAGE_FILEPATH] = filepath
OLDNEW
« no previous file with comments | « gm/rebaseline_server/compare_rendered_pictures.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698