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

Side by Side Diff: gm/gm_expectations.cpp

Issue 15883004: GM: create GmResultDigest that encapsulates digest type ("bitmap-64bitMD5") and value (12345) (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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright 2013 Google Inc. 2 * Copyright 2013 Google Inc.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license that can be 4 * Use of this source code is governed by a BSD-style license that can be
5 * found in the LICENSE file. 5 * found in the LICENSE file.
6 */ 6 */
7 7
8 #include "gm_expectations.h" 8 #include "gm_expectations.h"
9 #include "SkBitmapHasher.h" 9 #include "SkBitmapHasher.h"
10 #include "SkImageDecoder.h" 10 #include "SkImageDecoder.h"
(...skipping 25 matching lines...) Expand all
36 36
37 SkString SkPathJoin(const char *rootPath, const char *relativePath) { 37 SkString SkPathJoin(const char *rootPath, const char *relativePath) {
38 SkString result(rootPath); 38 SkString result(rootPath);
39 if (!result.endsWith(SkPATH_SEPARATOR)) { 39 if (!result.endsWith(SkPATH_SEPARATOR)) {
40 result.appendUnichar(SkPATH_SEPARATOR); 40 result.appendUnichar(SkPATH_SEPARATOR);
41 } 41 }
42 result.append(relativePath); 42 result.append(relativePath);
43 return result; 43 return result;
44 } 44 }
45 45
46 // TODO(epoger): This currently assumes that the result SkHashDigest was 46 // TODO(epoger): This currently assumes that the result hash digest is a
47 // generated as an SkHashDigest of an SkBitmap. We'll need to allow for oth er 47 // uint64_t generated by SkBitmapHasher. We'll need to allow for other
48 // hash types to cover non-bitmaps. 48 // hash types to cover non-bitmaps.
49 Json::Value ActualResultAsJsonValue(const SkHashDigest& result) { 49 Json::Value ActualResultAsJsonValue(uint64_t result) {
50 Json::Value jsonValue; 50 Json::Value jsonValue;
51 jsonValue[kJsonKey_ActualResults_AnyStatus_BitmapHash] = asJsonValue(res ult); 51 jsonValue[kJsonKey_ActualResults_AnyStatus_BitmapHash] = asJsonValue(res ult);
52 return jsonValue; 52 return jsonValue;
53 } 53 }
54 54
55 Json::Value CreateJsonTree(Json::Value expectedResults, 55 Json::Value CreateJsonTree(Json::Value expectedResults,
56 Json::Value actualResultsFailed, 56 Json::Value actualResultsFailed,
57 Json::Value actualResultsFailureIgnored, 57 Json::Value actualResultsFailureIgnored,
58 Json::Value actualResultsNoComparison, 58 Json::Value actualResultsNoComparison,
59 Json::Value actualResultsSucceeded) { 59 Json::Value actualResultsSucceeded) {
(...skipping 11 matching lines...) Expand all
71 71
72 // Expectations class... 72 // Expectations class...
73 73
74 Expectations::Expectations(bool ignoreFailure) { 74 Expectations::Expectations(bool ignoreFailure) {
75 fIgnoreFailure = ignoreFailure; 75 fIgnoreFailure = ignoreFailure;
76 } 76 }
77 77
78 Expectations::Expectations(const SkBitmap& bitmap, bool ignoreFailure) { 78 Expectations::Expectations(const SkBitmap& bitmap, bool ignoreFailure) {
79 fBitmap = bitmap; 79 fBitmap = bitmap;
80 fIgnoreFailure = ignoreFailure; 80 fIgnoreFailure = ignoreFailure;
81 SkHashDigest digest; 81 uint64_t digest;
82 // TODO(epoger): Better handling for error returned by ComputeDigest()? 82 // TODO(epoger): Better handling for error returned by ComputeDigest()?
83 // For now, we just report a digest of 0 in error cases, like before. 83 // For now, we just report a digest of 0 in error cases, like before.
84 if (!SkBitmapHasher::ComputeDigest(bitmap, &digest)) { 84 if (!SkBitmapHasher::ComputeDigest(bitmap, &digest)) {
85 digest = 0; 85 digest = 0;
86 } 86 }
87 fAllowedBitmapChecksums.push_back() = digest; 87 fAllowedBitmapChecksums.push_back() = digest;
88 } 88 }
89 89
90 Expectations::Expectations(Json::Value jsonElement) { 90 Expectations::Expectations(Json::Value jsonElement) {
91 if (jsonElement.empty()) { 91 if (jsonElement.empty()) {
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 Json::Reader reader; 224 Json::Reader reader;
225 if (!reader.parse(bytes, bytes+size, *jsonRoot)) { 225 if (!reader.parse(bytes, bytes+size, *jsonRoot)) {
226 gm_fprintf(stderr, "error parsing JSON file %s\n", jsonPath); 226 gm_fprintf(stderr, "error parsing JSON file %s\n", jsonPath);
227 DEBUGFAIL_SEE_STDERR; 227 DEBUGFAIL_SEE_STDERR;
228 return false; 228 return false;
229 } 229 }
230 return true; 230 return true;
231 } 231 }
232 232
233 } 233 }
OLDNEW
« no previous file with comments | « gm/gm_expectations.h ('k') | gm/gmmain.cpp » ('j') | src/utils/SkBitmapHasher.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698