Bug 710103: Update XPCShell tests for GfxInfo blocklisting r=joe a=mbrubeck

This commit is contained in:
Doug Sherk 2011-12-14 21:04:35 -08:00
parent cf38d95805
commit 043ebf1931
25 changed files with 534 additions and 233 deletions

View File

@ -54,5 +54,65 @@
<driverVersion> 8.52.322.1111 </driverVersion>
<driverVersionComparator> EQUAL </driverVersionComparator>
</gfxBlacklistEntry>
<gfxBlacklistEntry>
<os>Darwin 9</os>
<vendor>0xabcd</vendor>
<devices>
<device>0x2783</device>
<device>0x1234</device>
<device>0x2782</device>
</devices>
<feature> DIRECT2D </feature>
<featureStatus> BLOCKED_DRIVER_VERSION </featureStatus>
</gfxBlacklistEntry>
<gfxBlacklistEntry>
<os>Linux</os>
<vendor>0xabcd</vendor>
<devices>
<device>0x2783</device>
<device>0x1234</device>
<device>0x2782</device>
</devices>
<feature> DIRECT2D </feature>
<featureStatus> BLOCKED_DRIVER_VERSION </featureStatus>
</gfxBlacklistEntry>
<gfxBlacklistEntry>
<os>Android</os>
<vendor>abcd</vendor>
<devices>
<device>wxyz</device>
<device>asdf</device>
<device>erty</device>
</devices>
<feature> DIRECT2D </feature>
<featureStatus> BLOCKED_DRIVER_VERSION </featureStatus>
<driverVersion> 5 </driverVersion>
<driverVersionComparator> LESS_THAN_OR_EQUAL </driverVersionComparator>
</gfxBlacklistEntry>
<gfxBlacklistEntry>
<os>Android</os>
<vendor>dcdc</vendor>
<devices>
<device>uiop</device>
<device>vbnm</device>
<device>hjkl</device>
</devices>
<feature> DIRECT2D </feature>
<featureStatus> BLOCKED_DRIVER_VERSION </featureStatus>
<driverVersion> 5 </driverVersion>
<driverVersionComparator> EQUAL </driverVersionComparator>
</gfxBlacklistEntry>
<gfxBlacklistEntry>
<os>Android</os>
<vendor>abab</vendor>
<devices>
<device>ghjk</device>
<device>cvbn</device>
</devices>
<feature> DIRECT2D </feature>
<featureStatus> BLOCKED_DRIVER_VERSION </featureStatus>
<driverVersion> 7 </driverVersion>
<driverVersionComparator> GREATER_THAN_OR_EQUAL </driverVersionComparator>
</gfxBlacklistEntry>
</gfxItems>
</blocklist>

View File

@ -1,72 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Make sure that a blacklist entry with an OS of "All" matches Windows 7, as
// long as the rest of the blacklist matches it.
// Uses test_gfxBlacklist_AllOS.xml
do_load_httpd_js();
var gTestserver = null;
function load_blocklist(file) {
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:4444/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;
}
// 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);
// Set the vendor/device ID, etc, to match the test file.
gfxInfo.spoofVendorID(0xabcd);
gfxInfo.spoofDeviceID(0x1234);
gfxInfo.spoofDriverVersion("8.52.322.2201");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();
gTestserver = new nsHttpServer();
gTestserver.registerDirectory("/data/", do_get_file("data"));
gTestserver.start(4444);
do_test_pending();
function checkBlacklist()
{
var status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT2D);
do_check_eq(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_DRIVER_VERSION);
// Make sure unrelated features aren't affected
status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT3D_9_LAYERS);
do_check_eq(status, Ci.nsIGfxInfo.FEATURE_NO_INFO);
gTestserver.stop(do_test_finished);
}
Services.obs.addObserver(function(aSubject, aTopic, aData) {
// If we wait until after we go through the event loop, gfxInfo is sure to
// have processed the gfxItems event.
do_execute_soon(checkBlacklist);
}, "blocklist-data-gfxItems", false);
load_blocklist("test_gfxBlacklist_AllOS.xml");
}

