Bug 1326189 part 4 - Support caret in test_visited_reftests. r=dholbert draft
authorXidorn Quan <me@upsuper.org>
Fri, 20 Jan 2017 17:27:18 +1100
changeset 464851 1fc4b8683d9eb10b6e9d90902bf6d177b7ac50cd
parent 464850 c81fce0505ec806f3d93adf4eee474a9cadd58a0
child 464852 6b06582d65b0e61f3f0721e4af6b2c686664428c
push id42456
push userxquan@mozilla.com
push dateMon, 23 Jan 2017 04:22:23 +0000
reviewersdholbert
bugs1326189
milestone53.0a1
Bug 1326189 part 4 - Support caret in test_visited_reftests. r=dholbert MozReview-Commit-ID: I7zaJw1S4ZC
layout/style/test/test_visited_reftests.html
testing/profiles/prefs_general.js
--- a/layout/style/test/test_visited_reftests.html
+++ b/layout/style/test/test_visited_reftests.html
@@ -105,16 +105,18 @@ function startIframe(url) {
     element.src = "css-visited/" + url;
     document.body.appendChild(element);
   });
 }
 
 async function runTests() {
   SimpleTest.waitForExplicitFinish();
   SimpleTest.requestFlakyTimeout("async link coloring");
+  // Set caret to a known size, for tests of :visited caret-color styling
+  await SpecialPowers.pushPrefEnv({'set': [['ui.caretWidth', 16]]});
   await startIframe("visited-page.html");
   await Promise.all(gTests.map(runTest));
   SimpleTest.finish();
 }
 
 function passes(equal, shot1, shot2)
 {
   let [correct] = compareSnapshots(shot1, shot2, equal);
@@ -153,17 +155,17 @@ async function runTest(testLine) {
   await waitFor100ms();
 
   let tries;
   let testSnapshot;
   for (tries = 0; tries < gMaxPassingTries * gTimeoutFactor; ++tries) {
     if (needsFocus) {
       await SimpleTest.promiseFocus(testWindow, false);
     }
-    testSnapshot = snapshotWindow(testWindow);
+    testSnapshot = snapshotWindow(testWindow, true);
     if (passes(isEqual, testSnapshot, refSnapshot)) {
       if (tries > gMaxPassingTries) {
         gMaxPassingTries = tries;
       }
       break;
     }
     // Links might not have been colored yet. Try again in 100ms.
     await waitFor100ms();
--- a/testing/profiles/prefs_general.js
+++ b/testing/profiles/prefs_general.js
@@ -57,16 +57,18 @@ user_pref("media.gmp-manager.updateEnabl
 user_pref("dom.w3c_touch_events.enabled", 1);
 user_pref("layout.accessiblecaret.enabled_on_touch", false);
 user_pref("dom.webcomponents.enabled", true);
 user_pref("dom.webcomponents.customelements.enabled", true);
 user_pref("dom.htmlimports.enabled", true);
 // Existing tests assume there is no font size inflation.
 user_pref("font.size.inflation.emPerLine", 0);
 user_pref("font.size.inflation.minTwips", 0);
+// Disable the caret blinking so we get stable snapshot
+user_pref("ui.caretBlinkTime", -1);
 
 // AddonManager tests require that the experiments provider be present.
 user_pref("experiments.supported", true);
 // Point the manifest at something local so we don't risk it hitting production
 // data and installing experiments that may vary over time.
 user_pref("experiments.manifest.uri", "http://%(server)s/experiments-dummy/manifest");
 
 // Don't allow background tabs to be zombified, otherwise for tests that