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

Unified Diff: expectations/gm/loader.js

Issue 848073005: Revert "delete old things!" (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 5 years, 11 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 | « expectations/gm/ignored-tests.txt ('k') | expectations/gm/view-platform.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: expectations/gm/loader.js
diff --git a/expectations/gm/loader.js b/expectations/gm/loader.js
new file mode 100644
index 0000000000000000000000000000000000000000..c5d8a7c8c19b4124d391265495f7fc262f5864c1
--- /dev/null
+++ b/expectations/gm/loader.js
@@ -0,0 +1,52 @@
+/*
+ * GMExpectedResultsLoader:
+ * Reads an expected-results.json file, and imports its data into $scope.
+ */
+var GMExpectedResultsLoader = angular.module(
+ 'GMExpectedResultsLoader',
+ [],
+ function($httpProvider) {
+ /* Override transformResponse so that the numeric checksums are interpreted as
+ * strings instead, since Javascript cannot handle 64-bit integers. */
+ $httpProvider.defaults.transformResponse = function(data, headersGetter) {
+ return JSON.parse(data.replace(/\s(\d+)\s/g, " \"$1\" "));
+ }
+ }
+);
+GMExpectedResultsLoader.controller(
+ 'GMExpectedResultsLoader.Controller',
+ function($scope, $http) {
+ /* When the changePlatformPath function is called, download expected-results.json
+ * from the desired platform directory.
+ *
+ * When the JSON is received, predigest it and return it to the frontend as
+ * $scope.gmExpectedResults .
+ */
+ $scope.changePlatformPath = function() {
+ $http.get($scope.platformPath + "/expected-results.json").success(
+ function(response) {
+ var jsonResults = [];
+ var imageNameRegex = /^(.+)_([^_]+).png/;
+ angular.forEach(response['expected-results'], function(imageExpectations, imageName) {
+ var matched = imageNameRegex.exec(imageName);
+ var allowedImages = [];
+ angular.forEach(imageExpectations['allowed-digests'], function(allowedDigest, key) {
+ var thisImage = {
+ hashType: allowedDigest[0], hashValue: allowedDigest[1]
+ };
+ allowedImages.push(thisImage);
+ });
+ var thisResult = {
+ test: matched[1], config: matched[2],
+ allowedImages: allowedImages,
+ bugs: imageExpectations['bugs'],
+ reviewedByHuman: imageExpectations['reviewed-by-human']
+ };
+ jsonResults.push(thisResult);
+ });
+ $scope.gmExpectedResults = jsonResults;
+ }
+ );
+ };
+ }
+);
« no previous file with comments | « expectations/gm/ignored-tests.txt ('k') | expectations/gm/view-platform.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698