[iOS] Key code is 0 for many hardware keyboard keys
[WebKit-https.git] / Websites / browserbench.org / Speedometer / resources / benchmark-report.js
1 // This file can be customized to report results as needed.
2
3 (function () {
4     if (!window.testRunner && location.search != '?webkit' && location.hash != '#webkit')
5         return;
6
7     if (window.testRunner)
8         testRunner.waitUntilDone();
9
10     var scriptElement = document.createElement('script');
11     scriptElement.src = '../resources/runner.js';
12     document.head.appendChild(scriptElement);
13
14     var styleElement = document.createElement('style');
15     styleElement.textContent = 'pre { padding-top: 600px; }';
16     document.head.appendChild(styleElement);
17
18     var createTest;
19     var valuesByIteration = new Array;
20
21     window.onload = function () {
22         document.body.removeChild(document.querySelector('main'));
23         startBenchmark();
24     }
25
26     window.benchmarkClient = {
27         iterationCount: 5, // Use 4 different instances of DRT/WTR to run 5 iterations.
28         willStartFirstIteration: function (iterationCount) {
29             createTest = function (name, aggregator, isLastTest) {
30                 return {
31                     customIterationCount: iterationCount,
32                     doNotIgnoreInitialRun: true,
33                     doNotMeasureMemoryUsage: true,
34                     continueTesting: !isLastTest,
35                     unit: 'ms',
36                     name: name,
37                     aggregator: aggregator};
38             }
39             PerfTestRunner.prepareToMeasureValuesAsync(createTest(null, 'Total'));
40         },
41         didRunSuites: function (measuredValues) {
42             PerfTestRunner.measureValueAsync(measuredValues.total);
43             valuesByIteration.push(measuredValues.tests);
44         },
45         didFinishLastIteration: function () {
46             document.head.removeChild(document.querySelector('style'));
47
48             var measuredValuesByFullName = {};
49             function addToMeasuredValue(value, fullName, aggregator) {
50                 var values = measuredValuesByFullName[fullName] || new Array;
51                 measuredValuesByFullName[fullName] = values;
52                 values.push(value);
53                 values.aggregator = aggregator;
54             }
55
56             valuesByIteration.forEach(function (measuredValues) {
57                 for (var suiteName in measuredValues) {
58                     var suite = measuredValues[suiteName];
59                     for (var testName in suite.tests) {
60                         var test = suite.tests[testName];
61                         for (var subtestName in test.tests)
62                             addToMeasuredValue(test.tests[subtestName], suiteName + '/' + testName + '/' + subtestName);
63                         addToMeasuredValue(test.total, suiteName + '/' + testName, 'Total');
64                     }
65                     addToMeasuredValue(suite.total, suiteName, 'Total');
66                 }
67             });
68
69             var fullNames = new Array;
70             for (var fullName in measuredValuesByFullName)
71                 fullNames.push(fullName);
72
73             for (var i = 0; i < fullNames.length; i++) {
74                 var values = measuredValuesByFullName[fullNames[i]];
75                 PerfTestRunner.reportValues(createTest(fullNames[i], values.aggregator, i + 1 == fullNames.length), values);
76             }
77         }
78     };
79 })();