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

Side by Side Diff: third_party/WebKit/PerformanceTests/Dromaeo/resources/dromaeorunner.js

Issue 2858783003: Refactor prepareToMeasureValuesAsync to startMeasureValuesAsyn which run test through callback (Closed)
Patch Set: Address Xianzhu's review comments Created 3 years, 7 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
OLDNEW
1 (function(){ 1 (function(){
2 var DRT = { 2 var DRT = {
3 baseURL: "./resources/dromaeo/web/index.html", 3 baseURL: "./resources/dromaeo/web/index.html",
4 4
5 setup: function(testName) { 5 setup: function(testName) {
6 var ITERATION_COUNT = 5; 6 var ITERATION_COUNT = 5;
7 PerfTestRunner.prepareToMeasureValuesAsync({ 7 PerfTestRunner.startMeasureValuesAsync({
8 iterationCount: ITERATION_COUNT, 8 iterationCount: ITERATION_COUNT,
9 doNotMeasureMemoryUsage: true, 9 doNotMeasureMemoryUsage: true,
10 doNotIgnoreInitialRun: true, 10 doNotIgnoreInitialRun: true,
11 unit: 'runs/s' 11 unit: 'runs/s',
12 run: function() {
13 var iframe = document.createElement("iframe");
14 var url = DRT.baseURL + "?" + testName + '&numTests=' + ITE RATION_COUNT;
15 iframe.setAttribute("src", url);
16 document.body.insertBefore(iframe, document.body.firstChild );
17 iframe.addEventListener(
18 "load", function() {
19 DRT.targetDocument = iframe.contentDocument;
20 DRT.targetWindow = iframe.contentDocument.defaultVi ew;
21 });
22
23 window.addEventListener(
24 "message",
25 function(event) {
26 switch(event.data.name) {
27 case "dromaeo:ready":
28 DRT.start();
29 break;
30 case "dromaeo:progress":
31 DRT.progress(event.data);
32 break;
33 case "dromaeo:alldone":
34 DRT.teardown(event.data);
35 break;
36 }
37 });
38 }
12 }); 39 });
13
14 var iframe = document.createElement("iframe");
15 var url = DRT.baseURL + "?" + testName + '&numTests=' + ITERATION_C OUNT;
16 iframe.setAttribute("src", url);
17 document.body.insertBefore(iframe, document.body.firstChild);
18 iframe.addEventListener(
19 "load", function() {
20 DRT.targetDocument = iframe.contentDocument;
21 DRT.targetWindow = iframe.contentDocument.defaultView;
22 });
23
24 window.addEventListener(
25 "message",
26 function(event) {
27 switch(event.data.name) {
28 case "dromaeo:ready":
29 DRT.start();
30 break;
31 case "dromaeo:progress":
32 DRT.progress(event.data);
33 break;
34 case "dromaeo:alldone":
35 DRT.teardown(event.data);
36 break;
37 }
38 });
39 }, 40 },
40 41
41 start: function() { 42 start: function() {
42 DRT.targetWindow.postMessage({ name: "dromaeo:start" } , "*"); 43 DRT.targetWindow.postMessage({ name: "dromaeo:start" } , "*");
43 }, 44 },
44 45
45 progress: function(message) { 46 progress: function(message) {
46 var score = message.status.score; 47 var score = message.status.score;
47 if (score) 48 if (score)
48 DRT.log(score.name + ': [' + score.times.join(', ') + ']'); 49 DRT.log(score.name + ': [' + score.times.join(', ') + ']');
(...skipping 27 matching lines...) Expand all
76 }; 77 };
77 78
78 // These functions are referred from htmlrunner.js 79 // These functions are referred from htmlrunner.js
79 this.startTest = DRT.targetDelegateOf("startTest"); 80 this.startTest = DRT.targetDelegateOf("startTest");
80 this.test = DRT.targetDelegateOf("test"); 81 this.test = DRT.targetDelegateOf("test");
81 this.endTest = DRT.targetDelegateOf("endTest"); 82 this.endTest = DRT.targetDelegateOf("endTest");
82 this.prep = DRT.targetDelegateOf("prep"); 83 this.prep = DRT.targetDelegateOf("prep");
83 84
84 window.DRT = DRT; 85 window.DRT = DRT;
85 })(); 86 })();
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698