Bug 1273654 - Reuse the apz test utils in a few more places. r=botond
authorKartikaya Gupta <kgupta@mozilla.com>
Wed, 25 May 2016 15:31:52 -0400
changeset 338020 f163ba08afc61c44fc1b2cacab7df37d8097b1a8
parent 338019 90341d286f4dcff8ab6d8bc21d5d888bc3bab328
child 338021 1ac523b371f2408d9dc3c403390387564d811962
push id6249
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 13:59:36 +0000
treeherdermozilla-beta@bad9d4f5bf7e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbotond
bugs1273654
milestone49.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 1273654 - Reuse the apz test utils in a few more places. r=botond MozReview-Commit-ID: 2mV0VzlrKh6
gfx/layers/apz/test/mochitest/helper_long_tap.html
gfx/layers/apz/test/mochitest/helper_tap_passive.html
gfx/layers/apz/test/mochitest/test_bug1151663.html
gfx/layers/apz/test/mochitest/test_bug982141.html
--- a/gfx/layers/apz/test/mochitest/helper_long_tap.html
+++ b/gfx/layers/apz/test/mochitest/helper_long_tap.html
@@ -37,28 +37,22 @@ function recordEvent(e) {
       flushApzRepaints(function() {
         dump("Done APZ flush, ending test...\n");
         subtestDone(); // closing the window should dismiss the context menu dialog
       });
     });
   }
 }
 
-function registerListeners() {
-  window.addEventListener('touchstart', recordEvent, { passive: true, capture: true });
-  window.addEventListener('touchend', recordEvent, { passive: true, capture: true });
-  window.addEventListener('touchcancel', recordEvent, true);
-  window.addEventListener('contextmenu', recordEvent, true);
-}
+window.addEventListener('touchstart', recordEvent, { passive: true, capture: true });
+window.addEventListener('touchend', recordEvent, { passive: true, capture: true });
+window.addEventListener('touchcancel', recordEvent, true);
+window.addEventListener('contextmenu', recordEvent, true);
 
-window.onload = function() {
-  registerListeners();
-  waitForAllPaints(function() {
-    flushApzRepaints(longPressLink);
-  });
-}
+waitUntilApzStable()
+.then(longPressLink);
 
   </script>
 </head>
 <body>
  <a id="b" href="#">Link to nowhere</a>
 </body>
 </html>
--- a/gfx/layers/apz/test/mochitest/helper_tap_passive.html
+++ b/gfx/layers/apz/test/mochitest/helper_tap_passive.html
@@ -43,26 +43,20 @@ function recordEvent(e) {
   e.preventDefault();
 
   synthesizeNativeTouch(document.getElementById('b'), 5, 5, SpecialPowers.DOMWindowUtils.TOUCH_REMOVE, function() {
     dump("Finished synthesizing touch-end to clear state; finishing test...\n");
     subtestDone();
   });
 }
 
-function registerListeners() {
-  window.addEventListener('touchstart', recordEvent, { passive: true, capture: true });
-  window.addEventListener('contextmenu', recordEvent, true);
-}
+window.addEventListener('touchstart', recordEvent, { passive: true, capture: true });
+window.addEventListener('contextmenu', recordEvent, true);
 
-window.onload = function() {
-  registerListeners();
-  waitForAllPaints(function() {
-    flushApzRepaints(longPressLink);
-  });
-}
+waitUntilApzStable()
+.then(longPressLink);
 
   </script>
 </head>
 <body>
  <a id="b" href="#">Link to nowhere</a>
 </body>
 </html>
--- a/gfx/layers/apz/test/mochitest/test_bug1151663.html
+++ b/gfx/layers/apz/test/mochitest/test_bug1151663.html
@@ -14,17 +14,17 @@ https://bugzilla.mozilla.org/show_bug.cg
     if (isApzEnabled()) {
       SimpleTest.waitForExplicitFinish();
 
       // Run the actual test in its own window, because it requires that the
       // root APZC 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() {
-        SpecialPowers.pushPrefEnv({"set": [["apz.test.logging_enabled", true]]}, function() {
+        pushPrefs([["apz.test.logging_enabled", true]]).then(function() {
           w = window.open("helper_bug1151663.html", "_blank");
         });
       };
     }
 
     function finishTest() {
       w.close();
       SimpleTest.finish();
--- a/gfx/layers/apz/test/mochitest/test_bug982141.html
+++ b/gfx/layers/apz/test/mochitest/test_bug982141.html
@@ -14,17 +14,17 @@ https://bugzilla.mozilla.org/show_bug.cg
     if (isApzEnabled()) {
       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() {
-        SpecialPowers.pushPrefEnv({"set": [["apz.test.logging_enabled", true]]}, function() {
+        pushPrefs([["apz.test.logging_enabled", true]]).then(function() {
           w = window.open("helper_bug982141.html", "_blank");
         });
       };
     }
 
     function finishTest() {
       w.close();
       SimpleTest.finish();