Bug 1313927 - Create separated test to disable it on Android only. r=jet, a=test-only
authorTobias Schneider <schneider@jancona.com>
Thu, 04 May 2017 13:24:25 -0700
changeset 396168 c45159d6fe1fb87ee4411ec1043a533e2c81866b
parent 396167 9f86465621ed869b49a6c2d925186fa9b6424407
child 396169 d833c4cac4a751a22d32152f358dbd55b9ff8e7b
push id1468
push userasasaki@mozilla.com
push dateMon, 05 Jun 2017 19:31:07 +0000
treeherdermozilla-release@0641fc6ee9d1 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjet, test-only
bugs1313927
milestone54.0
Bug 1313927 - Create separated test to disable it on Android only. r=jet, a=test-only
b/dom/base/test/test_intersectionobserver_no_root.html
dom/base/test/intersectionobserver_window.html
dom/base/test/mochitest.ini
new file mode 100644
--- /dev/null
+++ b/b/dom/base/test/test_intersectionobserver_no_root.html
@@ -0,0 +1,38 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+  <meta charset="utf-8">
+  <title>Test for Bug 1313927</title>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+</head>
+<body onload="onLoad()">
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1313927">Mozilla Bug 1313927</a>
+<p id="display"></p>
+<pre id="test">
+<script type="application/javascript">
+
+    function runTest() {
+        var win;
+
+        window.onmessage = function (e) {
+            win.close();
+            is(e.data, true);
+            SimpleTest.finish();
+        };
+
+        win = window.open("intersectionobserver_window.html");
+    }
+
+    function onLoad() {
+        SpecialPowers.pushPrefEnv({"set": [["dom.IntersectionObserver.enabled", true]]}, runTest);
+    }
+
+    SimpleTest.waitForExplicitFinish();
+
+</script>
+</pre>
+<div id="log">
+</div>
+</body>
+</html>
--- a/dom/base/test/intersectionobserver_window.html
+++ b/dom/base/test/intersectionobserver_window.html
@@ -1,34 +1,44 @@
 <!DOCTYPE HTML>
 <html>
 <head>
 <style>
-#target5 {
-        position: absolute;
-        top: 0px;
-        left: 0px;
-        width: 20px;
-        height: 20px;
-        background: #f00;
+#target {
+    position: absolute;
+    top: 0px;
+    left: 0px;
+    width: 20px;
+    height: 20px;
+    background: #f00;
 }
 </style>
 <body>
 <div id="target"></div>
 <script>
-        var io = new IntersectionObserver(function(records) {
-          var viewportWidth =
-              document.documentElement.clientWidth || document.body.clientWidth;
-          var viewportHeight =
-              document.documentElement.clientHeight || document.body.clientHeight;
-          var passed = records.length === 1 &&
-                       records[0].rootBounds.top === 0 &&
-                       records[0].rootBounds.left === 0 &&
-                       records[0].rootBounds.right === viewportWidth &&
-                       records[0].rootBounds.width === viewportWidth &&
-                       records[0].rootBounds.bottom === viewportHeight &&
-                       records[0].rootBounds.height === viewportHeight;
-          window.opener.postMessage(passed, '*');
-        });
-        io.observe(document.getElementById("target"));
+    var io = new IntersectionObserver(function(records) {
+    var viewportWidth =
+        document.documentElement.clientWidth || document.body.clientWidth;
+    var viewportHeight =
+        document.documentElement.clientHeight || document.body.clientHeight;
+    var result = records.length === 1 &&
+                 records[0].rootBounds.top === 0 &&
+                 records[0].rootBounds.left === 0 &&
+                 records[0].rootBounds.right === viewportWidth &&
+                 records[0].rootBounds.width === viewportWidth &&
+                 records[0].rootBounds.bottom === viewportHeight &&
+                 records[0].rootBounds.height === viewportHeight;
+    if (!result) {
+        result = [records[0].rootBounds.top,
+                  records[0].rootBounds.left,
+                  records[0].rootBounds.right,
+                  records[0].rootBounds.width,
+                  records[0].rootBounds.bottom,
+                  records[0].rootBounds.height,
+                  viewportWidth,
+                  viewportHeight].join(',');
+        }
+        window.opener.postMessage(result, '*');
+    });
+    io.observe(document.getElementById("target"));
 </script>
 </body>
 </html>
--- a/dom/base/test/mochitest.ini
+++ b/dom/base/test/mochitest.ini
@@ -650,16 +650,18 @@ skip-if = (toolkit == 'android') # Andro
 [test_iframe_referrer_changing.html]
 [test_iframe_referrer_invalid.html]
 [test_Image_constructor.html]
 [test_img_referrer.html]
 [test_innersize_scrollport.html]
 [test_integer_attr_with_leading_zero.html]
 [test_intersectionobservers.html]
 skip-if = true # Track Bug 1320704
+[test_intersectionobserver_no_root.html]
+skip-if = (os == "android") # bug 1360041
 [test_link_prefetch.html]
 skip-if = !e10s # Track Bug 1281415
 [test_link_stylesheet.html]
 [test_messagemanager_targetchain.html]
 [test_meta_viewport0.html]
 skip-if = (os != 'android')    # meta-viewport tag support is mobile-only
 [test_meta_viewport1.html]
 skip-if = (os != 'android')    # meta-viewport tag support is mobile-only