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

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

Issue 679863002: Revert "Prepare blink to unify definitions of load completion" (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 1 month 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 <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();
127 126
128 shouldBe('window.internals.scrollEventHandlerCount(document)', '3'); 127 shouldBe('window.internals.scrollEventHandlerCount(document)', '3');
129 128
130 var unattachedDoc = document.implementation.createHTMLDocument(''); 129 var unattachedDoc = document.implementation.createHTMLDocument('');
131 unattachedDoc.body.appendChild(div); 130 unattachedDoc.body.appendChild(div);
132 shouldBe('window.internals.scrollEventHandlerCount(document)', '0'); 131 shouldBe('window.internals.scrollEventHandlerCount(document)', '0');
133 })(); 132 })();
134 133
135 debug('Test moving a scroll event listener between documents belonging to the sa me page'); 134 debug('Test moving a scroll event listener between documents belonging to the sa me page');
136 (function() { 135 (function() {
137 var iframe = document.createElement('iframe'); 136 var iframe = document.createElement('iframe');
138 document.body.appendChild(iframe); 137 document.body.appendChild(iframe);
139 var nestedDocument = iframe.contentWindow.document; 138 var nestedDocument = iframe.contentWindow.document;
140 nestedDocument.open('text/html', 'replace'); 139 nestedDocument.open('text/html', 'replace');
141 nestedDocument.write('<!DOCTYPE html><div id=foo></div>'); 140 nestedDocument.write('<!DOCTYPE html><div id=foo></div>');
142 nestedDocument.close();
143 141
144 var element = frames[0].document.getElementById('foo'); 142 var element = frames[0].document.getElementById('foo');
145 var listener = function() { } 143 var listener = function() { }
146 element.addEventListener('scroll', listener, false); 144 element.addEventListener('scroll', listener, false);
147 frames[0].window.addEventListener('scroll', listener, false); 145 frames[0].window.addEventListener('scroll', listener, false);
148 shouldBe('window.internals.scrollEventHandlerCount(document)', '2'); 146 shouldBe('window.internals.scrollEventHandlerCount(document)', '2');
149 147
150 document.body.appendChild(element); 148 document.body.appendChild(element);
151 shouldBe('window.internals.scrollEventHandlerCount(document)', '2'); 149 shouldBe('window.internals.scrollEventHandlerCount(document)', '2');
152 150
(...skipping 27 matching lines...) Expand all
180 shouldBe('window.internals.scrollEventHandlerCount(document)', '0'); 178 shouldBe('window.internals.scrollEventHandlerCount(document)', '0');
181 window.onscroll = function() { } 179 window.onscroll = function() { }
182 shouldBe('window.internals.scrollEventHandlerCount(document)', '1'); 180 shouldBe('window.internals.scrollEventHandlerCount(document)', '1');
183 window.onscroll = function() { } 181 window.onscroll = function() { }
184 shouldBe('window.internals.scrollEventHandlerCount(document)', '1'); 182 shouldBe('window.internals.scrollEventHandlerCount(document)', '1');
185 window.onscroll = null; 183 window.onscroll = null;
186 shouldBe('window.internals.scrollEventHandlerCount(document)', '0'); 184 shouldBe('window.internals.scrollEventHandlerCount(document)', '0');
187 })(); 185 })();
188 </script> 186 </script>
189 </body> 187 </body>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698