From 22f1817cb9e4c30ce58cc9c0f8140fc33f75cba3 Mon Sep 17 00:00:00 2001 From: Dave Townsend Date: Wed, 15 Jun 2011 11:07:55 -0700 Subject: [PATCH] Bug 663372: Stop loading the discovery page from the network in some tests. r=Unfocused --- toolkit/mozapps/extensions/test/browser/browser_bug562797.js | 4 ---- toolkit/mozapps/extensions/test/browser/browser_discovery.js | 4 ---- toolkit/mozapps/extensions/test/browser/head.js | 5 +++++ 3 files changed, 5 insertions(+), 8 deletions(-) diff --git a/toolkit/mozapps/extensions/test/browser/browser_bug562797.js b/toolkit/mozapps/extensions/test/browser/browser_bug562797.js index a866dfa2e07c..c75a363bc4f3 100644 --- a/toolkit/mozapps/extensions/test/browser/browser_bug562797.js +++ b/toolkit/mozapps/extensions/test/browser/browser_bug562797.js @@ -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([{ diff --git a/toolkit/mozapps/extensions/test/browser/browser_discovery.js b/toolkit/mozapps/extensions/test/browser/browser_discovery.js index f67b8189a3df..670c28facb0a 100644 --- a/toolkit/mozapps/extensions/test/browser/browser_discovery.js +++ b/toolkit/mozapps/extensions/test/browser/browser_discovery.js @@ -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); }); diff --git a/toolkit/mozapps/extensions/test/browser/head.js b/toolkit/mozapps/extensions/test/browser/head.js index ceb3249d0b8c..b64f69c10e4e 100644 --- a/toolkit/mozapps/extensions/test/browser/head.js +++ b/toolkit/mozapps/extensions/test/browser/head.js @@ -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())