Bug 1163038 - Make sure the gfx blocklist tests pass by doing testing. r=me
authorMilan Sreckovic <milan@mozilla.com>
Fri, 15 May 2015 13:06:23 -0400
changeset 266249 b77ba04e3d879c22473234a84ee2bffa93d59ebf
parent 266248 b5fc35747dd4b1800d99876ae431a1116d7409c2
child 266250 e602cb65a030c19fecfa912be51f92fc0160d70f
push id2231
push usermichael.l.comella@gmail.com
push dateFri, 22 May 2015 20:04:59 +0000
reviewersme
bugs1163038
milestone41.0a1
Bug 1163038 - Make sure the gfx blocklist tests pass by doing testing. r=me Original code from Ehsan.
toolkit/mozapps/extensions/test/xpcshell/data/test_gfxBlacklist.xml
toolkit/mozapps/extensions/test/xpcshell/test_gfxBlacklist_OK.js
--- a/toolkit/mozapps/extensions/test/xpcshell/data/test_gfxBlacklist.xml
+++ b/toolkit/mozapps/extensions/test/xpcshell/data/test_gfxBlacklist.xml
@@ -50,17 +50,17 @@
         <device>0x2782</device>
       </devices>
       <feature> DIRECT2D </feature>
       <featureStatus> BLOCKED_DRIVER_VERSION </featureStatus>
       <driverVersion> 8.52.322.1111 </driverVersion>
       <driverVersionComparator> EQUAL </driverVersionComparator>
     </gfxBlacklistEntry>
     <gfxBlacklistEntry>
-      <os>Darwin 9</os>
+      <os>Darwin 10</os>
       <vendor>0xabcd</vendor>
       <devices>
         <device>0x2783</device>
         <device>0x1234</device>
         <device>0x2782</device>
       </devices>
       <feature> DIRECT2D </feature>
       <featureStatus> BLOCKED_DRIVER_VERSION </featureStatus>
@@ -119,17 +119,17 @@
       <vendor>0xabcd</vendor>
       <devices>
         <device>0x6666</device>
       </devices>
       <feature> DIRECT2D </feature>
       <featureStatus> BLOCKED_DEVICE </featureStatus>
     </gfxBlacklistEntry>
     <gfxBlacklistEntry>
-      <os>Darwin 9</os>
+      <os>Darwin 10</os>
       <vendor>0xabcd</vendor>
       <devices>
         <device>0x6666</device>
       </devices>
       <feature> DIRECT2D </feature>
       <featureStatus> BLOCKED_DEVICE </featureStatus>
     </gfxBlacklistEntry>
     <gfxBlacklistEntry>
--- a/toolkit/mozapps/extensions/test/xpcshell/test_gfxBlacklist_OK.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_gfxBlacklist_OK.js
@@ -1,45 +1,43 @@
 /* Any copyright is dedicated to the Public Domain.
  * http://creativecommons.org/publicdomain/zero/1.0/
  */
 
+// This should eventually be moved to head_addons.js
+const { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components;
+
 // Test whether a machine which exactly matches the blacklist entry is
 // successfully blocked.
 // Uses test_gfxBlacklist.xml
 
-Components.utils.import("resource://testing-common/httpd.js");
+Cu.import("resource://testing-common/httpd.js");
 
 var gTestserver = new HttpServer();
 gTestserver.start(-1);
 gPort = gTestserver.identity.primaryPort;
 mapFile("/data/test_gfxBlacklist.xml", gTestserver);
 
 function get_platform() {
-  var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"]
-                             .getService(Components.interfaces.nsIXULRuntime);
+  var xulRuntime = Cc["@mozilla.org/xre/app-info;1"]
+                             .getService(Ci.nsIXULRuntime);
   return xulRuntime.OS;
 }
 
 function load_blocklist(file) {
   Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:" +
                              gPort + "/data/" + file);
   var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
                   getService(Ci.nsITimerCallback);
   blocklist.notify(null);
 }
 
 // Performs the initial setup
 function run_test() {
-  try {
-    var gfxInfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo);
-  } catch (e) {
-    do_test_finished();
-    return;
-  }
+  var gfxInfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo);
 
   // We can't do anything if we can't spoof the stuff we need.
   if (!(gfxInfo instanceof Ci.nsIGfxInfoDebug)) {
     do_test_finished();
     return;
   }
 
   gfxInfo.QueryInterface(Ci.nsIGfxInfoDebug);
@@ -55,17 +53,17 @@ function run_test() {
       break;
     case "Linux":
       gfxInfo.spoofVendorID("0xabcd");
       gfxInfo.spoofDeviceID("0x1234");
       break;
     case "Darwin":
       gfxInfo.spoofVendorID("0xabcd");
       gfxInfo.spoofDeviceID("0x1234");
-      gfxInfo.spoofOSVersion(0x1050);
+      gfxInfo.spoofOSVersion(0x1060);
       break;
     case "Android":
       gfxInfo.spoofVendorID("abcd");
       gfxInfo.spoofDeviceID("asdf");
       gfxInfo.spoofDriverVersion("5");
       break;
   }