Bug 562967 - fix test_handlerService.js for new Windows 7 test boxes. r=rs

This commit is contained in:
Justin Dolske 2010-07-21 14:49:00 -07:00
parent 6ad94d826e
commit 1558bac5eb

View File

@ -59,6 +59,17 @@ function run_test() {
const rootPrefBranch = prefSvc.getBranch("");
let isWin7OrHigher = false;
let isWindows = ("@mozilla.org/windows-registry-key;1" in Components.classes);
if (isWindows) {
try {
let version = Cc["@mozilla.org/system-info;1"]
.getService(Ci.nsIPropertyBag2)
.getProperty("version");
isWin7OrHigher = (parseFloat(version) >= 6.1);
} catch (ex) { }
}
//**************************************************************************//
// Sample Data
@ -171,18 +182,28 @@ function run_test() {
do_check_eq(2, protoInfo.possibleApplicationHandlers.length);
else
do_check_eq(0, protoInfo.possibleApplicationHandlers.length);
do_check_false(protoInfo.alwaysAskBeforeHandling);
// Win7 doesn't have a default mailto: handler
if (isWin7OrHigher)
do_check_true(protoInfo.alwaysAskBeforeHandling);
else
do_check_false(protoInfo.alwaysAskBeforeHandling);
// OS default exists, injected default exists, explicit warning pref: true
prefSvc.setBoolPref(kExternalWarningPrefPrefix + "mailto", true);
protoInfo = protoSvc.getProtocolHandlerInfo("mailto");
if (haveDefaultHandlersVersion) {
do_check_eq(2, protoInfo.possibleApplicationHandlers.length);
// Win7 doesn't have a default mailto: handler, but on other platforms
// alwaysAskBeforeHandling is expected to be false here, because although
// the pref is true, the value in RDF is false. The injected mailto handler
// carried over the default pref value, and so when we set the pref above
// to true it's ignored.
do_check_false(protoInfo.alwaysAskBeforeHandling);
if (isWin7OrHigher)
do_check_true(protoInfo.alwaysAskBeforeHandling);
else
do_check_false(protoInfo.alwaysAskBeforeHandling);
} else {
do_check_eq(0, protoInfo.possibleApplicationHandlers.length);
do_check_true(protoInfo.alwaysAskBeforeHandling);