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

Side by Side Diff: chrome/test/data/dromaeo/webrunner.js

Issue 274020: Add UI test for Dromaeo benchmark. (Closed)
Patch Set: Created 11 years, 2 months 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/reset.css ('k') | chrome/test/ui/dromaeo_benchmark_uitest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 (function(){ 1 (function(){
2 2
3 // Populated from: http://www.medcalc.be/manual/t-distribution.php 3 // Populated from: http://www.medcalc.be/manual/t-distribution.php
4 // 95% confidence for N - 1 = 4 4 // 95% confidence for N - 1 = 4
5 var tDistribution = 2.776; 5 var tDistribution = 2.776;
6 6
7 // The number of individual test iterations to do 7 // The number of individual test iterations to do
8 var numTests = 5; 8 var numTests = 5;
9 9
10 // The type of run that we're doing (options are "runs/s" or "ms") 10 // The type of run that we're doing (options are "runs/s" or "ms")
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 var testDone = {}; 223 var testDone = {};
224 var testNames = {}; 224 var testNames = {};
225 var testVersions = {}; 225 var testVersions = {};
226 var dataStore = []; 226 var dataStore = [];
227 var names = []; 227 var names = [];
228 var interval; 228 var interval;
229 var totalTime = 0; 229 var totalTime = 0;
230 var time = 0; 230 var time = 0;
231 var title, testName, testID, testSummary = {} , testSummaryNum = {}, max Total = 0, maxTotalNum = 0; 231 var title, testName, testID, testSummary = {} , testSummaryNum = {}, max Total = 0, maxTotalNum = 0;
232 var nameDone = {}; 232 var nameDone = {};
233 var automated = false;
233 234
234 // Query String Parsing 235 // Query String Parsing
235 var search = (window.location.search || "?").substr(1); 236 var search = (window.location.search || "?").substr(1);
236 237
237 search = search.replace(/&runStyle=([^&]+)/, function(all, type){ 238 search = search.replace(/&runStyle=([^&]+)/, function(all, type){
238 runStyle = type; 239 runStyle = type;
239 return ""; 240 return "";
240 }); 241 });
241 242
242 var parts = search.split("&"); 243 var parts = search.split("&");
(...skipping 19 matching lines...) Expand all
262 var sharkMatch = new RegExp(m[1]); 263 var sharkMatch = new RegExp(m[1]);
263 doShark = function(name) { 264 doShark = function(name) {
264 return sharkMatch.test(name); 265 return sharkMatch.test(name);
265 }; 266 };
266 } 267 }
267 } 268 }
268 269
269 m = /^numTests=(\d+)$/.exec(parts[i]); 270 m = /^numTests=(\d+)$/.exec(parts[i]);
270 if (m) 271 if (m)
271 numTests = Number(m[1]); 272 numTests = Number(m[1]);
273
274 automated = /^automated$/.exec(parts[i]);
272 } 275 }
273 276
274 jQuery(function(){ 277 jQuery(function(){
275 var id = search.match(/id=([\d,]+)/); 278 var id = search.match(/id=([\d,]+)/);
276 279
277 if ( none && !id ) { 280 if ( none && !id ) {
278 $("#overview").hide(); 281 $("#overview").hide();
279 return; 282 return;
280 } 283 }
281 284
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 queue.shift()(); 356 queue.shift()();
354 357
355 } else if ( queue.length == 0 ) { 358 } else if ( queue.length == 0 ) {
356 interval = false; 359 interval = false;
357 time = 0; 360 time = 0;
358 361
359 $("#overview input").remove(); 362 $("#overview input").remove();
360 updateTimebar(); 363 updateTimebar();
361 364
362 if ( dataStore && dataStore.length ) { 365 if ( dataStore && dataStore.length ) {
363 » » » » $("body").addClass("alldone"); 366 » » » » if (!automated) {
364 » » » » var div = jQuery("<div class='results'>Saving... </div>").insertBefore("#overview"); 367 » » » » » $("body").addClass("alldone");
365 » » » » jQuery.ajax({ 368 » » » » » var div = jQuery("<div class='results'>S aving...</div>").insertBefore("#overview");
366 » » » » » type: "POST", 369 » » » » » jQuery.ajax({
367 » » » » » url: "store.php", 370 » » » » » » type: "POST",
368 » » » » » data: "data=" + encodeURIComponent(JSON. stringify(dataStore)) + "&style=" + runStyle, 371 » » » » » » url: "store.php",
369 » » » » » success: function(id){ 372 » » » » » » data: "data=" + encodeURICompone nt(JSON.stringify(dataStore)) + "&style=" + runStyle,
370 » » » » » » var url = window.location.href.r eplace(/\?.*$/, "") + "?id=" + id; 373 » » » » » » success: function(id){
371 » » » » » » 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>"); 374 » » » » » » » var url = window.locatio n.href.replace(/\?.*$/, "") + "?id=" + id;
372 » » » » » } 375 » » » » » » » 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>");
373 » » » » }); 376 » » » » » » }
377 » » » » » });
378 » » » » } else {
379 » » » » » window.automation.SetDone();
380 » » » » }
374 } 381 }
375 } 382 }
376 } 383 }
377 384
378 function updateTimebar(){ 385 function updateTimebar(){
379 $("#timebar").html("<span><strong>" + (runStyle === "runs/s" ? M ath.pow(Math.E, maxTotal / maxTotalNum) : maxTotal).toFixed(2) + "</strong>" + r unStyle + " (Total)</span>"); 386 $("#timebar").html("<span><strong>" + (runStyle === "runs/s" ? M ath.pow(Math.E, maxTotal / maxTotalNum) : maxTotal).toFixed(2) + "</strong>" + r unStyle + " (Total)</span>");
380 } 387 }
381 388
382 // Run once all the test files are fully loaded 389 // Run once all the test files are fully loaded
383 function init(){ 390 function init(){
384 for ( var n = 0; n < names.length; n++ ) { 391 for ( var n = 0; n < names.length; n++ ) {
385 queue = queue.concat( queues[ names[n] ] ); 392 queue = queue.concat( queues[ names[n] ] );
386 } 393 }
387 394
388 totalTime = time; 395 totalTime = time;
389 time += timePerTest; 396 time += timePerTest;
390 updateTime(); 397 updateTime();
391 398
392 » » $("#pause") 399 » » if (!automated) {
393 » » » .val("Run") 400 » » » $("#pause")
394 » » » .click(function(){ 401 » » » » .val("Run")
395 » » » » if ( interval ) { 402 » » » » .click(function(){
396 » » » » » interval = null; 403 » » » » » if ( interval ) {
397 » » » » » this.value = "Run"; 404 » » » » » » interval = null;
398 » » » » } else { 405 » » » » » » this.value = "Run";
399 » » » » » if ( !interval ) { 406 » » » » » } else {
400 » » » » » » interval = true; 407 » » » » » » if ( !interval ) {
401 » » » » » » dequeue(); 408 » » » » » » » interval = true;
409 » » » » » » » dequeue();
410 » » » » » » }
411 » » » » » » this.value = "Pause";
402 } 412 }
403 » » » » » this.value = "Pause"; 413 » » » » });
404 » » » » } 414 » » } else {
405 » » » }); 415 » » » $("#pause")
416 » » » » .val("Automated")
417 » » » » .click(function(){});
418 » » » interval = true;
419 » » » dequeue();
420 » » }
406 } 421 }
407 422
408 function initTest(curID){ 423 function initTest(curID){
409 $("<div class='result-item'></div>") 424 $("<div class='result-item'></div>")
410 .append( testElems[ curID ] ) 425 .append( testElems[ curID ] )
411 .append( "<p>" + (tests[curID] ? tests[ curID ].desc : " ") + "<br/><a href='" + 426 .append( "<p>" + (tests[curID] ? tests[ curID ].desc : " ") + "<br/><a href='" +
412 (tests[curID] && tests[curID].origin ? tests[ cu rID ].origin[1] : "") + "'>Origin</a>, <a href='tests/" + 427 (tests[curID] && tests[curID].origin ? tests[ cu rID ].origin[1] : "") + "'>Origin</a>, <a href='tests/" +
413 (tests[curID] ? tests[ curID ].file : "") + "'>S ource</a>, <b>Tests:</b> " + 428 (tests[curID] ? tests[ curID ].file : "") + "'>S ource</a>, <b>Tests:</b> " +
414 (tests[curID] && tests[curID].tags ? tests[ curI D ].tags.join(", ") : "") + "</p>" ) 429 (tests[curID] && tests[curID].tags ? tests[ curI D ].tags.join(", ") : "") + "</p>" )
415 .append( "<ol class='results'></ol>" ) 430 .append( "<ol class='results'></ol>" )
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 testElems[testID] = $("<div class='test'></div>") 765 testElems[testID] = $("<div class='test'></div>")
751 .click(function(){ 766 .click(function(){
752 var next = jQuery(this).next().next(); 767 var next = jQuery(this).next().next();
753 if ( next.children().length == 0 ) return; 768 if ( next.children().length == 0 ) return;
754 var display = next.css("display"); 769 var display = next.css("display");
755 next.css("display", display == 'none' ? 'block' : 'none'); 770 next.css("display", display == 'none' ? 'block' : 'none');
756 }); 771 });
757 772
758 updateTestPos({curID: testID, collection: tests[testID] ? tests[ testID].name : testID, version: testVersions[testID]}, true); 773 updateTestPos({curID: testID, collection: tests[testID] ? tests[ testID].name : testID, version: testVersions[testID]}, true);
759 } 774 }
775
776 if (automated) {
777 // Add some more stuff if running in automated mode.
778 window.automation = {}
779 window.automation.SetDone = function() {
780 window.document.cookie = "__done=1; path=/";
781 }
782 window.automation.GetScore = function() {
783 return (runStyle === "runs/s" ? Math.pow(Math.E, maxTota l / maxTotalNum) : maxTotal).toString();
784 }
785 window.automation.GetResults = function() {
786 results = {}
787 for (var i = 0; i < dataStore.length; i++) {
788 var data = dataStore[i];
789 // dots are not allowed.
790 var key = (data.collection + "/" + data.name).re place(".", "_");
791 results[key] = data.mean.toString();
792 }
793 return results;
794 }
795 }
760 })(); 796 })();
OLDNEW
« no previous file with comments | « chrome/test/data/dromaeo/reset.css ('k') | chrome/test/ui/dromaeo_benchmark_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698