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

Unified 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 side-by-side diff with in-line comments
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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/dromaeo/patches/webrunner.patch
diff --git a/chrome/test/data/dromaeo/patches/webrunner.patch b/chrome/test/data/dromaeo/patches/webrunner.patch
new file mode 100644
index 0000000000000000000000000000000000000000..a273425dca4ab8bef7e67611851d59ef280d33e2
--- /dev/null
+++ b/chrome/test/data/dromaeo/patches/webrunner.patch
@@ -0,0 +1,156 @@
+diff --git a/chrome/test/data/dromaeo/webrunner.js b/chrome/test/data/dromaeo/webrunner.js
+index 63d777b..598998b 100644
+--- a/chrome/test/data/dromaeo/webrunner.js
++++ b/chrome/test/data/dromaeo/webrunner.js
+@@ -230,6 +230,8 @@
+ var time = 0;
+ var title, testName, testID, testSummary = {} , testSummaryNum = {}, maxTotal = 0, maxTotalNum = 0;
+ var nameDone = {};
++ var automated = false;
++ var post_json = false;
+
+ // Query String Parsing
+ var search = window.limitSearch || (window.location.search || "?").substr(1);
+@@ -269,6 +271,11 @@
+ m = /^numTests=(\d+)$/.exec(parts[i]);
+ if (m)
+ numTests = Number(m[1]);
++
++ if (/^automated$/.exec(parts[i]))
++ automated = true;
++ if (/^post_json$/.exec(parts[i]))
++ post_json = true;
+ }
+
+ jQuery(function(){
+@@ -377,17 +384,28 @@
+ }
+
+ } else if ( dataStore && dataStore.length ) {
+- $("body").addClass("alldone");
+- var div = jQuery("<div class='results'>Saving...</div>").insertBefore("#overview");
+- jQuery.ajax({
+- type: "POST",
+- url: "store.php",
+- data: "data=" + encodeURIComponent(JSON.stringify(dataStore)) + "&style=" + runStyle,
+- success: function(id){
+- var url = window.location.href.replace(/\?.*$/, "") + "?id=" + id;
+- 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>");
+- }
+- });
++ if (!automated) {
++ $("body").addClass("alldone");
++ var div = jQuery("<div class='results'>Saving...</div>").insertBefore("#overview");
++ jQuery.ajax({
++ type: "POST",
++ url: "store.php",
++ data: "data=" + encodeURIComponent(JSON.stringify(dataStore)) + "&style=" + runStyle,
++ success: function(id){
++ var url = window.location.href.replace(/\?.*$/, "") + "?id=" + id;
++ 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>");
++ }
++ });
++ } else if (post_json) {
++ jQuery.ajax({
++ type: "POST",
++ url: "store.php",
++ data: "data=" + encodeURIComponent(JSON.stringify(window.automation.GetResults()))
++ });
++ }
++ else {
++ window.automation.SetDone();
++ }
+ }
+ }
+ }
+@@ -406,20 +424,28 @@
+ time += timePerTest;
+ updateTime();
+
+- $("#pause")
+- .val("Run")
+- .click(function(){
+- if ( interval ) {
+- interval = null;
+- this.value = "Run";
+- } else {
+- if ( !interval ) {
+- interval = true;
+- dequeue();
++ if (!automated) {
++ $("#pause")
++ .val("Run")
++ .click(function(){
++ if ( interval ) {
++ interval = null;
++ this.value = "Run";
++ } else {
++ if ( !interval ) {
++ interval = true;
++ dequeue();
++ }
++ this.value = "Pause";
+ }
+- this.value = "Pause";
+- }
+- });
++ });
++ } else {
++ $("#pause")
++ .val("Automated")
++ .click(function(){});
++ interval = true;
++ dequeue();
++ }
+
+ if ( window.limitSearch ) {
+ $("#pause").click();
+@@ -778,4 +804,45 @@
+
+ updateTestPos({curID: testID, collection: tests[testID] ? tests[testID].name : testID, version: testVersions[testID]}, true);
+ }
++
++ if (automated) {
++ // Add some more stuff if running in automated mode.
++ window.automation = {}
++ window.automation.SetDone = function() {
++ console.log("Total: " + this.GetScore());
++ window.document.cookie = "__done=1; path=/";
++ }
++ window.automation.GetScore = function() {
++ return (runStyle === "runs/s" ? Math.pow(Math.E, maxTotal / maxTotalNum) : maxTotal).toString();
++ }
++ window.automation.GetResults = function() {
++ var results = {};
++ var aggregated = {};
++ function normalizeName(name) {
++ // At least for ui_tests, dots are not allowed.
++ return name.replace(".", "_");
++ }
++ function appendToAggregated(name, value) {
++ name = normalizeName(name);
++ (aggregated[name] || (aggregated[name] = [])).push(Math.log(value));
++ }
++
++ for (var i = 0; i < dataStore.length; i++) {
++ var data = dataStore[i];
++ var topName = data.collection.split("-", 1)[0];
++ appendToAggregated(topName, data.mean);
++ appendToAggregated(data.collection, data.mean);
++ results[normalizeName(data.collection + "/" + data.name)] = data.mean.toString();
++ }
++
++ for (var name in aggregated) {
++ var means = aggregated[name];
++ var sum = 0;
++ for (var i = 0; i < means.length; i++) sum += means[i];
++ results[name] = Math.pow(Math.E, sum/means.length).toString();
++ }
++
++ return results;
++ }
++ }
+ })();
+--
+2.8.0.rc3.226.g39d4020
+
« 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