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

Unified Diff: LayoutTests/fast/events/event-handler-count.html

Issue 206603002: Add EventHandlerRegistry (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add test for external handlers. Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/fast/events/event-handler-count.html
diff --git a/LayoutTests/fast/events/touch/touch-handler-count.html b/LayoutTests/fast/events/event-handler-count.html
similarity index 80%
rename from LayoutTests/fast/events/touch/touch-handler-count.html
rename to LayoutTests/fast/events/event-handler-count.html
index f63feed6a7814f23867b140ef6df96cb6810a9f6..7917d827567d90f2adb215cb563cbb018530a64e 100644
--- a/LayoutTests/fast/events/touch/touch-handler-count.html
+++ b/LayoutTests/fast/events/event-handler-count.html
@@ -1,7 +1,7 @@
-<script src="../../../resources/js-test.js"></script>
+<script src="../../resources/js-test.js"></script>
<div id='touchtarget' style='width: 50; height: 50'></div>
<script>
-description("This test checks that we correctly update the touch event handler count as event handlers are added and removed");
+description("This test checks that we correctly update the event handler counts as event handlers are added and removed");
debug("Test addEventListener/removeEventListener on the document.");
(function() {
@@ -29,50 +29,35 @@ debug("Test addEventListener/removeEventListener on the document.");
shouldBe('window.internals.touchEventHandlerCount(document)', '0');
})();
-debug("Test setting touch handlers on the document.");
+debug("Test setting scroll handlers on the document.");
(function() {
- shouldBe('window.internals.touchEventHandlerCount(document)', '0');
- document.ontouchstart = function() { }
- document.ontouchmove = function() {}
- document.ontouchend = function() {}
- document.ontouchcancel = function() {}
- shouldBe('window.internals.touchEventHandlerCount(document)', '4');
- document.ontouchstart = function() { }
- shouldBe('window.internals.touchEventHandlerCount(document)', '4');
- document.ontouchstart = null;
- shouldBe('window.internals.touchEventHandlerCount(document)', '3');
- document.ontouchstart = null;
- shouldBe('window.internals.touchEventHandlerCount(document)', '3');
- document.ontouchmove = null;
- document.ontouchend = null;
- document.ontouchcancel = null;
- shouldBe('window.internals.touchEventHandlerCount(document)', '0');
+ shouldBe('window.internals.scrollEventHandlerCount(document)', '0');
+ document.onscroll = function() { }
+ shouldBe('window.internals.scrollEventHandlerCount(document)', '1');
+ document.onscroll = function() { }
+ shouldBe('window.internals.scrollEventHandlerCount(document)', '1');
+ document.onscroll = null;
+ shouldBe('window.internals.scrollEventHandlerCount(document)', '0');
})();
debug("Test addEventListener/removeEventListener on the window.");
(function() {
var listener = function() { }
- shouldBe('window.internals.touchEventHandlerCount(document)', '0');
- window.addEventListener('touchstart', listener, true);
- shouldBe('window.internals.touchEventHandlerCount(document)', '1');
- window.addEventListener('touchmove', listener, true);
- shouldBe('window.internals.touchEventHandlerCount(document)', '2');
- window.addEventListener('touchstart', listener, false);
- shouldBe('window.internals.touchEventHandlerCount(document)', '3');
- window.removeEventListener('touchmove', listener, true);
- shouldBe('window.internals.touchEventHandlerCount(document)', '2');
- window.removeEventListener('touchstart', listener, true);
- shouldBe('window.internals.touchEventHandlerCount(document)', '1');
+ shouldBe('window.internals.wheelEventHandlerCount(document)', '0');
+ window.addEventListener('mousewheel', listener, true);
+ shouldBe('window.internals.wheelEventHandlerCount(document)', '1');
+ window.addEventListener('mousewheel', listener, false);
+ shouldBe('window.internals.wheelEventHandlerCount(document)', '2');
+ window.removeEventListener('mousewheel', listener, true);
+ shouldBe('window.internals.wheelEventHandlerCount(document)', '1');
// Try removing the capturing listener again.
- window.removeEventListener('touchstart', listener, true);
- shouldBe('window.internals.touchEventHandlerCount(document)', '1');
- window.removeEventListener('touchmove', listener, true);
- shouldBe('window.internals.touchEventHandlerCount(document)', '1');
+ window.removeEventListener('mousewheel', listener, true);
+ shouldBe('window.internals.wheelEventHandlerCount(document)', '1');
- window.removeEventListener('touchstart', listener, false);
- shouldBe('window.internals.touchEventHandlerCount(document)', '0');
+ window.removeEventListener('mousewheel', listener, false);
+ shouldBe('window.internals.wheelEventHandlerCount(document)', '0');
})();
debug("Test setting touch handlers on the window.");
@@ -95,6 +80,28 @@ debug("Test setting touch handlers on the window.");
shouldBe('window.internals.touchEventHandlerCount(document)', '0');
})();
+debug("Test setting onmousewheel on the window.");
+(function() {
+ shouldBe('window.internals.wheelEventHandlerCount(document)', '0');
+ window.onmousewheel = function() { }
+ shouldBe('window.internals.wheelEventHandlerCount(document)', '1');
+ window.onmousewheel = function() { }
+ shouldBe('window.internals.wheelEventHandlerCount(document)', '1');
+ window.onmousewheel = null;
+ shouldBe('window.internals.wheelEventHandlerCount(document)', '0');
+})();
+
+debug("Test setting onscroll on the window.");
+(function() {
+ shouldBe('window.internals.scrollEventHandlerCount(document)', '0');
+ window.onscroll = function() { }
+ shouldBe('window.internals.scrollEventHandlerCount(document)', '1');
+ window.onscroll = function() { }
+ shouldBe('window.internals.scrollEventHandlerCount(document)', '1');
+ window.onscroll = null;
+ shouldBe('window.internals.scrollEventHandlerCount(document)', '0');
+})();
+
debug("Test addEventListener/removeEventListener on a div.");
(function() {
var listener = function() { }
@@ -144,7 +151,7 @@ debug("Test setting touch handlers on a div.");
shouldBe('window.internals.touchEventHandlerCount(document)', '0');
})();
-debug("Test redudant addEventListener on a div.");
+debug("Test redundant addEventListener on a div.");
Rick Byers 2014/04/03 15:33:19 heh, thanks for fixing my typo :-)
(function() {
var listener = function() { }
var div = document.getElementById('touchtarget');
@@ -246,15 +253,16 @@ debug("Test that nested Documents' touch handlers are properly tracked in their
nestedDocument.write('<script>document.addEventListener("touchmove", function(){});</' + 'script>\n');
shouldBe('window.internals.touchEventHandlerCount(nestedDocument)', '3');
shouldBe('window.internals.touchEventHandlerCount(document)', '2');
-
+
nestedDocument.write('<script>document.getElementById("twoHandlers").remove();</' + 'script>\n');
gc();
shouldBe('window.internals.touchEventHandlerCount(nestedDocument)', '1');
shouldBe('window.internals.touchEventHandlerCount(document)', '2');
- nestedDocument.close();
+ nestedDocument.close();
touchtarget.removeChild(iframe);
shouldBe('window.internals.touchEventHandlerCount(document)', '1');
})();
+
</script>
</body>

Powered by Google App Engine
This is Rietveld 408576698