| 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 events: page load, dynamic conten
t generation, page scaling and changing fixed layout size |
| 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 function test() { | 30 function test() { |
| 31 setTimeout(addBlock, 20); | 31 setTimeout(addBlock, 20); |
| 32 } | 32 } |
| 33 function addBlock() { | 33 function addBlock() { |
| 34 for (var i = 0; i < 10; i++) { | 34 for (var i = 0; i < 10; i++) { |
| 35 var el = document.createElement('div'); | 35 var el = document.createElement('div'); |
| 36 el.setAttribute('class','block'); | 36 el.setAttribute('class','block'); |
| 37 document.getElementById('expandingblock').appendChild(el); | 37 document.getElementById('expandingblock').appendChild(el); |
| 38 } | 38 } |
| 39 setTimeout(scalePage, 20); |
| 40 } |
| 41 function scalePage() { |
| 42 if (window.internals) |
| 43 window.internals.setPageScaleFactor(3, 0, 0); |
| 44 setTimeout(changeFixedLayoutSize, 20); |
| 45 } |
| 46 function changeFixedLayoutSize() { |
| 47 if (window.testRunner) |
| 48 testRunner.setFixedLayoutSize(1600, 1600); |
| 39 setTimeout(finish, 20); | 49 setTimeout(finish, 20); |
| 40 } | 50 } |
| 41 function finish() { | 51 function finish() { |
| 42 var result; | 52 var result; |
| 43 // No resize events are acceptable. | 53 // No resize events are acceptable. |
| 44 if (resizecount < 1) | 54 if (resizecount < 1) |
| 45 result = '<p style="color: green">PASS'; | 55 result = '<p style="color: green">PASS'; |
| 46 else | 56 else |
| 47 result = '<p style="color: red">FAIL'; | 57 result = '<p style="color: red">FAIL'; |
| 48 var resultElement = document.getElementById('result1') | 58 var resultElement = document.getElementById('result1') |
| 49 resultElement.innerHTML += result; | 59 resultElement.innerHTML += result; |
| 50 if (window.testRunner) | 60 if (window.testRunner) |
| 51 testRunner.notifyDone(); | 61 testRunner.notifyDone(); |
| 52 } | 62 } |
| 53 onload = test; | 63 onload = test; |
| 54 </script> | 64 </script> |
| 55 </body> | 65 </body> |
| OLD | NEW |