OLD | NEW |
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.waitUntilDone(); | 28 testRunner.waitUntilDone(); |
28 } | 29 } |
29 | 30 |
30 var blockcount = 0; | 31 var blockcount = 0; |
31 function addBlock() { | 32 function addBlock() { |
32 var el = document.createElement('div'); | 33 var el = document.createElement('div'); |
33 el.setAttribute('class','block'); | 34 el.setAttribute('class','block'); |
34 document.getElementById('expandingblock').appendChild(el); | 35 document.getElementById('expandingblock').appendChild(el); |
35 if (++blockcount < 10) | 36 if (++blockcount < 10) |
36 setTimeout(addBlock, 20); | 37 setTimeout(addBlock, 20); |
37 else | 38 else |
38 finish(); | 39 finish(); |
39 } | 40 } |
40 function finish() { | 41 function finish() { |
41 var result; | 42 var result; |
42 // No resize events are acceptable. | 43 // No resize events are acceptable. |
43 if (resizecount < 1) | 44 if (resizecount < 1) |
44 result = '<p style="color: green">PASS'; | 45 result = '<p style="color: green">PASS'; |
45 else | 46 else |
46 result = '<p style="color: red">FAIL'; | 47 result = '<p style="color: red">FAIL'; |
47 var resultElement = document.getElementById('result1') | 48 var resultElement = document.getElementById('result1') |
48 resultElement.innerHTML += result; | 49 resultElement.innerHTML += result; |
49 if (window.testRunner) | 50 if (window.testRunner) |
50 testRunner.notifyDone(); | 51 testRunner.notifyDone(); |
51 } | 52 } |
52 onload = addBlock; | 53 onload = addBlock; |
53 </script> | 54 </script> |
54 </body> | 55 </body> |
OLD | NEW |