Bug 1251608 - Fix and enable test_bug982141 for all platforms. r=botond
authorKartikaya Gupta <kgupta@mozilla.com>
Sat, 05 Mar 2016 19:22:25 -0500
changeset 286962 b592bfa4541d1a1ca9b2121d863d7a6263cf1332
parent 286961 90e4525b29897857e1485b51af1d1ce324c61da0
child 286963 954f09e238ca46720842b522272213b9b58998b5
push id18025
push userryanvm@gmail.com
push dateSun, 06 Mar 2016 20:04:05 +0000
treeherderfx-team@b6acf4d4fc20 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1251608, 982141
milestone47.0a1
Bug 1251608 - Fix and enable test_bug982141 for all platforms. r=botond MozReview-Commit-ID: JQ569KBz1wf
gfx/layers/apz/test/mochitest/helper_bug982141.html
gfx/layers/apz/test/mochitest/mochitest.ini
gfx/layers/apz/test/mochitest/test_bug982141.html
--- a/gfx/layers/apz/test/mochitest/helper_bug982141.html
+++ b/gfx/layers/apz/test/mochitest/helper_bug982141.html
@@ -54,22 +54,23 @@ https://bugzilla.mozilla.org/show_bug.cg
 
       // Convert the test data into a representation that's easier to navigate.
       contentTestData = convertTestData(contentTestData);
       compositorTestData = convertTestData(compositorTestData);
 
       // Reconstruct the APZC tree structure in the last paint.
       var apzcTree = buildApzcTree(compositorTestData.paints[lastCompositorPaintSeqNo]);
 
-      // The apzc tree for this page should consist of a single root APZC
-      // and a child APZC for the scrollable <div>.
-      SimpleTest.is(apzcTree.children.length, 1, "expected a single root APZC");
-      var rootApzc = apzcTree.children[0];
-      SimpleTest.is(rootApzc.children.length, 1, "expected a single child APZC");
-      var childScrollId = rootApzc.children[0].scrollId;
+      // The apzc tree for this page should consist of a single child APZC on
+      // the RCD node (the child is for scrollable <div>). Note that in e10s/B2G
+      // cases the RCD will be the root of the tree but on Fennec it will not.
+      var rcd = findRcdNode(apzcTree);
+      SimpleTest.ok(rcd != null, "found the RCD node");
+      SimpleTest.is(rcd.children.length, 1, "expected a single child APZC");
+      var childScrollId = rcd.children[0].scrollId;
 
       // We should have content-side data for the same paint.
       SimpleTest.ok(lastCompositorPaintSeqNo in contentTestData.paints,
                     "expected a content paint with sequence number" + lastCompositorPaintSeqNo);
       var correspondingContentPaint = contentTestData.paints[lastCompositorPaintSeqNo];
 
       // This content-side data should have a displayport for our scrollable <div>.
       SimpleTest.ok(childScrollId in correspondingContentPaint,
@@ -77,26 +78,31 @@ https://bugzilla.mozilla.org/show_bug.cg
       SimpleTest.ok("displayport" in correspondingContentPaint[childScrollId],
                     "expected a displayport for scroll id " + childScrollId);
       var childDisplayport = correspondingContentPaint[childScrollId]["displayport"];
       var dpFields = childDisplayport.replace(/[()\s]+/g, '').split(',');
       SimpleTest.is(dpFields.length, 4, "expected displayport string of form (x,y,w,h)");
       var dpWidth = dpFields[2];
       var dpHeight = dpFields[3];
       SimpleTest.ok(dpWidth >= 50 && dpHeight >= 50,
-                    "expected a displayport at least as large as the scrollable element");
+                    "expected a displayport at least as large as the scrollable element, got " + childDisplayport);
 
       window.opener.finishTest();
     }
   </script>
 </head>
 <body style="overflow: hidden;"><!-- This combined with the user-scalable=no ensures the root frame is not scrollable -->
   <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=982141">Mozilla Bug 982141</a>
   <!-- A scrollable subframe, with enough content to make it have a nonzero scroll range -->
   <div style="height: 50px; width: 50px; overflow: scroll">
+    <div style="width: 100px">
+      Wide content so that the vertical scrollbar for the parent div
+      doesn't eat into the 50px width and reduce the width of the
+      displayport.
+    </div>
     Line 1<br>
     Line 2<br>
     Line 3<br>
     Line 4<br>
     Line 5<br>
     Line 6<br>
     Line 7<br>
     Line 8<br>
--- a/gfx/layers/apz/test/mochitest/mochitest.ini
+++ b/gfx/layers/apz/test/mochitest/mochitest.ini
@@ -8,17 +8,16 @@ support-files =
   helper_iframe2.html
   helper_subframe_style.css
   helper_basic_pan.html
   helper_div_pan.html
   helper_iframe_pan.html
   helper_tap.html
 tags = apz
 [test_bug982141.html]
-skip-if = toolkit != 'gonk'  # bug 991198
 [test_bug1151663.html]
 skip-if = toolkit != 'gonk'  # bug 991198
 [test_wheel_scroll.html]
 skip-if = (os == 'android') || (os == 'b2g') || (buildapp == 'mulet') # wheel events not supported on mobile; see bug 1164274 for mulet
 [test_wheel_transactions.html]
 skip-if = (os == 'android') || (os == 'b2g') || (buildapp == 'mulet') # wheel events not supported on mobile; see bug 1164274 for mulet
 [test_bug1151667.html]
 skip-if = (os == 'android') || (os == 'b2g') # wheel events not supported on mobile
--- a/gfx/layers/apz/test/mochitest/test_bug982141.html
+++ b/gfx/layers/apz/test/mochitest/test_bug982141.html
@@ -12,16 +12,21 @@ https://bugzilla.mozilla.org/show_bug.cg
 
     SimpleTest.waitForExplicitFinish();
 
     // Run the actual test in its own window, because it requires that the
     // root APZC not be scrollable. Mochitest pages themselves often run
     // inside an iframe which means we have no control over the root APZC.
     var w = null;
     window.onload = function() {
+      if (!SpecialPowers.getDOMWindowUtils(window).asyncPanZoomEnabled) {
+        ok(true, "APZ is not enabled, this test is not relevant, sorry!\n");
+        SimpleTest.finish();
+        return;
+      }
       SpecialPowers.pushPrefEnv({"set": [["apz.test.logging_enabled", true]]}, function() {
         w = window.open("helper_bug982141.html", "_blank");
       });
     };
 
     function finishTest() {
       w.close();
       SimpleTest.finish();