Bug 1464722 part 6 - Enable scrollbar colors test on mac. r?spohl
MozReview-Commit-ID: IfBhLvGzr5u
--- 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>