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

Side by Side Diff: PerformanceTests/Layout/resources/character_fallback_test.js

Issue 675983004: Allow performance tests to test full rendering performance (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: layoutOrFullyRender -> forceLayoutOrFullFrame 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
OLDNEW
1 // Perf Tests run a maximum of 20 times, 1 // Perf Tests run a maximum of 20 times,
2 // make sure we have an equal amount of characters 2 // make sure we have an equal amount of characters
3 // for each run. 3 // for each run.
4 var selectionSize = fallbackChars.length / 21; 4 var selectionSize = fallbackChars.length / 21;
5 var target; 5 var target;
6 6
7 function test() { 7 function test() {
8 var charSelection = ""; 8 var charSelection = "";
9 for(var i=0; i < selectionSize; i++) { 9 for(var i=0; i < selectionSize; i++) {
10 var selectedCharIndex = Math.floor(Math.random() * fallbackChars.length) ; 10 var selectedCharIndex = Math.floor(Math.random() * fallbackChars.length) ;
11 if(!fallbackChars[selectedCharIndex]) 11 if(!fallbackChars[selectedCharIndex])
12 continue; 12 continue;
13 charSelection += fallbackChars[selectedCharIndex]; 13 charSelection += fallbackChars[selectedCharIndex];
14 fallbackChars.splice(selectedCharIndex, 1); 14 fallbackChars.splice(selectedCharIndex, 1);
15 } 15 }
16 if (charSelection.length) 16 if (charSelection.length)
17 replaceTextAndWaitForLayout(charSelection); 17 replaceTextAndWaitForLayout(charSelection);
18 } 18 }
19 19
20 function replaceTextAndWaitForLayout(charSelection) { 20 function replaceTextAndWaitForLayout(charSelection) {
21 while (target.firstChild) 21 while (target.firstChild)
22 target.removeChild(target.firstChild); 22 target.removeChild(target.firstChild);
23 target.appendChild(document.createTextNode(charSelection)); 23 target.appendChild(document.createTextNode(charSelection));
24 target.offsetHeight; 24 PerfTestRunner.forceLayoutOrFullFrame();
25 } 25 }
26 26
27 function cleanup() { 27 function cleanup() {
28 replaceTextAndWaitForLayout(""); 28 replaceTextAndWaitForLayout("");
29 } 29 }
30 30
31 function startTest() { 31 function startTest() {
32 target = document.querySelector("#target"); 32 target = document.querySelector("#target");
33 PerfTestRunner.measureTime({ run: test, done: cleanup, description: "Per-cha racter font fallback" }); 33 PerfTestRunner.measureTime({ run: test, done: cleanup, description: "Per-cha racter font fallback" });
34 } 34 }
OLDNEW
« no previous file with comments | « PerformanceTests/Layout/line-layout-line-height.html ('k') | PerformanceTests/Layout/resources/floats.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698