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 |
18 | 21 |
| 22 When fixed layout is enabled, changing fixed layout size must emit resiz
e event. |
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 1): <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(); |
| 32 testRunner.enableFixedLayoutMode(true); |
| 33 testRunner.setFixedLayoutSize(700, 240); |
28 testRunner.waitUntilDone(); | 34 testRunner.waitUntilDone(); |
29 } | 35 } |
30 | 36 |
31 var blockcount = 0; | 37 var blockcount = 0; |
32 function addBlock() { | 38 function addBlock() { |
33 var el = document.createElement('div'); | 39 var el = document.createElement('div'); |
34 el.setAttribute('class','block'); | 40 el.setAttribute('class','block'); |
35 document.getElementById('expandingblock').appendChild(el); | 41 document.getElementById('expandingblock').appendChild(el); |
36 if (++blockcount < 10) | 42 if (++blockcount < 10) |
37 setTimeout(addBlock, 20); | 43 setTimeout(addBlock, 20); |
38 else | 44 else |
39 finish(); | 45 scalePage(); |
| 46 } |
| 47 function scalePage() { |
| 48 if (window.internals) |
| 49 window.internals.setPageScaleFactor(3, 0, 0); |
| 50 setTimeout(changeFixedLayoutSize, 20); |
| 51 } |
| 52 function changeFixedLayoutSize() { |
| 53 if (window.testRunner) |
| 54 testRunner.setFixedLayoutSize(1600, 1600); |
| 55 setTimeout(finish, 20); |
40 } | 56 } |
41 function finish() { | 57 function finish() { |
42 var result; | 58 var result; |
43 // No resize events are acceptable. | 59 // No resize events are acceptable. |
44 if (resizecount < 1) | 60 if (resizecount == 1) |
45 result = '<p style="color: green">PASS'; | 61 result = '<p style="color: green">PASS'; |
46 else | 62 else |
47 result = '<p style="color: red">FAIL'; | 63 result = '<p style="color: red">FAIL'; |
48 var resultElement = document.getElementById('result1') | 64 var resultElement = document.getElementById('result1') |
49 resultElement.innerHTML += result; | 65 resultElement.innerHTML += result; |
50 if (window.testRunner) | 66 if (window.testRunner) |
51 testRunner.notifyDone(); | 67 testRunner.notifyDone(); |
52 } | 68 } |
53 onload = addBlock; | 69 onload = addBlock; |
54 </script> | 70 </script> |
55 </body> | 71 </body> |
OLD | NEW |