Bug 1414336 - Add a test case to make sure pointercancel isn't fired when content prevents default on touchstart. r=kats.

MozReview-Commit-ID: 93FSsD3bXvA
This commit is contained in:
Stone Shih 2018-01-13 07:33:21 +08:00
Родитель 0d518e6fbf
Коммит 76cbc214bf
2 изменённых файлов: 103 добавлений и 0 удалений

Просмотреть файл

@ -15,6 +15,10 @@ support-files =
[test_bug1315862.html]
[test_bug1323158.html]
[test_bug1403055.html]
[test_bug1414336.html]
support-files =
../../../../gfx/layers/apz/test/mochitest/apz_test_native_event_utils.js
../../../../gfx/layers/apz/test/mochitest/apz_test_utils.js
[test_bug1420589_1.html]
support-files =
bug_1420589_iframe1.html

Просмотреть файл

@ -0,0 +1,99 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1414336
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1414336</title>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
<script type="text/javascript" src="apz_test_native_event_utils.js"></script>
<script type="text/javascript" src="apz_test_utils.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/paint_listener.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<style>
#target0 {
width: 200px;
height: 400px;
touch-action: auto;
}
</style>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1414336">Mozilla Bug 1414336</a>
<p id="display"></p>
<div id="target0">
<p>Test bug1414336</p>
<p>Test bug1414336</p>
<p>Test bug1414336</p>
<p>Test bug1414336</p>
<p>Test bug1414336</p>
<p>Test bug1414336</p>
<p>Test bug1414336</p>
<p>Test bug1414336</p>
<p>Test bug1414336</p>
<p>Test bug1414336</p>
<p>Test bug1414336</p>
<p>Test bug1414336</p>
<p>Test bug1414336</p>
<p>Test bug1414336</p>
<p>Test bug1414336</p>
<p>Test bug1414336</p>
<p>Test bug1414336</p>
<p>Test bug1414336</p>
<p>Test bug1414336</p>
<p>Test bug1414336</p>
<p>Test bug1414336</p>
<p>Test bug1414336</p>
<p>Test bug1414336</p>
<p>Test bug1414336</p>
<p>Test bug1414336</p>
<p>Test bug1414336</p>
<p>Test bug1414336</p>
<p>Test bug1414336</p>
<p>Test bug1414336</p>
<p>Test bug1414336</p>
<p>Test bug1414336</p>
<p>Test bug1414336</p>
</div>
<script type="text/javascript">
/** Test for Bug 1414336 **/
SimpleTest.waitForExplicitFinish();
waitUntilApzStable().then(() => {
let isWindows = (getPlatform() == "windows");
SpecialPowers.pushPrefEnv({"set": [["dom.w3c_pointer_events.enabled", true],
["apz.test.fails_with_native_injection", isWindows]]}, () => {
let target0 = window.document.getElementById("target0");
let target0_events = ["pointerdown", "pointermove"];
target0_events.forEach((elem, index, arr) => {
target0.addEventListener(elem, (event) => {
is(event.type, target0_events[0], "receive " + event.type + " on target0");
target0_events.shift();
}, { once: true });
});
target0.addEventListener("pointercancel", (event) => {
ok(false, "Shouldn't receive pointercancel when content prevents default on touchstart");
SimpleTest.finish();
}, { once: true });
target0.addEventListener("touchstart", (event) => {
event.preventDefault();
}, { once: true });
target0.addEventListener("pointerup", (event) => {
ok(target0_events.length == 0, " should receive " + target0_events + " on target0");
SimpleTest.finish();
}, { once: true });
synthesizeNativeTouchDrag(target0, 2, 2, 0, 80);
});
});
</script>
</body>
</html>