Bug 474763: Enable xpinstall test suite and fix switching on/offline. r=bsmedberg

This commit is contained in:
Dave Townsend 2009-02-24 13:12:54 -08:00
parent 9cc610fb58
commit fb7c98b73e
3 changed files with 25 additions and 5 deletions

View File

@ -50,8 +50,8 @@ include $(DEPTH)/config/autoconf.mk
MODULE = xpinstall
DIRS = public src
#ifdef ENABLE_TESTS
#DIRS += tests
#endif
ifdef ENABLE_TESTS
DIRS += tests
endif
include $(topsrcdir)/config/rules.mk

View File

@ -80,6 +80,8 @@ _BROWSER_FILES = harness.js \
browser_offline.js \
browser_chrome.js \
browser_cancel.js \
browser_navigateaway.js \
browser_navigateaway2.js \
unsigned.xpi \
signed.xpi \
signed2.xpi \

View File

@ -23,7 +23,17 @@ function test() {
}
function download_progress(addon, value, maxValue) {
BrowserOffline.toggleOfflineStatus();
var prefs = Components.classes["@mozilla.org/preferences;1"]
.getService(Components.interfaces.nsIPrefBranch);
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService2);
try {
ioService.manageOfflineStatus = false;
prefs.setBoolPref("browser.offline", true);
ioService.offline = true;
} catch (ex) {
}
}
function check_xpi_install(addon, status) {
@ -31,7 +41,15 @@ function check_xpi_install(addon, status) {
}
function finish_test() {
BrowserOffline.toggleOfflineStatus();
var prefs = Components.classes["@mozilla.org/preferences;1"]
.getService(Components.interfaces.nsIPrefBranch);
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
.getService(Components.interfaces.nsIIOService2);
try {
prefs.setBoolPref("browser.offline", false);
ioService.offline = false;
} catch (ex) {
}
var pm = Components.classes["@mozilla.org/permissionmanager;1"]
.getService(Components.interfaces.nsIPermissionManager);