View File

@ -1,72 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
// Make sure that a blacklist entry with an OS of "All" matches Windows Vista,
// as long as the rest of the blacklist matches it.
// Uses test_gfxBlacklist_AllOS.xml
do_load_httpd_js();
var gTestserver = null;
function load_blocklist(file) {
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:4444/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;
}
// 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);
// Set the vendor/device ID, etc, to match the test file.
gfxInfo.spoofVendorID(0xabcd);
gfxInfo.spoofDeviceID(0x1234);
gfxInfo.spoofDriverVersion("8.52.322.2201");
// Windows Vista
gfxInfo.spoofOSVersion(0x60000);
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();
gTestserver = new nsHttpServer();
gTestserver.registerDirectory("/data/", do_get_file("data"));
gTestserver.start(4444);
do_test_pending();
function checkBlacklist()
{
var status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT2D);
do_check_eq(status, Ci.nsIGfxInfo.FEATURE_BLOCKED_DRIVER_VERSION);
// Make sure unrelated features aren't affected
status = gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_DIRECT3D_9_LAYERS);
do_check_eq(status, Ci.nsIGfxInfo.FEATURE_NO_INFO);
gTestserver.stop(do_test_finished);
}
Services.obs.addObserver(function(aSubject, aTopic, aData) {
// If we wait until after we go through the event loop, gfxInfo is sure to
// have processed the gfxItems event.
do_execute_soon(checkBlacklist);
}, "blocklist-data-gfxItems", false);
load_blocklist("test_gfxBlacklist_AllOS.xml");
}

View File

