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

Side by Side Diff: PerformanceTests/resources/runner.js

Issue 675983004: Allow performance tests to test full rendering performance (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: s/forceFullLayout/forceLayout/g Created 6 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « PerformanceTests/ShadowDOM/shadow-style-share-with-distribution.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // There are tests for computeStatistics() located in LayoutTests/fast/harness/p erftests 1 // There are tests for computeStatistics() located in LayoutTests/fast/harness/p erftests
2 2
3 if (window.testRunner) { 3 if (window.testRunner) {
4 testRunner.waitUntilDone(); 4 testRunner.waitUntilDone();
5 testRunner.dumpAsText(); 5 testRunner.dumpAsText();
6 } 6 }
7 7
8 (function () { 8 (function () {
9 var logLines = null; 9 var logLines = null;
10 var completedIterations = -1; 10 var completedIterations = -1;
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 logLines.push(text); 130 logLines.push(text);
131 else 131 else
132 logInDocument(text); 132 logInDocument(text);
133 } 133 }
134 134
135 PerfTestRunner.logFatalError = function (text) { 135 PerfTestRunner.logFatalError = function (text) {
136 PerfTestRunner.log(text); 136 PerfTestRunner.log(text);
137 finish(); 137 finish();
138 } 138 }
139 139
140 PerfTestRunner.forceLayout = function(doc) {
141 doc = doc || document;
142 // Forcing full layout is only fully feasible when window.internals is a vailable.
leviw_travelin_and_unemployed 2014/10/30 20:33:53 I don't think this naming is right. Simply calling
Xianzhu 2014/10/30 21:29:12 I'm not sure what the correct name is. I thought s
143 if (window.fullLayoutMeasurement) {
144 if (window.internals)
145 internals.forceCompositingUpdate(doc);
146 else
147 PerfTestRunner.logFatalError('window.internals API is required f or full layout measurement.');
148 return;
149 }
150
151 // Otherwise just force style recalc and layout without compositing upda te and paint invalidation.
152 if (doc.body)
153 doc.body.offsetHeight;
154 else if (doc.documentElement)
155 doc.documentElement.offsetHeight;
156 };
157
140 function start(test, runner) { 158 function start(test, runner) {
141 if (!test) { 159 if (!test) {
142 PerfTestRunner.logFatalError("Got a bad test object."); 160 PerfTestRunner.logFatalError("Got a bad test object.");
143 return; 161 return;
144 } 162 }
145 currentTest = test; 163 currentTest = test;
146 // FIXME: We should be using multiple instances of test runner on Dromae o as well but it's too slow now. 164 // FIXME: We should be using multiple instances of test runner on Dromae o as well but it's too slow now.
147 // FIXME: Don't hard code the number of in-process iterations to use ins ide a test runner. 165 // FIXME: Don't hard code the number of in-process iterations to use ins ide a test runner.
148 iterationCount = test.dromaeoIterationCount || (window.testRunner ? 5 : 20); 166 iterationCount = test.dromaeoIterationCount || (window.testRunner ? 5 : 20);
149 logLines = window.testRunner ? [] : null; 167 logLines = window.testRunner ? [] : null;
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 var iframe = document.createElement("iframe"); 322 var iframe = document.createElement("iframe");
305 document.body.appendChild(iframe); 323 document.body.appendChild(iframe);
306 324
307 iframe.sandbox = ''; // Prevent external loads which could cause wr ite() to return before completing the parse. 325 iframe.sandbox = ''; // Prevent external loads which could cause wr ite() to return before completing the parse.
308 iframe.style.width = "600px"; // Have a reasonable size so we're not line-breaking on every character. 326 iframe.style.width = "600px"; // Have a reasonable size so we're not line-breaking on every character.
309 iframe.style.height = "800px"; 327 iframe.style.height = "800px";
310 iframe.contentDocument.open(); 328 iframe.contentDocument.open();
311 329
312 for (var chunkIndex = 0; chunkIndex < chunks.length; chunkIndex++) { 330 for (var chunkIndex = 0; chunkIndex < chunks.length; chunkIndex++) {
313 iframe.contentDocument.write(chunks[chunkIndex]); 331 iframe.contentDocument.write(chunks[chunkIndex]);
314 // Note that we won't cause a style resolve until we've encounte red the <body> element. 332 PerfTestRunner.forceLayout(iframe.contentDocument);
315 // Thus the number of chunks counted above is not exactly equal to the number of style resolves.
316 if (iframe.contentDocument.body)
317 iframe.contentDocument.body.clientHeight; // Force a full la yout/style-resolve.
318 else if (iframe.documentElement.localName == 'html')
319 iframe.contentDocument.documentElement.offsetWidth; // Force the painting.
320 } 333 }
321 334
322 iframe.contentDocument.close(); 335 iframe.contentDocument.close();
323 document.body.removeChild(iframe); 336 document.body.removeChild(iframe);
324 }; 337 };
325 338
326 PerfTestRunner.measureTime(test); 339 PerfTestRunner.measureTime(test);
327 } 340 }
328 341
329 window.PerfTestRunner = PerfTestRunner; 342 window.PerfTestRunner = PerfTestRunner;
330 })(); 343 })();
OLDNEW
« no previous file with comments | « PerformanceTests/ShadowDOM/shadow-style-share-with-distribution.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698