Update the patch and the plan files of the graphics benchmark with the latest revision
[WebKit-https.git] / Tools / Scripts / webkitpy / benchmark_runner / data / patches / Animometer.patch
1 diff --git a/runner/resources/animometer.js b/runner/resources/animometer.js
2 index d3ac8db..230ac05 100644
3 --- a/runner/resources/animometer.js
4 +++ b/runner/resources/animometer.js
5 @@ -41,14 +41,62 @@ window.benchmarkRunnerClient = {
6          this._resultsDashboard.push(suitesSamplers);
7      },
8      
9 +    _computeTestReport: function(testName, testResults)
10 +    {
11 +        return [testResults[Strings.json.score]];
12 +    },
13 +
14 +    _computeSuiteReports: function(suiteName, suiteResults)
15 +    {
16 +        var testsReports = {};
17 +
18 +        for (var testName in suiteResults[Strings.json.results.tests]) {
19 +            var testReports = this._computeTestReport(testName, suiteResults[Strings.json.results.tests][testName]);
20 +            testsReports[testName] = { "metrics": { "Score": { "current": testReports } } };
21 +        }
22 +
23 +        return testsReports;
24 +    },
25 +
26 +    _computeIterationReports: function(iterationResults)
27 +    {
28 +        var suitesReports = {};
29 +
30 +        for (var suiteName in iterationResults[Strings.json.results.suites]) {
31 +            var testsReports = this._computeSuiteReports(suiteName, iterationResults[Strings.json.results.suites][suiteName]);
32 +            suitesReports[suiteName] = { "metrics": { "Score": ["Geometric"] }, "tests": testsReports };
33 +        }
34 +
35 +        return suitesReports;
36 +    },
37 +
38 +    _computeResultsReports: function()
39 +    {
40 +        var json = this._resultsDashboard.toJSON(false, false);
41 +        var iterationReports = this._computeIterationReports(json[Strings.json.results.iterations][0])
42 +        return {"Animometer": {"metrics" : {"Score" : ["Geometric"]}, "tests" : iterationReports } };
43 +    },
44 +
45      didFinishLastIteration: function ()
46      {
47 -        var json = this._resultsDashboard.toJSON(true, true);
48 -        this.score = json[Strings.json.score];
49 -        this._resultsTable.showIterations(json[Strings.json.results.iterations], this.options);
50 -        sectionsManager.showJSON("json", json[Strings.json.results.iterations][0]);
51 -        suitesManager.updateLocalStorageFromJSON(json[Strings.json.results.iterations][0]);
52 -        benchmarkController.showResults();
53 +        // submit result to server
54 +        var results = JSON.stringify(this._computeResultsReports());
55 +        var xhr = new XMLHttpRequest();
56 +        xhr.open("POST", "/report");
57 +
58 +        xhr.setRequestHeader("Content-type", "application/json");
59 +        xhr.setRequestHeader("Content-length", results.length);
60 +        xhr.setRequestHeader("Connection", "close");
61 +
62 +        xhr.onreadystatechange = function() {
63 +            if (xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) {
64 +                closeRequest = new XMLHttpRequest();
65 +                closeRequest.open("GET", "/shutdown");
66 +                closeRequest.send()
67 +            }
68 +        }
69 +
70 +        xhr.send(results);
71      }
72  }
73  
74 @@ -287,7 +335,13 @@ window.suitesManager =
75  
76              suite.tests.forEach(function(test) {
77                  var testElement = this._createTestElement(listElement, test, suiteCheckbox);
78 +                if (index < 4) {
79 +                    var testCheckbox = this._checkboxElement(testElement);
80 +                    testCheckbox.checked = true;
81 +                }
82              }, this);
83 +            
84 +            this._updateSuiteCheckboxState(suiteCheckbox);
85          }, this);
86      },
87      
88 @@ -387,10 +441,8 @@ window.benchmarkController =
89  {
90      initialize: function()
91      {
92 -        optionsManager.updateUIFromLocalStorage();
93          suitesManager.createElements();
94 -        suitesManager.updateUIFromLocalStorage();
95 -        suitesManager.updateEditsElementsState();
96 +        setTimeout(benchmarkController.startTest, 3000);
97      },
98  
99      onChangeAdaptiveTestCheckbox: function()
100 @@ -411,7 +463,7 @@ window.benchmarkController =
101          var options = optionsManager.updateLocalStorageFromUI();
102          var suites = suitesManager.updateLocalStorageFromUI();
103          sectionsManager.setupRunningSectionStyle(options);
104 -        this._runBenchmark(suites, options);
105 +        benchmarkController._runBenchmark(suites, options);
106          sectionsManager.showSection("running");
107      },
108