Bug 1464722 part 6 - Enable scrollbar colors test on mac. r=spohl
authorXidorn Quan <me@upsuper.org>
Mon, 25 Jun 2018 10:16:25 +1000
changeset 423987 479c0a3c61fd2e8b86c958541d362560c97ae078
parent 423986 a8b609fb90ade459a1a79fc495045401230e8169
child 423988 22fd5e86fbf66c6cd182b435029ac2be54c26761
push id34197
push usercsabou@mozilla.com
push dateThu, 28 Jun 2018 09:44:02 +0000
treeherdermozilla-central@db455160668d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersspohl
bugs1464722
milestone63.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 1464722 part 6 - Enable scrollbar colors test on mac. r=spohl MozReview-Commit-ID: IfBhLvGzr5u
widget/tests/mochitest.ini
widget/tests/test_scrollbar_colors.html
--- a/widget/tests/mochitest.ini
+++ b/widget/tests/mochitest.ini
@@ -5,9 +5,9 @@ support-files = utils.js
 subsuite = clipboard
 skip-if = toolkit == "cocoa" || (toolkit == 'android' && debug) # Mac: Bug 933303, Android bug 1285414
 [test_keypress_event_with_alt_on_mac.html]
 skip-if = toolkit != "cocoa"
 [test_picker_no_crash.html]
 skip-if = toolkit != "windows" || e10s # Bug 1267491
 support-files = window_picker_no_crash_child.html
 [test_scrollbar_colors.html]
-skip-if = os == 'mac' || os == 'linux' || os == 'android' # bug 1460109
+skip-if = os == 'linux' || os == 'android' # bug 1460109
--- a/widget/tests/test_scrollbar_colors.html
+++ b/widget/tests/test_scrollbar_colors.html
@@ -41,29 +41,52 @@ const WIN_REFERENCES = [
   // Yellow background
   ["255,255,0", 6889],
   // Blue scrollbar face
   ["0,0,255", 540],
   // Cyan scrollbar track
   ["0,255,255", 2487],
 ];
 
-SimpleTest.waitForExplicitFinish();
-SpecialPowers.pushPrefEnv({
-  "set": [["layout.css.scrollbar-colors.enabled", true]],
-}, function() {
-  document.querySelector('#style').textContent = `
-    .outer {
-      scrollbar-face-color: blue;
-      scrollbar-track-color: cyan;
-    }
-  `;
+const MAC_REFERENCES = [
+  // Yellow background
+  ["255,255,0", 7225],
+  // Blue scrollbar face
+  ["0,0,255", 416],
+  // Cyan scrollbar track
+  ["0,255,255", 1760],
+];
 
-  let outer = document.querySelector('.outer');
-  let canvas = snapshotRect(window, outer.getBoundingClientRect());
-  let stats = countPixels(canvas);
-  for (let [color, count] of WIN_REFERENCES) {
-    let value = stats.get(color);
-    is(value, count, `Pixel count of color ${color}`);
-  }
-  SimpleTest.finish();
-});
+let outer = document.querySelector('.outer');
+let outerRect = outer.getBoundingClientRect();
+if (outerRect.width == outer.clientWidth &&
+    outerRect.height == outer.clientHeight) {
+  ok(true, "Using overlay scrollbar, skip this test");
+} else {
+  SimpleTest.waitForExplicitFinish();
+  SpecialPowers.pushPrefEnv({
+    "set": [["layout.css.scrollbar-colors.enabled", true]],
+  }, function() {
+    document.querySelector('#style').textContent = `
+      .outer {
+        scrollbar-face-color: blue;
+        scrollbar-track-color: cyan;
+      }
+    `;
+
+    let canvas = snapshotRect(window, outerRect);
+    let stats = countPixels(canvas);
+    let references;
+    if (navigator.platform.startsWith("Win")) {
+      references = WIN_REFERENCES;
+    } else if (navigator.platform.startsWith("Mac")) {
+      references = MAC_REFERENCES;
+    } else {
+      ok(false, "Unsupported platform");
+    }
+    for (let [color, count] of references) {
+      let value = stats.get(color);
+      is(value, count, `Pixel count of color ${color}`);
+    }
+    SimpleTest.finish();
+  });
+}
 </script>