Bug 663372: Stop loading the discovery page from the network in some tests. r=Unfocused

This commit is contained in:
Dave Townsend 2011-06-15 11:07:55 -07:00
Родитель da0d379ccd
Коммит 22f1817cb9
3 изменённых файлов: 5 добавлений и 8 удалений

Просмотреть файл

@ -6,7 +6,6 @@
* Tests that history navigation works for the add-ons manager.
*/
const PREF_DISCOVERURL = "extensions.webservice.discoverURL";
const MAIN_URL = "https://example.com/" + RELATIVE_DIR + "discovery.html";
const SECOND_URL = "https://example.com/" + RELATIVE_DIR + "releaseNotes.xhtml";
@ -58,9 +57,6 @@ function test() {
waitForExplicitFinish();
Services.prefs.setCharPref(PREF_DISCOVERURL, MAIN_URL);
registerCleanupFunction(function() {
Services.prefs.clearUserPref(PREF_DISCOVERURL);
});
var gProvider = new MockProvider();
gProvider.createAddons([{

Просмотреть файл

@ -5,7 +5,6 @@
// Tests that the discovery view loads properly
const PREF_GETADDONS_CACHE_ENABLED = "extensions.getAddons.cache.enabled";
const PREF_DISCOVERURL = "extensions.webservice.discoverURL";
const MAIN_URL = "https://example.com/" + RELATIVE_DIR + "discovery.html";
var gManagerWindow;
@ -36,15 +35,12 @@ var gProgressListener = {
};
function test() {
var currentURL = Services.prefs.getCharPref(PREF_DISCOVERURL);
// Switch to a known url
Services.prefs.setCharPref(PREF_DISCOVERURL, MAIN_URL);
// Temporarily enable caching
Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, true);
registerCleanupFunction(function() {
Services.prefs.setCharPref(PREF_DISCOVERURL, currentURL);
Services.prefs.setBoolPref(PREF_GETADDONS_CACHE_ENABLED, false);
});

Просмотреть файл

@ -19,6 +19,7 @@ const RELATIVE_DIR = pathParts.slice(4).join("/") + "/";
const TESTROOT = "http://example.com/" + RELATIVE_DIR;
const TESTROOT2 = "http://example.org/" + RELATIVE_DIR;
const CHROMEROOT = pathParts.join("/") + "/";
const PREF_DISCOVERURL = "extensions.webservice.discoverURL";
const MANAGER_URI = "about:addons";
const INSTALL_URI = "chrome://mozapps/content/xpinstall/xpinstallConfirm.xul";
@ -31,6 +32,8 @@ var gTestStart = null;
var gUseInContentUI = !gTestInWindow && ("switchToTabHavingURI" in window);
var gDiscoveryURL = Services.prefs.getCharPref(PREF_DISCOVERURL);
// Turn logging on for all tests
Services.prefs.setBoolPref(PREF_LOGGING_ENABLED, true);
// Turn off remote results in searches
@ -43,6 +46,8 @@ registerCleanupFunction(function() {
catch (e) {
}
Services.prefs.setCharPref(PREF_DISCOVERURL, gDiscoveryURL);
// Throw an error if the add-ons manager window is open anywhere
var windows = Services.wm.getEnumerator("Addons:Manager");
if (windows.hasMoreElements())