Bug 1445478: Make pointerevents/test_bug1414336.html more reliable. r=kats

There can be something shuffling the iframe between the mouse event is sent and
the mouse event is received which makes us end up targeting the <body> instead
of the test target.

This can be reproduced with enough persistence either with and without the
patches from bug 1439875, at least on a headless build with rr chaos mode.

Move it to test_group_pointerevents in the apz tests to run it in a new window
and make it a bit more reliable.

MozReview-Commit-ID: BS6Es8iEmMY
This commit is contained in:
Emilio Cobos Álvarez 2018-03-13 22:38:55 +01:00
Родитель 58a1b5e3d2
Коммит 222d41c92f
4 изменённых файлов: 32 добавлений и 39 удалений

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

@ -15,10 +15,6 @@ 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

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

@ -59,42 +59,33 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1414336
</div>
<script type="text/javascript">
/** Test for Bug 1414336 **/
if (isApzEnabled()) {
SimpleTest.waitForExplicitFinish();
waitUntilApzStable().then(() => {
let target0 = window.document.getElementById("target0");
let target0_events = ["pointerdown", "pointermove"];
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);
});
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");
subtestDone();
}, { 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");
subtestDone();
}, { once: true });
synthesizeNativeTouchDrag(target0, 2, 2, 0, 80);
});
</script>
</body>

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

@ -12,6 +12,7 @@
helper_bug1285070.html
helper_bug1299195.html
helper_bug1346632.html
helper_bug1414336.html
helper_click.html
helper_div_pan.html
helper_drag_click.html

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

@ -11,9 +11,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1285070
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
<script type="application/javascript">
let isWindows = navigator.platform.indexOf("Win") == 0;
var subtests = [
{'file': 'helper_bug1285070.html', 'prefs': [["dom.w3c_pointer_events.enabled", true]]},
{'file': 'helper_bug1299195.html', 'prefs': [["dom.w3c_pointer_events.enabled", true]]}
{'file': 'helper_bug1299195.html', 'prefs': [["dom.w3c_pointer_events.enabled", true]]},
{'file': 'helper_bug1414336.html', 'prefs': [
["dom.w3c_pointer_events.enabled", true],
["apz.test.fails_with_native_injection", isWindows]
]}
];
if (isApzEnabled()) {