Bug 1426527 - Revise test_remove_frame_when_got_pointer_capture.html to correctly run the test in release build. f=RyanVM. r=smaug.

This commit is contained in:
Stone Shih 2017-12-23 08:31:35 +08:00
Родитель efc13822e0
Коммит fc0584db41
1 изменённых файлов: 22 добавлений и 12 удалений

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

@ -8,14 +8,24 @@
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<div id="div1" style="width: 50px; height: 50px; background: green"></div>
<div id="div2" style="width: 50px; height: 50px; background: green"></div>
<p id="content">
</p>
<script>
SimpleTest.waitForExplicitFinish();
function startTest() {
let div1 = document.getElementById("div1");
let content = document.getElementById('content');
let iframe = document.createElement('iframe');
iframe.width = 200;
iframe.height = 200;
content.appendChild(iframe);
iframe.contentDocument.body.innerHTML =
"<div id='div1' style='width: 50px; height: 50px; background: green'></div>" +
"<div id='div2' style='width: 50px; height: 50px; background: red'></div>";
let div1 = iframe.contentDocument.getElementById("div1");
let div2 = iframe.contentDocument.getElementById("div2");
let divEvents = [
"pointerdown",
"gotpointercapture",
@ -44,7 +54,7 @@ function startTest() {
});
documentEvents.forEach((event) => {
document.addEventListener(event, (e) => {
iframe.contentDocument.addEventListener(event, (e) => {
is(e.target, div1, e.type + " should be dispatched to div1");
}, { once: true });
});
@ -57,9 +67,9 @@ function startTest() {
div1.style.display = "none";
});
synthesizeMouseAtCenter(div1, {type: "mousedown"});
synthesizeMouseAtCenter(div2, {type: "mousemove"});
synthesizeMouseAtCenter(div2, {type: "mouseup"});
synthesizeMouseAtCenter(div1, {type: "mousedown"}, iframe.contentWindow);
synthesizeMouseAtCenter(div2, {type: "mousemove"}, iframe.contentWindow);
synthesizeMouseAtCenter(div2, {type: "mouseup"}, iframe.contentWindow);
ok(divEvents.length == 0, " expect " + divEvents);
@ -90,16 +100,16 @@ function startTest() {
});
documentEvents.forEach((event) => {
document.addEventListener(event, (e) => {
iframe.contentDocument.addEventListener(event, (e) => {
is(e.target, div1, e.type + " should be dispatched to div1");
}, { once: true });
});
div1.style.display = "block";
synthesizeMouseAtCenter(div1, {type: "mousemove"});
synthesizeTouch(div1, 5, 5, { type: "touchstart" });
synthesizeTouch(div2, 5, 5, { type: "touchmove" });
synthesizeTouch(div2, 5, 5, { type: "touchend" });
synthesizeMouseAtCenter(div1, {type: "mousemove"}, iframe.contentWindow);
synthesizeTouch(div1, 5, 5, { type: "touchstart" }, iframe.contentWindow);
synthesizeTouch(div2, 5, 5, { type: "touchmove" }, iframe.contentWindow);
synthesizeTouch(div2, 5, 5, { type: "touchend" }, iframe.contentWindow);
ok(divEvents.length == 0, " expect " + divEvents);
SimpleTest.finish();