Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 474763: Enable xpinstall test suite and fix switching on/offline.…
Browse files Browse the repository at this point in the history
… r=bsmedberg
  • Loading branch information
Mossop committed Feb 24, 2009
1 parent 416fe38 commit 6051623
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 5 deletions.
6 changes: 3 additions & 3 deletions xpinstall/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 2 additions & 0 deletions xpinstall/tests/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
22 changes: 20 additions & 2 deletions xpinstall/tests/browser_offline.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,33 @@ 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) {
is(status, -210, "Install should be cancelled");
}

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);
Expand Down

0 comments on commit 6051623

Please sign in to comment.