Bug 1501428 - Enable test_scrollbar_colors.html on Linux. r=karlt
authorXidorn Quan <me@upsuper.org>
Tue, 23 Oct 2018 23:25:32 +0000
changeset 491026 75f6d479fdaf74ea269f22c7f3e6ffe91133c726
parent 491025 bee1c344cb473d75347c012bbd0f8eac58428926
child 491027 2793e042041cecfd63b3a66f9930bf49c6ac3aa0
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewerskarlt
bugs1501428
milestone65.0a1
Bug 1501428 - Enable test_scrollbar_colors.html on Linux. r=karlt Differential Revision: https://phabricator.services.mozilla.com/D9595
widget/tests/mochitest.ini
widget/tests/test_scrollbar_colors.html
--- a/widget/tests/mochitest.ini
+++ b/widget/tests/mochitest.ini
@@ -7,9 +7,9 @@ skip-if = toolkit != 'windows' || headle
 subsuite = clipboard
 skip-if = toolkit == "cocoa" || (toolkit == 'android' && debug) || android_version == '24' # 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 == 'linux' || os == 'android' # bug 1460109
+skip-if = (os == 'linux' && headless) || os == 'android' # bug 1460109
--- a/widget/tests/test_scrollbar_colors.html
+++ b/widget/tests/test_scrollbar_colors.html
@@ -50,16 +50,25 @@ const MAC_REFERENCES = [
   // Yellow background
   ["255,255,0", 7225],
   // Blue scrollbar face
   ["0,0,255", 416],
   // Cyan scrollbar track
   ["0,255,255", 1760],
 ];
 
+const LINUX_REFERENCES = [
+  // Yellow background
+  ["255,255,0", 8100],
+  // Blue scrollbar face
+  ["0,0,255", 720],
+  // Cyan scrollbar track
+  ["0,255,255", 1180],
+];
+
 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({
@@ -71,16 +80,18 @@ if (outerRect.width == outer.clientWidth
 
     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 if (navigator.platform.startsWith("Linux")) {
+      references = LINUX_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();