rebaseline_server: if creating brand new expectations files, include the header

Otherwise, the first time you compare against these expectations, you get
failures.

NOTREECHECKS=true
NOTRY=true
R=stephana@google.com
TBR=stephana

Author: epoger@google.com

Review URL: https://codereview.chromium.org/491063002
This commit is contained in:
epoger 2014-08-20 11:39:34 -07:00 committed by Commit bot
parent 5fc8edc81d
commit 1a17f7aeb2
2 changed files with 11 additions and 1 deletions

View File

@ -351,6 +351,8 @@ class RenderedPicturesComparisons(results.BaseComparisons):
result_dict: dictionary holding output of render_pictures; if None,
this method will return without raising an Exception
"""
# TODO(stephana): These values should be defined as constants somewhere,
# to be kept in sync between this file and writable_expectations.py
expected_header_type = 'ChecksummedImages'
expected_header_revision = 1

View File

@ -79,7 +79,15 @@ class WritableExpectations(git_utils.NewGitCheckout):
# Make sure we have expected-results sections in all our output dicts.
for pathname, adict in dicts.iteritems():
if not adict:
adict = {}
adict = {
# TODO(stephana): These values should be defined as constants
# somewhere, to be kept in sync between this file and
# compare_rendered_pictures.py.
gm_json.JSONKEY_HEADER: {
gm_json.JSONKEY_HEADER_TYPE: 'ChecksummedImages',
gm_json.JSONKEY_HEADER_REVISION: 1,
}
}
if not adict.get(gm_json.JSONKEY_EXPECTEDRESULTS, None):
adict[gm_json.JSONKEY_EXPECTEDRESULTS] = {}
dicts[pathname] = adict