Temporarily add back the file removed in r210463 to unbreak internal bots.
[WebKit-https.git] / Tools / Scripts / webkitpy / benchmark_runner / data / patches / Animometer.patch
1 diff --git a/resources/runner/animometer.js b/resources/runner/animometer.js
2 index b20a1c9..e434e89 100644
3 --- a/resources/runner/animometer.js
4 +++ b/resources/runner/animometer.js
5 @@ -320,6 +320,61 @@ window.benchmarkRunnerClient = {
6      didFinishLastIteration: function()
7      {
8          benchmarkController.showResults();
9 +    },
10 +
11 +    _computeTestReport: function(testName, testResults)
12 +    {
13 +        return [testResults[Strings.json.score]];
14 +    },
15 +
16 +    _computeSuiteReports: function(suiteName, suiteResults)
17 +    {
18 +        var testsReports = {};
19 +        for (var testName in suiteResults) {
20 +            var testReports = this._computeTestReport(testName, suiteResults[testName]);
21 +            testsReports[testName] = { "metrics": { "Score": { "current": testReports } } };
22 +        }
23 +        return testsReports;
24 +    },
25 +
26 +    _computeIterationReports: function(iterationResults)
27 +    {
28 +        var suitesReports = {};
29 +        for (var suiteName in iterationResults[Strings.json.results.tests]) {
30 +            var testsReports = this._computeSuiteReports(suiteName, iterationResults[Strings.json.results.tests][suiteName]);
31 +            suitesReports[suiteName] = { "metrics": { "Score": ["Geometric"] }, "tests": testsReports };
32 +        }
33 +        return suitesReports;
34 +    },
35 +
36 +    _computeResultsReports: function()
37 +    {
38 +        var results = this.results.results[0];
39 +        var iterationReports = this._computeIterationReports(results);
40 +        var debugOutput = {
41 +            options: benchmarkRunnerClient.results.options,
42 +            data: benchmarkRunnerClient.results.data,
43 +        }
44 +        return {"Animometer": {"metrics" : {"Score" : ["Geometric"]}, "tests" : iterationReports }, "debugOutput": debugOutput};
45 +    },
46 +
47 +    didFinishLastIteration: function()
48 +    {
49 +        // submit result to server
50 +        var results = JSON.stringify(this._computeResultsReports());
51 +        var xhr = new XMLHttpRequest();
52 +        xhr.open("POST", "/report");
53 +        xhr.setRequestHeader("Content-type", "application/json");
54 +        xhr.setRequestHeader("Content-length", results.length);
55 +        xhr.setRequestHeader("Connection", "close");
56 +        xhr.onreadystatechange = function() {
57 +            if (xhr.readyState == XMLHttpRequest.DONE && xhr.status == 200) {
58 +                closeRequest = new XMLHttpRequest();
59 +                closeRequest.open("GET", "/shutdown");
60 +                closeRequest.send()
61 +            }
62 +        }
63 +        xhr.send(results);
64      }
65  };
66
67 @@ -357,7 +408,7 @@ window.sectionsManager =
68  window.benchmarkController = {
69      initialize: function()
70      {
71 -        benchmarkController.addOrientationListenerIfNecessary();
72 +        setTimeout(benchmarkController.startBenchmark.bind(benchmarkController), 3000);
73      },
74
75      addOrientationListenerIfNecessary: function() {