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

Side by Side Diff: LayoutTests/fast/events/scroll-event-handler-count.html

Issue 561813003: Prepare blink to unify definitions of load completion (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add document.close() to scroll-left-while-loading.html Created 6 years, 2 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 | Annotate | Revision Log
OLDNEW
1 <div id="scrolltarget"> 1 <div id="scrolltarget">
2 <script src="../../resources/js-test.js"></script> 2 <script src="../../resources/js-test.js"></script>
3 <script> 3 <script>
4 description('This test checks that we correctly update the scroll event handler count as event handlers are added and removed'); 4 description('This test checks that we correctly update the scroll event handler count as event handlers are added and removed');
5 (function() { 5 (function() {
6 // Test addEventListener/removeEventListener on the document. 6 // Test addEventListener/removeEventListener on the document.
7 var listener = function() { } 7 var listener = function() { }
8 8
9 shouldBe('window.internals.scrollEventHandlerCount(document)', '0'); 9 shouldBe('window.internals.scrollEventHandlerCount(document)', '0');
10 document.addEventListener('scroll', listener, true); 10 document.addEventListener('scroll', listener, true);
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 var div = document.createElement('div'); 116 var div = document.createElement('div');
117 div.addEventListener('scroll', function() { }); 117 div.addEventListener('scroll', function() { });
118 document.body.appendChild(div); 118 document.body.appendChild(div);
119 119
120 var iframe = document.createElement('iframe'); 120 var iframe = document.createElement('iframe');
121 div.appendChild(iframe); 121 div.appendChild(iframe);
122 var nestedDocument = iframe.contentWindow.document; 122 var nestedDocument = iframe.contentWindow.document;
123 nestedDocument.open('text/html', 'replace'); 123 nestedDocument.open('text/html', 'replace');
124 nestedDocument.write('<!DOCTYPE html>\n<script>\ndocument.onscroll=function( ){};\n' + 124 nestedDocument.write('<!DOCTYPE html>\n<script>\ndocument.onscroll=function( ){};\n' +
125 'window.onscroll=function(){};</' + 'script>\n'); 125 'window.onscroll=function(){};</' + 'script>\n');
126 nestedDocument.close();
126 127
127 shouldBe('window.internals.scrollEventHandlerCount(document)', '3'); 128 shouldBe('window.internals.scrollEventHandlerCount(document)', '3');
128 129
129 var unattachedDoc = document.implementation.createHTMLDocument(''); 130 var unattachedDoc = document.implementation.createHTMLDocument('');
130 unattachedDoc.body.appendChild(div); 131 unattachedDoc.body.appendChild(div);
131 shouldBe('window.internals.scrollEventHandlerCount(document)', '0'); 132 shouldBe('window.internals.scrollEventHandlerCount(document)', '0');
132 })(); 133 })();
133 134
134 debug('Test moving a scroll event listener between documents belonging to the sa me page'); 135 debug('Test moving a scroll event listener between documents belonging to the sa me page');
135 (function() { 136 (function() {
136 var iframe = document.createElement('iframe'); 137 var iframe = document.createElement('iframe');
137 document.body.appendChild(iframe); 138 document.body.appendChild(iframe);
138 var nestedDocument = iframe.contentWindow.document; 139 var nestedDocument = iframe.contentWindow.document;
139 nestedDocument.open('text/html', 'replace'); 140 nestedDocument.open('text/html', 'replace');
140 nestedDocument.write('<!DOCTYPE html><div id=foo></div>'); 141 nestedDocument.write('<!DOCTYPE html><div id=foo></div>');
142 nestedDocument.close();
141 143
142 var element = frames[0].document.getElementById('foo'); 144 var element = frames[0].document.getElementById('foo');
143 var listener = function() { } 145 var listener = function() { }
144 element.addEventListener('scroll', listener, false); 146 element.addEventListener('scroll', listener, false);
145 frames[0].window.addEventListener('scroll', listener, false); 147 frames[0].window.addEventListener('scroll', listener, false);
146 shouldBe('window.internals.scrollEventHandlerCount(document)', '2'); 148 shouldBe('window.internals.scrollEventHandlerCount(document)', '2');
147 149
148 document.body.appendChild(element); 150 document.body.appendChild(element);
149 shouldBe('window.internals.scrollEventHandlerCount(document)', '2'); 151 shouldBe('window.internals.scrollEventHandlerCount(document)', '2');
150 152
(...skipping 27 matching lines...) Expand all
178 shouldBe('window.internals.scrollEventHandlerCount(document)', '0'); 180 shouldBe('window.internals.scrollEventHandlerCount(document)', '0');
179 window.onscroll = function() { } 181 window.onscroll = function() { }
180 shouldBe('window.internals.scrollEventHandlerCount(document)', '1'); 182 shouldBe('window.internals.scrollEventHandlerCount(document)', '1');
181 window.onscroll = function() { } 183 window.onscroll = function() { }
182 shouldBe('window.internals.scrollEventHandlerCount(document)', '1'); 184 shouldBe('window.internals.scrollEventHandlerCount(document)', '1');
183 window.onscroll = null; 185 window.onscroll = null;
184 shouldBe('window.internals.scrollEventHandlerCount(document)', '0'); 186 shouldBe('window.internals.scrollEventHandlerCount(document)', '0');
185 })(); 187 })();
186 </script> 188 </script>
187 </body> 189 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698