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

Unified Diff: LayoutTests/fast/events/touch/emulate-touch-events.html

Issue 145003002: [DevTools] Switch from blink-based to content-based touch emulation. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: another rebase Created 6 years, 8 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
« no previous file with comments | « no previous file | LayoutTests/fast/events/touch/emulate-touch-events-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: LayoutTests/fast/events/touch/emulate-touch-events.html
diff --git a/LayoutTests/fast/events/touch/emulate-touch-events.html b/LayoutTests/fast/events/touch/emulate-touch-events.html
deleted file mode 100644
index 1a063f712458a4d8a91ebe72e3f303e05af95529..0000000000000000000000000000000000000000
--- a/LayoutTests/fast/events/touch/emulate-touch-events.html
+++ /dev/null
@@ -1,112 +0,0 @@
-<!DOCTYPE html>
-<html>
-<body>
-<script src="../../../resources/js-test.js"></script>
-<div id="touchtarget" style="width: 100px; height: 100px; background-color: blue"></div>
-<p id="description"></p>
-<div id="console"></div>
-<script>
-var div = document.getElementById("touchtarget");
-var lastEvent = null;
-var touchEventsReceived = 0;
-var EXPECTED_TOUCH_EVENTS_TOTAL = 3;
-
-function touchEventCallback(event) {
- if (window.eventSender) {
- lastEvent = event;
- verifyTouch(touchEventsReceived++);
- } else
- debug(event.type);
-
- // TODO: Touch emulation shouldn't generate mouse events regardless of whether
- // preventDefault is called. http://crbug.com/278300.
- event.preventDefault();
-
- if (window.testRunner && touchEventsReceived == EXPECTED_TOUCH_EVENTS_TOTAL) {
- window.internals.settings.setTouchEventEmulationEnabled(false);
- finishJSTest();
- }
-}
-
-function mouseMoveCallback(e) {
- debug("FAIL: Unexpected mousemove event: " + e.clientX + ", " + e.clientY);
-}
-
-div.addEventListener("touchstart", touchEventCallback, false);
-div.addEventListener("touchmove", touchEventCallback, false);
-div.addEventListener("touchend", touchEventCallback, false);
-div.addEventListener("mousemove", mouseMoveCallback, false);
-
-function verifyTouchEvent(type, totalTouchCount, changedTouchCount, targetTouchCount)
-{
- shouldBeEqualToString("lastEvent.type", type);
- shouldBe("lastEvent.touches.length", totalTouchCount.toString());
- shouldBe("lastEvent.changedTouches.length", changedTouchCount.toString());
- shouldBe("lastEvent.targetTouches.length", targetTouchCount.toString());
- shouldBe("lastEvent.pageX", "0");
- shouldBe("lastEvent.pageY", "0");
-}
-
-function verifyTouchPoint(list, point, x, y, id)
-{
- shouldBe("lastEvent." + list + "[" + point + "].pageX", x.toString());
- shouldBe("lastEvent." + list + "[" + point + "].pageY", y.toString());
- shouldBe("lastEvent." + list + "[" + point + "].clientX", x.toString());
- shouldBe("lastEvent." + list + "[" + point + "].clientY", y.toString());
- shouldBe("lastEvent." + list + "[" + point + "].identifier", id.toString());
-}
-
-function verifyTouch(which) {
- switch (which) {
- case 0:
- verifyTouchEvent("touchstart", 1, 1, 1);
- shouldBe("lastEvent.shiftKey", "true");
- shouldBe("lastEvent.altKey", "true");
- shouldBe("lastEvent.ctrlKey", "false");
- shouldBe("lastEvent.metaKey", "false");
- shouldBeEqualToString("lastEvent.touches[0].target.id", "touchtarget");
- verifyTouchPoint("touches", 0, 10, 10, 0);
- verifyTouchPoint("changedTouches", 0, 10, 10, 0);
- verifyTouchPoint("targetTouches", 0, 10, 10, 0);
- break;
- case 1:
- verifyTouchEvent("touchmove", 1, 1, 1);
- verifyTouchPoint("touches", 0, 20, 30, 0);
- break;
- case 2:
- verifyTouchEvent("touchend", 0, 1, 0);
- verifyTouchPoint("changedTouches", 0, 20, 30, 0);
- shouldBe("lastEvent.shiftKey", "false");
- shouldBe("lastEvent.altKey", "true");
- shouldBe("lastEvent.ctrlKey", "true");
- shouldBe("lastEvent.metaKey", "false");
- break;
- default:
- testFailed("Wrong number of touch events! (" + which + ")");
- }
-}
-
-function mouseEventSequence()
-{
- eventSender.mouseMoveTo(10, 10);
- eventSender.mouseDown(0, ["shiftKey", "altKey"]);
- eventSender.mouseMoveTo(20, 30);
- eventSender.mouseUp(0, ["altKey", "ctrlKey"]);
-}
-
-if (window.eventSender && window.internals && window.internals.settings) {
- description("This tests single touch event emulation using mouse events.");
-
- window.eventSender.dragMode = false;
- window.jsTestIsAsync = true;
- window.internals.settings.setTouchEventEmulationEnabled(true);
-
- shouldBe("'ontouchstart' in window", "true");
- shouldBe("'ontouchend' in document", "true");
-
- mouseEventSequence();
-} else
- debug("This test requires DumpRenderTree. Tap on the blue rect to log.");
-</script>
-</body>
-</html>
« no previous file with comments | « no previous file | LayoutTests/fast/events/touch/emulate-touch-events-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698