Bug 1426527 - Revise test_remove_frame_when_got_pointer_capture.html to correctly run the test in release build. f=RyanVM. r=smaug.
authorStone Shih <sshih@mozilla.com>
Sat, 23 Dec 2017 08:31:35 +0800
changeset 449428 44f6455da33e3c8bd32df9611de89d20c771b0d7
parent 449427 06d4983f64feb093c676943db31584b3febb4fc6
child 449429 4d1355701c926172d8f9825813e9f7e66421536a
push id8527
push userCallek@gmail.com
push dateThu, 11 Jan 2018 21:05:50 +0000
treeherdermozilla-beta@95342d212a7a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1426527
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1426527 - Revise test_remove_frame_when_got_pointer_capture.html to correctly run the test in release build. f=RyanVM. r=smaug.
dom/events/test/pointerevents/test_remove_frame_when_got_pointer_capture.html
--- a/dom/events/test/pointerevents/test_remove_frame_when_got_pointer_capture.html
+++ b/dom/events/test/pointerevents/test_remove_frame_when_got_pointer_capture.html
@@ -3,24 +3,34 @@
 <head>
   <meta charset="utf-8">
   <title>Test for triggering popup by pointer events</title>
   <script src="/tests/SimpleTest/SimpleTest.js"></script>
   <script src="/tests/SimpleTest/EventUtils.js"></script>
   <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",
     "pointermove",
     "pointerup",
     "lostpointercapture",
     "mousedown",
     "mousemove",
@@ -39,32 +49,32 @@ function startTest() {
   divEvents.forEach((event) => {
     div1.addEventListener(event, (e) => {
       ok(divEvents.indexOf(e.type) >= 0, " don't expect " + e.type);
       divEvents = divEvents.filter(item => item !== e.type);
     }, { once: true });
   });
 
   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.addEventListener("pointerdown", (e) => {
     div1.setPointerCapture(e.pointerId);
   });
 
   div1.addEventListener("gotpointercapture", (e) => {
     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);
 
   divEvents = [
     "pointerdown",
     "gotpointercapture",
     "pointermove",
     "pointerup",
@@ -85,26 +95,26 @@ function startTest() {
   divEvents.forEach((event) => {
     div1.addEventListener(event, (e) => {
       ok(divEvents.indexOf(e.type) >= 0, " don't expect " + e.type);
       divEvents = divEvents.filter(item => item !== e.type);
     }, { once: true });
   });
 
   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();
 }
 
 SimpleTest.waitForFocus(() => {
   SpecialPowers.pushPrefEnv({
     "set": [["dom.w3c_pointer_events.enabled", true]]