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 Following actions must not emit resize event. |
| 18 - page load |
| 19 - dynamic content generation |
| 20 - page scaling |
| 21 - changing fixed layout size |
18 | 22 |
19 Do not resize the page. It invalidates the test. | 23 Do not resize the page. It invalidates the test. |
20 <p style="text-indent: 10px" id=result1> | 24 <p style="text-indent: 10px" id=result1> |
21 Resize events (should be 0): <span id=count1>0</span> | 25 Resize events (should be 0): <span id=count1>0</span> |
22 </div> | 26 </div> |
23 <div id=expandingblock> | 27 <div id=expandingblock> |
24 </div> | 28 </div> |
25 <script> | 29 <script> |
26 if (window.testRunner) { | 30 if (window.testRunner) { |
27 testRunner.dumpAsText(); | 31 testRunner.dumpAsText(); |
28 testRunner.waitUntilDone(); | 32 testRunner.waitUntilDone(); |
29 } | 33 } |
30 | 34 |
31 var blockcount = 0; | 35 var blockcount = 0; |
32 function addBlock() { | 36 function addBlock() { |
33 var el = document.createElement('div'); | 37 var el = document.createElement('div'); |
34 el.setAttribute('class','block'); | 38 el.setAttribute('class','block'); |
35 document.getElementById('expandingblock').appendChild(el); | 39 document.getElementById('expandingblock').appendChild(el); |
36 if (++blockcount < 10) | 40 if (++blockcount < 10) |
37 setTimeout(addBlock, 20); | 41 setTimeout(addBlock, 20); |
38 else | 42 else |
39 finish(); | 43 scalePage(); |
| 44 } |
| 45 function scalePage() { |
| 46 if (window.internals) |
| 47 window.internals.setPageScaleFactor(3, 0, 0); |
| 48 setTimeout(changeFixedLayoutSize, 20); |
| 49 } |
| 50 function changeFixedLayoutSize() { |
| 51 if (window.testRunner) |
| 52 testRunner.setFixedLayoutSize(1600, 1600); |
| 53 setTimeout(finish, 20); |
40 } | 54 } |
41 function finish() { | 55 function finish() { |
42 var result; | 56 var result; |
43 // No resize events are acceptable. | 57 // No resize events are acceptable. |
44 if (resizecount < 1) | 58 if (resizecount < 1) |
45 result = '<p style="color: green">PASS'; | 59 result = '<p style="color: green">PASS'; |
46 else | 60 else |
47 result = '<p style="color: red">FAIL'; | 61 result = '<p style="color: red">FAIL'; |
48 var resultElement = document.getElementById('result1') | 62 var resultElement = document.getElementById('result1') |
49 resultElement.innerHTML += result; | 63 resultElement.innerHTML += result; |
50 if (window.testRunner) | 64 if (window.testRunner) |
51 testRunner.notifyDone(); | 65 testRunner.notifyDone(); |
52 } | 66 } |
53 onload = addBlock; | 67 onload = addBlock; |
54 </script> | 68 </script> |
55 </body> | 69 </body> |
OLD | NEW |