Bug 1163038 - Make sure the gfx blocklist tests pass by doing testing. r=me

Original code from Ehsan.

--HG--
extra : rebase_source : 230f465e36384b3f5810b8358db35cbf764fd800
This commit is contained in:
Milan Sreckovic 2015-05-15 13:06:23 -04:00
parent df043549d1
commit 4faad2a7ed
2 changed files with 10 additions and 12 deletions

View File

@ -55,7 +55,7 @@
<driverVersionComparator> EQUAL </driverVersionComparator>
</gfxBlacklistEntry>
<gfxBlacklistEntry>
<os>Darwin 9</os>
<os>Darwin 10</os>
<vendor>0xabcd</vendor>
<devices>
<device>0x2783</device>
@ -124,7 +124,7 @@
<featureStatus> BLOCKED_DEVICE </featureStatus>
</gfxBlacklistEntry>
<gfxBlacklistEntry>
<os>Darwin 9</os>
<os>Darwin 10</os>
<vendor>0xabcd</vendor>
<devices>
<device>0x6666</device>

View File

@ -2,11 +2,14 @@
* 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);
@ -14,8 +17,8 @@ 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;
}
@ -29,12 +32,7 @@ function load_blocklist(file) {
// 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)) {
@ -60,7 +58,7 @@ function run_test() {
case "Darwin":
gfxInfo.spoofVendorID("0xabcd");
gfxInfo.spoofDeviceID("0x1234");
gfxInfo.spoofOSVersion(0x1050);
gfxInfo.spoofOSVersion(0x1060);
break;
case "Android":
gfxInfo.spoofVendorID("abcd");