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

Side by Side Diff: chrome/test/data/dromaeo/patches/webrunner.patch

Issue 2499923002: Update dromaeo to upstream a876d5250befbc41e2deab9d10cf6085b511d5ed (Closed)
Patch Set: Modified readme Created 4 years 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
« no previous file with comments | « chrome/test/data/dromaeo/patches/librefs.patch ('k') | chrome/test/data/dromaeo/store.php » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 diff --git a/chrome/test/data/dromaeo/webrunner.js b/chrome/test/data/dromaeo/we brunner.js
2 index 63d777b..598998b 100644
3 --- a/chrome/test/data/dromaeo/webrunner.js
4 +++ b/chrome/test/data/dromaeo/webrunner.js
5 @@ -230,6 +230,8 @@
6 var time = 0;
7 var title, testName, testID, testSummary = {} , testSummaryNum = {}, max Total = 0, maxTotalNum = 0;
8 var nameDone = {};
9 + var automated = false;
10 + var post_json = false;
11
12 // Query String Parsing
13 var search = window.limitSearch || (window.location.search || "?").subst r(1);
14 @@ -269,6 +271,11 @@
15 m = /^numTests=(\d+)$/.exec(parts[i]);
16 if (m)
17 numTests = Number(m[1]);
18 +
19 + if (/^automated$/.exec(parts[i]))
20 + automated = true;
21 + if (/^post_json$/.exec(parts[i]))
22 + post_json = true;
23 }
24
25 jQuery(function(){
26 @@ -377,17 +384,28 @@
27 }
28
29 } else if ( dataStore && dataStore.length ) {
30 - $("body").addClass("alldone");
31 - var div = jQuery("<div class='results'>Saving... </div>").insertBefore("#overview");
32 - jQuery.ajax({
33 - type: "POST",
34 - url: "store.php",
35 - data: "data=" + encodeURIComponent(JSON. stringify(dataStore)) + "&style=" + runStyle,
36 - success: function(id){
37 - var url = window.location.href.r eplace(/\?.*$/, "") + "?id=" + id;
38 - div.html("Results saved. You can access them at a later time at the following URL:<br/><strong><a href='" + url + "'>" + url + "</a></strong></div>");
39 - }
40 - });
41 + if (!automated) {
42 + $("body").addClass("alldone");
43 + var div = jQuery("<div class='results'>S aving...</div>").insertBefore("#overview");
44 + jQuery.ajax({
45 + type: "POST",
46 + url: "store.php",
47 + data: "data=" + encodeURICompone nt(JSON.stringify(dataStore)) + "&style=" + runStyle,
48 + success: function(id){
49 + var url = window.locatio n.href.replace(/\?.*$/, "") + "?id=" + id;
50 + div.html("Results saved. You can access them at a later time at the following URL:<br/><strong><a href=' " + url + "'>" + url + "</a></strong></div>");
51 + }
52 + });
53 + } else if (post_json) {
54 + jQuery.ajax({
55 + type: "POST",
56 + url: "store.php",
57 + data: "data=" + encodeURICompone nt(JSON.stringify(window.automation.GetResults()))
58 + });
59 + }
60 + else {
61 + window.automation.SetDone();
62 + }
63 }
64 }
65 }
66 @@ -406,20 +424,28 @@
67 time += timePerTest;
68 updateTime();
69
70 - $("#pause")
71 - .val("Run")
72 - .click(function(){
73 - if ( interval ) {
74 - interval = null;
75 - this.value = "Run";
76 - } else {
77 - if ( !interval ) {
78 - interval = true;
79 - dequeue();
80 + if (!automated) {
81 + $("#pause")
82 + .val("Run")
83 + .click(function(){
84 + if ( interval ) {
85 + interval = null;
86 + this.value = "Run";
87 + } else {
88 + if ( !interval ) {
89 + interval = true;
90 + dequeue();
91 + }
92 + this.value = "Pause";
93 }
94 - this.value = "Pause";
95 - }
96 - });
97 + });
98 + } else {
99 + $("#pause")
100 + .val("Automated")
101 + .click(function(){});
102 + interval = true;
103 + dequeue();
104 + }
105
106 if ( window.limitSearch ) {
107 $("#pause").click();
108 @@ -778,4 +804,45 @@
109
110 updateTestPos({curID: testID, collection: tests[testID] ? tests[ testID].name : testID, version: testVersions[testID]}, true);
111 }
112 +
113 + if (automated) {
114 + // Add some more stuff if running in automated mode.
115 + window.automation = {}
116 + window.automation.SetDone = function() {
117 + console.log("Total: " + this.GetScore());
118 + window.document.cookie = "__done=1; path=/";
119 + }
120 + window.automation.GetScore = function() {
121 + return (runStyle === "runs/s" ? Math.pow(Math.E, maxTota l / maxTotalNum) : maxTotal).toString();
122 + }
123 + window.automation.GetResults = function() {
124 + var results = {};
125 + var aggregated = {};
126 + function normalizeName(name) {
127 + // At least for ui_tests, dots are not allowed.
128 + return name.replace(".", "_");
129 + }
130 + function appendToAggregated(name, value) {
131 + name = normalizeName(name);
132 + (aggregated[name] || (aggregated[name] = [])).pu sh(Math.log(value));
133 + }
134 +
135 + for (var i = 0; i < dataStore.length; i++) {
136 + var data = dataStore[i];
137 + var topName = data.collection.split("-", 1)[0];
138 + appendToAggregated(topName, data.mean);
139 + appendToAggregated(data.collection, data.mean);
140 + results[normalizeName(data.collection + "/" + da ta.name)] = data.mean.toString();
141 + }
142 +
143 + for (var name in aggregated) {
144 + var means = aggregated[name];
145 + var sum = 0;
146 + for (var i = 0; i < means.length; i++) sum += me ans[i];
147 + results[name] = Math.pow(Math.E, sum/means.lengt h).toString();
148 + }
149 +
150 + return results;
151 + }
152 + }
153 })();
154 --
155 2.8.0.rc3.226.g39d4020
156
OLDNEW
« no previous file with comments | « chrome/test/data/dromaeo/patches/librefs.patch ('k') | chrome/test/data/dromaeo/store.php » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698