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

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

Issue 14766010: Clarify the size of a document view (a.k.a layout size) that causes FrameView to emit the resize ev… (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Apply aellas's review Created 7 years, 6 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
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 window resize.
18
19 Do not resize the page. It invalidates the test.
20 <p style="text-indent: 10px" id=result1> 18 <p style="text-indent: 10px" id=result1>
21 Resize events (should be 0): <span id=count1>0</span> 19 Resize events (should be 1): <span id=count1>0</span>
22 </div> 20 </div>
23 <div id=expandingblock> 21 <div id=expandingblock>
24 </div> 22 </div>
25 <script> 23 <script>
26 if (window.testRunner) { 24 if (window.testRunner) {
27 testRunner.dumpAsText(); 25 testRunner.dumpAsText();
28 testRunner.waitUntilDone(); 26 testRunner.waitUntilDone();
29 } 27 }
30 function test() { 28 function resizeWindow() {
31 setTimeout(addBlock, 20); 29 window.resizeBy(10, 10);
32 }
33 function addBlock() {
34 for (var i = 0; i < 10; i++) {
35 var el = document.createElement('div');
36 el.setAttribute('class','block');
37 document.getElementById('expandingblock').appendChild(el);
38 }
39 setTimeout(finish, 20); 30 setTimeout(finish, 20);
40 } 31 }
41 function finish() { 32 function finish() {
42 var result; 33 var result;
43 // No resize events are acceptable. 34 // No resize events are acceptable.
leviw_travelin_and_unemployed 2013/06/26 16:14:19 This comment is no longer correct.
44 if (resizecount < 1) 35 if (resizecount == 1)
leviw_travelin_and_unemployed 2013/06/26 16:14:19 How about making these a script tests (js-test-pre
dshwang 2013/06/26 17:01:36 Thx for review. In my understanding, you want to
leviw_travelin_and_unemployed 2013/06/26 17:22:54 Not a new js file. There's already a js-test-pre.j
45 result = '<p style="color: green">PASS'; 36 result = '<p style="color: green">PASS';
46 else 37 else
47 result = '<p style="color: red">FAIL'; 38 result = '<p style="color: red">FAIL';
48 var resultElement = document.getElementById('result1') 39 var resultElement = document.getElementById('result1')
49 resultElement.innerHTML += result; 40 resultElement.innerHTML += result;
50 if (window.testRunner) 41 if (window.testRunner)
51 testRunner.notifyDone(); 42 testRunner.notifyDone();
52 } 43 }
53 onload = test; 44 onload = resizeWindow;
54 </script> 45 </script>
55 </body> 46 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698