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

Side by Side Diff: LayoutTests/fast/events/resize-events.html

Issue 15023009: Make the resize-events test not flaky. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@flaky
Patch Set: patch to land: rebase to 1 sec ago upstream Created 7 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
« no previous file with comments | « LayoutTests/TestExpectations ('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 <html> 1 <html>
2 <head> 2 <head>
3 <style> 3 <style>
4 div.block { height: 400px; border: 1px solid black; margin:10px; } 4 div.block { height: 400px; border: 1px solid black; margin:10px; }
5 </style> 5 </style>
6 <script> 6 <script>
7 var resizecount = 0; 7 var resizecount = 0;
8 var loaded = false; 8 var loaded = false;
9 window.onresize = function() { 9 window.onresize = function() {
10 resizecount++; 10 resizecount++;
11 document.getElementById('count1').innerHTML = resizecount; 11 document.getElementById('count1').innerHTML = resizecount;
12 } 12 }
13 </script> 13 </script>
14 </head> 14 </head>
15 <body> 15 <body>
16 <div> 16 <div>
17 Test how many resize events are emitted during page load and dynamic con tent generation. 17 Test how many resize events are emitted during page load and dynamic con tent generation.
18 18
19 Do not resize the page. It invalidates the test. 19 Do not resize the page. It invalidates the test.
20 <p style="text-indent: 10px" id=result1> 20 <p style="text-indent: 10px" id=result1>
21 Resize events (should be 0): <span id=count1>0</span> 21 Resize events (should be 0): <span id=count1>0</span>
22 </div> 22 </div>
23 <div id=expandingblock> 23 <div id=expandingblock>
24 </div> 24 </div>
25 <script> 25 <script>
26 if (window.testRunner) { 26 if (window.testRunner) {
27 testRunner.dumpAsText(); 27 testRunner.dumpAsText();
28 testRunner.waitUntilDone(); 28 testRunner.waitUntilDone();
29 } 29 }
30 30 function test() {
31 var blockcount = 0; 31 setTimeout(addBlock, 20);
32 }
32 function addBlock() { 33 function addBlock() {
33 var el = document.createElement('div'); 34 for (var i = 0; i < 10; i++) {
34 el.setAttribute('class','block'); 35 var el = document.createElement('div');
35 document.getElementById('expandingblock').appendChild(el); 36 el.setAttribute('class','block');
36 if (++blockcount < 10) 37 document.getElementById('expandingblock').appendChild(el);
37 setTimeout(addBlock, 20); 38 }
38 else 39 setTimeout(finish, 20);
39 finish();
40 } 40 }
41 function finish() { 41 function finish() {
42 var result; 42 var result;
43 // No resize events are acceptable. 43 // No resize events are acceptable.
44 if (resizecount < 1) 44 if (resizecount < 1)
45 result = '<p style="color: green">PASS'; 45 result = '<p style="color: green">PASS';
46 else 46 else
47 result = '<p style="color: red">FAIL'; 47 result = '<p style="color: red">FAIL';
48 var resultElement = document.getElementById('result1') 48 var resultElement = document.getElementById('result1')
49 resultElement.innerHTML += result; 49 resultElement.innerHTML += result;
50 if (window.testRunner) 50 if (window.testRunner)
51 testRunner.notifyDone(); 51 testRunner.notifyDone();
52 } 52 }
53 onload = addBlock; 53 onload = test;
54 </script> 54 </script>
55 </body> 55 </body>
OLDNEW
« no previous file with comments | « LayoutTests/TestExpectations ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698