@ -10,6 +10,12 @@ do_load_httpd_js();
var gTestserver = null;
function get_platform() {
var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULRuntime);
return xulRuntime.OS;
}
function load_blocklist(file) {
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:4444/data/" + file);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
@ -35,11 +41,29 @@ function run_test() {
gfxInfo.QueryInterface(Ci.nsIGfxInfoDebug);
// Set the vendor/device ID, etc, to match the test file.
gfxInfo.spoofVendorID(0xabcd);
gfxInfo.spoofDeviceID(0x9876);
gfxInfo.spoofDriverVersion("8.52.322.2201");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
switch (get_platform()) {
case "WINNT":
gfxInfo.spoofVendorID("0xabcd");
gfxInfo.spoofDeviceID("0x9876");
gfxInfo.spoofDriverVersion("8.52.322.2201");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
break;
case "Linux":
gfxInfo.spoofVendorID("0xabcd");
gfxInfo.spoofDeviceID("0x9876");
break;
case "Darwin":
gfxInfo.spoofVendorID("0xabcd");
gfxInfo.spoofDeviceID("0x9876");
gfxInfo.spoofOSVersion(0x1050);
break;
case "Android":
gfxInfo.spoofVendorID("abcd");
gfxInfo.spoofDeviceID("aabb");
gfxInfo.spoofDriverVersion("5");
break;
}
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();

View File

@ -10,6 +10,12 @@ do_load_httpd_js();
var gTestserver = null;
function get_platform() {
var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULRuntime);
return xulRuntime.OS;
}
function load_blocklist(file) {
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:4444/data/" + file);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
@ -35,11 +41,28 @@ function run_test() {
gfxInfo.QueryInterface(Ci.nsIGfxInfoDebug);
// Set the vendor/device ID, etc, to match the test file.
gfxInfo.spoofVendorID(0xabcd);
gfxInfo.spoofDeviceID(0x1234);
gfxInfo.spoofDriverVersion("8.52.322.2202");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
switch (get_platform()) {
case "WINNT":
gfxInfo.spoofVendorID("0xabcd");
gfxInfo.spoofDeviceID("0x1234");
gfxInfo.spoofDriverVersion("8.52.322.2202");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
break;
case "Linux":
// We don't support driver versions on Linux.
do_test_finished();
return;
case "Darwin":
// We don't support driver versions on Darwin.
do_test_finished();
return;
case "Android":
gfxInfo.spoofVendorID("abcd");
gfxInfo.spoofDeviceID("wxyz");
gfxInfo.spoofDriverVersion("6");
break;
}
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();

View File

@ -10,6 +10,12 @@ do_load_httpd_js();
var gTestserver = null;
function get_platform() {
var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULRuntime);
return xulRuntime.OS;
}
function load_blocklist(file) {
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:4444/data/" + file);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
@ -35,11 +41,28 @@ function run_test() {
gfxInfo.QueryInterface(Ci.nsIGfxInfoDebug);
// Set the vendor/device ID, etc, to match the test file.
gfxInfo.spoofVendorID(0xdcdc);
gfxInfo.spoofDeviceID(0x1234);
gfxInfo.spoofDriverVersion("8.52.322.1112");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
switch (get_platform()) {
case "WINNT":
gfxInfo.spoofVendorID("0xdcdc");
gfxInfo.spoofDeviceID("0x1234");
gfxInfo.spoofDriverVersion("8.52.322.1112");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
break;
case "Linux":
// We don't support driver versions on Linux.
do_test_finished();
return;
case "Darwin":
// We don't support driver versions on Darwin.
do_test_finished();
return;
case "Android":
gfxInfo.spoofVendorID("dcdc");
gfxInfo.spoofDeviceID("uiop");
gfxInfo.spoofDriverVersion("6");
break;
}
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();

View File

@ -10,6 +10,12 @@ do_load_httpd_js();
var gTestserver = null;
function get_platform() {
var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULRuntime);
return xulRuntime.OS;
}
function load_blocklist(file) {
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:4444/data/" + file);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
@ -35,11 +41,28 @@ function run_test() {
gfxInfo.QueryInterface(Ci.nsIGfxInfoDebug);
// Set the vendor/device ID, etc, to match the test file.
gfxInfo.spoofVendorID(0xdcdc);
gfxInfo.spoofDeviceID(0x1234);
gfxInfo.spoofDriverVersion("8.52.322.1110");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
switch (get_platform()) {
case "WINNT":
gfxInfo.spoofVendorID("0xdcdc");
gfxInfo.spoofDeviceID("0x1234");
gfxInfo.spoofDriverVersion("8.52.322.1110");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
break;
case "Linux":
// We don't support driver versions on Linux.
do_test_finished();
return;
case "Darwin":
// We don't support driver versions on Darwin.
do_test_finished();
return;
case "Android":
gfxInfo.spoofVendorID("dcdc");
gfxInfo.spoofDeviceID("uiop");
gfxInfo.spoofDriverVersion("4");
break;
}
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();

View File

@ -10,6 +10,12 @@ do_load_httpd_js();
var gTestserver = null;
function get_platform() {
var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULRuntime);
return xulRuntime.OS;
}
function load_blocklist(file) {
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:4444/data/" + file);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
@ -35,11 +41,28 @@ function run_test() {
gfxInfo.QueryInterface(Ci.nsIGfxInfoDebug);
// Set the vendor/device ID, etc, to match the test file.
gfxInfo.spoofVendorID(0xdcdc);
gfxInfo.spoofDeviceID(0x1234);
gfxInfo.spoofDriverVersion("8.52.322.1111");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
switch (get_platform()) {
case "WINNT":
gfxInfo.spoofVendorID("0xdcdc");
gfxInfo.spoofDeviceID("0x1234");
gfxInfo.spoofDriverVersion("8.52.322.1111");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
break;
case "Linux":
// We don't support driver versions on Linux.
do_test_finished();
return;
case "Darwin":
// We don't support driver versions on Darwin.
do_test_finished();
return;
case "Android":
gfxInfo.spoofVendorID("dcdc");
gfxInfo.spoofDeviceID("uiop");
gfxInfo.spoofDriverVersion("5");
break;
}
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();

View File

@ -10,6 +10,12 @@ do_load_httpd_js();
var gTestserver = null;
function get_platform() {
var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULRuntime);
return xulRuntime.OS;
}
function load_blocklist(file) {
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:4444/data/" + file);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
@ -35,11 +41,28 @@ function run_test() {
gfxInfo.QueryInterface(Ci.nsIGfxInfoDebug);
// Set the vendor/device ID, etc, to match the test file.
gfxInfo.spoofVendorID(0xabab);
gfxInfo.spoofDeviceID(0x1234);
gfxInfo.spoofDriverVersion("8.52.322.2201");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
switch (get_platform()) {
case "WINNT":
gfxInfo.spoofVendorID("0xabab");
gfxInfo.spoofDeviceID("0x1234");
gfxInfo.spoofDriverVersion("8.52.322.2201");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
break;
case "Linux":
// We don't support driver versions on Linux.
do_test_finished();
return;
case "Darwin":
// We don't support driver versions on Darwin.
do_test_finished();
return;
case "Android":
gfxInfo.spoofVendorID("abab");
gfxInfo.spoofDeviceID("ghjk");
gfxInfo.spoofDriverVersion("6");
break;
}
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();

View File

@ -10,6 +10,12 @@ do_load_httpd_js();
var gTestserver = null;
function get_platform() {
var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULRuntime);
return xulRuntime.OS;
}
function load_blocklist(file) {
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:4444/data/" + file);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
@ -35,11 +41,28 @@ function run_test() {
gfxInfo.QueryInterface(Ci.nsIGfxInfoDebug);
// Set the vendor/device ID, etc, to match the test file.
gfxInfo.spoofVendorID(0xabab);
gfxInfo.spoofDeviceID(0x1234);
gfxInfo.spoofDriverVersion("8.52.322.2202");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
switch (get_platform()) {
case "WINNT":
gfxInfo.spoofVendorID("0xabab");
gfxInfo.spoofDeviceID("0x1234");
gfxInfo.spoofDriverVersion("8.52.322.2202");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
break;
case "Linux":
// We don't support driver versions on Linux.
do_test_finished();
return;
case "Darwin":
// We don't support driver versions on Darwin.
do_test_finished();
return;
case "Android":
gfxInfo.spoofVendorID("abab");
gfxInfo.spoofDeviceID("ghjk");
gfxInfo.spoofDriverVersion("7");
break;
}
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();

View File

@ -10,6 +10,12 @@ do_load_httpd_js();
var gTestserver = null;
function get_platform() {
var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULRuntime);
return xulRuntime.OS;
}
function load_blocklist(file) {
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:4444/data/" + file);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
@ -35,11 +41,29 @@ function run_test() {
gfxInfo.QueryInterface(Ci.nsIGfxInfoDebug);
// Set the vendor/device ID, etc, to match the test file.
gfxInfo.spoofVendorID(0xabcd);
gfxInfo.spoofDeviceID(0x1234);
gfxInfo.spoofDriverVersion("8.52.322.2201");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
switch (get_platform()) {
case "WINNT":
gfxInfo.spoofVendorID("0xabcd");
gfxInfo.spoofDeviceID("0x1234");
gfxInfo.spoofDriverVersion("8.52.322.2201");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
break;
case "Linux":
gfxInfo.spoofVendorID("0xabcd");
gfxInfo.spoofDeviceID("0x1234");
break;
case "Darwin":
gfxInfo.spoofVendorID("0xabcd");
gfxInfo.spoofDeviceID("0x1234");
gfxInfo.spoofOSVersion(0x1050);
break;
case "Android":
gfxInfo.spoofVendorID("abcd");
gfxInfo.spoofDeviceID("asdf");
gfxInfo.spoofDriverVersion("5");
break;
}
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();

View File

@ -10,6 +10,12 @@ do_load_httpd_js();
var gTestserver = null;
function get_platform() {
var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULRuntime);
return xulRuntime.OS;
}
function load_blocklist(file) {
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:4444/data/" + file);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
@ -35,11 +41,30 @@ function run_test() {
gfxInfo.QueryInterface(Ci.nsIGfxInfoDebug);
// Set the vendor/device ID, etc, to match the test file.
gfxInfo.spoofVendorID(0xabcd);
gfxInfo.spoofDeviceID(0x1234);
gfxInfo.spoofDriverVersion("8.52.322.2201");
// Windows Vista
gfxInfo.spoofOSVersion(0x60000);
switch (get_platform()) {
case "WINNT":
gfxInfo.spoofVendorID("0xabcd");
gfxInfo.spoofDeviceID("0x1234");
gfxInfo.spoofDriverVersion("8.52.322.2201");
// Windows Vista
gfxInfo.spoofOSVersion(0x60000);
break;
case "Linux":
// We don't have any OS versions on Linux, just "Linux".
do_test_finished();
return;
case "Darwin":
gfxInfo.spoofVendorID("0xabcd");
gfxInfo.spoofDeviceID("0x1234");
// Snow Leopard
gfxInfo.spoofOSVersion(0x1060);
break;
case "Android":
// On Android, the driver version is used as the OS version (because
// there's so many of them).
do_test_finished();
return;
}
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();

View File

@ -10,6 +10,12 @@ do_load_httpd_js();
var gTestserver = null;
function get_platform() {
var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULRuntime);
return xulRuntime.OS;
}
function load_blocklist(file) {
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:4444/data/" + file);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
@ -35,11 +41,29 @@ function run_test() {
gfxInfo.QueryInterface(Ci.nsIGfxInfoDebug);
// Set the vendor/device ID, etc, to match the test file.
gfxInfo.spoofVendorID(0xdcba);
gfxInfo.spoofDeviceID(0x1234);
gfxInfo.spoofDriverVersion("8.52.322.2201");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
switch (get_platform()) {
case "WINNT":
gfxInfo.spoofVendorID("0xdcba");
gfxInfo.spoofDeviceID("0x1234");
gfxInfo.spoofDriverVersion("8.52.322.2201");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
break;
case "Linux":
gfxInfo.spoofVendorID("0xdcba");
gfxInfo.spoofDeviceID("0x1234");
break;
case "Darwin":
gfxInfo.spoofVendorID("0xdcba");
gfxInfo.spoofDeviceID("0x1234");
gfxInfo.spoofOSVersion(0x1050);
break;
case "Android":
gfxInfo.spoofVendorID("dcba");
gfxInfo.spoofDeviceID("asdf");
gfxInfo.spoofDriverVersion("5");
break;
}
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();

View File

@ -10,6 +10,12 @@ do_load_httpd_js();
var gTestserver = null;
function get_platform() {
var xulRuntime = Components.classes["@mozilla.org/xre/app-info;1"]
.getService(Components.interfaces.nsIXULRuntime);
return xulRuntime.OS;
}
function load_blocklist(file) {
Services.prefs.setCharPref("extensions.blocklist.url", "http://localhost:4444/data/" + file);
var blocklist = Cc["@mozilla.org/extensions/blocklist;1"].
@ -35,11 +41,29 @@ function run_test() {
gfxInfo.QueryInterface(Ci.nsIGfxInfoDebug);
// Set the vendor/device ID, etc, to match the test file.
gfxInfo.spoofVendorID(0xabcd);
gfxInfo.spoofDeviceID(0x1234);
gfxInfo.spoofDriverVersion("8.52.322.2201");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
switch (get_platform()) {
case "WINNT":
gfxInfo.spoofVendorID("0xabcd");
gfxInfo.spoofDeviceID("0x1234");
gfxInfo.spoofDriverVersion("8.52.322.2201");
// Windows 7
gfxInfo.spoofOSVersion(0x60001);
break;
case "Linux":
gfxInfo.spoofVendorID("0xabcd");
gfxInfo.spoofDeviceID("0x1234");
break;
case "Darwin":
gfxInfo.spoofVendorID("0xabcd");
gfxInfo.spoofDeviceID("0x1234");
gfxInfo.spoofOSVersion(0x1050);
break;
case "Android":
gfxInfo.spoofVendorID("abcd");
gfxInfo.spoofDeviceID("asdf");
gfxInfo.spoofDriverVersion("5");
break;
}
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "3", "8");
startupManager();

View File

@ -150,8 +150,6 @@ skip-if = os == "android"
[test_fuel.js]
[test_general.js]
[test_getresource.js]
[test_gfxBlacklist_AllOS1.js]
[test_gfxBlacklist_AllOS2.js]
[test_gfxBlacklist_Device.js]
[test_gfxBlacklist_DriverNew.js]
[test_gfxBlacklist_Equal_DriverNew.js]

View File

@ -39,11 +39,11 @@
/* NOTE: this interface is only implemented in debug builds */
[scriptable, uuid(0c19c88a-9ef1-4bb4-b0a2-86ab768e8bd6)]
[scriptable, uuid(ca7b0bc7-c67c-4b79-8270-ed7ba002af08)]
interface nsIGfxInfoDebug : nsISupports
{
void spoofVendorID(in unsigned long aVendorID);
void spoofDeviceID(in unsigned long aDeviceID);
void spoofVendorID(in DOMString aVendorID);
void spoofDeviceID(in DOMString aDeviceID);
void spoofDriverVersion(in DOMString aDriverVersion);

View File

@ -51,6 +51,10 @@
using namespace mozilla::widget;
#ifdef DEBUG
NS_IMPL_ISUPPORTS_INHERITED1(GfxInfo, GfxInfoBase, nsIGfxInfoDebug)
#endif
/* GetD2DEnabled and GetDwriteEnabled shouldn't be called until after gfxPlatform initialization
* has occurred because they depend on it for information. (See bug 591561) */
nsresult
@ -329,3 +333,36 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature,
return GfxInfoBase::GetFeatureStatusImpl(aFeature, aStatus, aSuggestedDriverVersion, aDriverInfo, &os);
}
#ifdef DEBUG
// Implement nsIGfxInfoDebug
/* void spoofVendorID (in DOMString aVendorID); */
NS_IMETHODIMP GfxInfo::SpoofVendorID(const nsAString & aVendorID)
{
mAdapterVendorID = aVendorID;
return NS_OK;
}
/* void spoofDeviceID (in unsigned long aDeviceID); */
NS_IMETHODIMP GfxInfo::SpoofDeviceID(const nsAString & aDeviceID)
{
mAdapterDeviceID = aDeviceID;
return NS_OK;
}
/* void spoofDriverVersion (in DOMString aDriverVersion); */
NS_IMETHODIMP GfxInfo::SpoofDriverVersion(const nsAString & aDriverVersion)
{
mDriverVersion = aDriverVersion;
return NS_OK;
}
/* void spoofOSVersion (in unsigned long aVersion); */
NS_IMETHODIMP GfxInfo::SpoofOSVersion(PRUint32 aVersion)
{
return NS_OK;
}
#endif

View File

@ -79,6 +79,11 @@ public:
virtual nsresult Init();
#ifdef DEBUG
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIGFXINFODEBUG
#endif
protected:
virtual nsresult GetFeatureStatusImpl(PRInt32 aFeature,

View File

@ -74,12 +74,18 @@ public:
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverVersion2(nsAString & aAdapterDriverVersion);
NS_SCRIPTABLE NS_IMETHOD GetAdapterDriverDate2(nsAString & aAdapterDriverDate);
NS_SCRIPTABLE NS_IMETHOD GetIsGPU2Active(bool *aIsGPU2Active);
using GfxInfoBase::GetFeatureStatus;
using GfxInfoBase::GetFeatureSuggestedDriverVersion;
using GfxInfoBase::GetWebGLParameter;
virtual nsresult Init();
#ifdef DEBUG
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIGFXINFODEBUG
#endif
protected:
virtual nsresult GetFeatureStatusImpl(PRInt32 aFeature,

View File

@ -67,10 +67,28 @@
using namespace mozilla;
using namespace mozilla::widget;
#ifdef DEBUG
NS_IMPL_ISUPPORTS_INHERITED1(GfxInfo, GfxInfoBase, nsIGfxInfoDebug)
#endif
GfxInfo::GfxInfo()
{
}
static OperatingSystem
OSXVersionToOperatingSystem(PRUint32 aOSXVersion)
{
switch (aOSXVersion & MAC_OS_X_VERSION_MAJOR_MASK) {
case MAC_OS_X_VERSION_10_5_HEX:
return DRIVER_OS_OS_X_10_5;
case MAC_OS_X_VERSION_10_6_HEX:
return DRIVER_OS_OS_X_10_6;
case MAC_OS_X_VERSION_10_7_HEX:
return DRIVER_OS_OS_X_10_7;
}
return DRIVER_OS_UNKNOWN;
}
// The following three functions are derived from Chromium code
static CFTypeRef SearchPortForProperty(io_registry_entry_t dspPort,
CFStringRef propertyName)
@ -158,6 +176,8 @@ GfxInfo::Init()
AddCrashReportAnnotations();
mOSXVersion = nsToolkit::OSXVersion();
return rv;
}
@ -364,21 +384,6 @@ GfxInfo::GetGfxDriverInfo()
return *mDriverInfo;
}
static OperatingSystem
OSXVersionToOperatingSystem(PRUint32 aOSXVersion)
{
switch (aOSXVersion & MAC_OS_X_VERSION_MAJOR_MASK) {
case MAC_OS_X_VERSION_10_5_HEX:
return DRIVER_OS_OS_X_10_5;
case MAC_OS_X_VERSION_10_6_HEX:
return DRIVER_OS_OS_X_10_6;
case MAC_OS_X_VERSION_10_7_HEX:
return DRIVER_OS_OS_X_10_7;
}
return DRIVER_OS_UNKNOWN;
}
nsresult
GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature,
PRInt32* aStatus,
@ -389,7 +394,7 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature,
NS_ENSURE_ARG_POINTER(aStatus);
aSuggestedDriverVersion.SetIsVoid(true);
*aStatus = nsIGfxInfo::FEATURE_STATUS_UNKNOWN;
OperatingSystem os = OSXVersionToOperatingSystem(nsToolkit::OSXVersion());
OperatingSystem os = OSXVersionToOperatingSystem(mOSXVersion);
if (aOS)
*aOS = os;
@ -456,3 +461,37 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature,
return GfxInfoBase::GetFeatureStatusImpl(aFeature, aStatus, aSuggestedDriverVersion, aDriverInfo, &os);
}
#ifdef DEBUG
// Implement nsIGfxInfoDebug
/* void spoofVendorID (in DOMString aVendorID); */
NS_IMETHODIMP GfxInfo::SpoofVendorID(const nsAString & aVendorID)
{
mAdapterVendorID = aVendorID;
return NS_OK;
}
/* void spoofDeviceID (in unsigned long aDeviceID); */
NS_IMETHODIMP GfxInfo::SpoofDeviceID(const nsAString & aDeviceID)
{
mAdapterDeviceID = aDeviceID;
return NS_OK;
}
/* void spoofDriverVersion (in DOMString aDriverVersion); */
NS_IMETHODIMP GfxInfo::SpoofDriverVersion(const nsAString & aDriverVersion)
{
mDriverVersion = aDriverVersion;
return NS_OK;
}
/* void spoofOSVersion (in unsigned long aVersion); */
NS_IMETHODIMP GfxInfo::SpoofOSVersion(PRUint32 aVersion)
{
mOSXVersion = aVersion;
return NS_OK;
}
#endif

View File

@ -1031,19 +1031,17 @@ GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature,
// Implement nsIGfxInfoDebug
/* void spoofVendorID (in unsigned long aVendorID); */
NS_IMETHODIMP GfxInfo::SpoofVendorID(PRUint32 aVendorID)
/* void spoofVendorID (in DOMString aVendorID); */
NS_IMETHODIMP GfxInfo::SpoofVendorID(const nsAString & aVendorID)
{
mAdapterVendorID.Truncate(0);
mAdapterVendorID.AppendPrintf("0x%04x", aVendorID);
mAdapterVendorID = aVendorID;
return NS_OK;
}
/* void spoofDeviceID (in unsigned long aDeviceID); */
NS_IMETHODIMP GfxInfo::SpoofDeviceID(PRUint32 aDeviceID)
NS_IMETHODIMP GfxInfo::SpoofDeviceID(const nsAString & aDeviceID)
{
mAdapterDeviceID.Truncate(0);
mAdapterDeviceID.AppendPrintf("0x%04x", aDeviceID);
mAdapterDeviceID = aDeviceID;
return NS_OK;
}

View File

@ -41,15 +41,11 @@
#define __mozilla_widget_GfxInfo_h__
#include "GfxInfoBase.h"
#include "nsIGfxInfoDebug.h"
namespace mozilla {
namespace widget {
class GfxInfo : public GfxInfoBase
#ifdef DEBUG
, public nsIGfxInfoDebug
#endif
{
public:
GfxInfo();
@ -80,13 +76,13 @@ public:
using GfxInfoBase::GetFeatureSuggestedDriverVersion;
using GfxInfoBase::GetWebGLParameter;
virtual nsresult Init();
#ifdef DEBUG
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIGFXINFODEBUG
#endif
virtual nsresult Init();
protected:
virtual nsresult GetFeatureStatusImpl(PRInt32 aFeature,

View File

@ -48,6 +48,7 @@
#include "nsTArray.h"
#include "nsString.h"
#include "GfxInfoCollector.h"
#include "nsIGfxInfoDebug.h"
namespace mozilla {
namespace widget {
@ -55,6 +56,9 @@ namespace widget {
class GfxInfoBase : public nsIGfxInfo,
public nsIObserver,
public nsSupportsWeakReference
#ifdef DEBUG
, public nsIGfxInfoDebug
#endif
{
public:
GfxInfoBase();

View File

@ -54,6 +54,10 @@
namespace mozilla {
namespace widget {
#ifdef DEBUG
NS_IMPL_ISUPPORTS_INHERITED1(GfxInfo, GfxInfoBase, nsIGfxInfoDebug)
#endif
// these global variables will be set when firing the glxtest process
int glxtest_pipe = 0;
pid_t glxtest_pid = 0;
@ -481,6 +485,40 @@ GfxInfo::GetIsGPU2Active(bool* aIsGPU2Active)
return NS_ERROR_FAILURE;
}
#ifdef DEBUG
// Implement nsIGfxInfoDebug
// We don't support spoofing anything on Linux
/* void spoofVendorID (in DOMString aVendorID); */
NS_IMETHODIMP GfxInfo::SpoofVendorID(const nsAString & aVendorID)
{
CopyUTF16toUTF8(aVendorID, mVendor);
return NS_OK;
}
/* void spoofDeviceID (in unsigned long aDeviceID); */
NS_IMETHODIMP GfxInfo::SpoofDeviceID(const nsAString & aDeviceID)
{
CopyUTF16toUTF8(aDeviceID, mRenderer);
return NS_OK;
}
/* void spoofDriverVersion (in DOMString aDriverVersion); */
NS_IMETHODIMP GfxInfo::SpoofDriverVersion(const nsAString & aDriverVersion)
{
CopyUTF16toUTF8(aDriverVersion, mVersion);
return NS_OK;
}
/* void spoofOSVersion (in unsigned long aVersion); */
NS_IMETHODIMP GfxInfo::SpoofOSVersion(PRUint32 aVersion)
{
// We don't support OS versioning on Linux. There's just "Linux".
return NS_OK;
}
#endif
} // end namespace widget
} // end namespace mozilla

View File

@ -79,6 +79,11 @@ public:
NS_IMETHOD_(void) GetData();
#ifdef DEBUG
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIGFXINFODEBUG
#endif
protected:
virtual nsresult GetFeatureStatusImpl(PRInt32 aFeature,