Bug 1492475 - Part 9: Update unit tests to stop using 'currentEngine', in favor of 'defaultEngine'. r=Standard8
authorMike de Boer <mdeboer@mozilla.com>
Fri, 09 Nov 2018 11:27:50 +0100
changeset 452871 6c79eaf1d349638258d542ced0229d786f022683
parent 452870 c44e674e160ebab49ea5ba1ed5821bb8d3c30e53
child 452872 21b3aa17ee43dd0efd3c08564bbc7d747d4628b9
push id2
push usermdeboer@mozilla.com
push dateTue, 08 Jan 2019 17:01:21 +0000
reviewersStandard8
bugs1492475
milestone66.0a1
Bug 1492475 - Part 9: Update unit tests to stop using 'currentEngine', in favor of 'defaultEngine'. r=Standard8 Differential Revision: https://phabricator.services.mozilla.com/D11482
browser/base/content/test/urlbar/browser_autocomplete_a11y_label.js
browser/base/content/test/urlbar/browser_canonizeURL.js
browser/base/content/test/urlbar/browser_urlbarOneOffs_searchSuggestions.js
browser/base/content/test/urlbar/browser_urlbarSearchSuggestions.js
browser/base/content/test/urlbar/browser_urlbarSearchSuggestions_opt-out.js
browser/base/content/test/urlbar/browser_urlbarSearchTelemetry.js
browser/base/content/test/urlbar/browser_urlbarStopSearchOnSelection.js
browser/base/content/test/urlbar/browser_urlbar_search_speculative_connect_engine.js
browser/components/extensions/test/browser/browser_ext_webNavigation_urlbar_transitions.js
browser/components/newtab/test/unit/unit-entry.js
browser/components/search/test/browser/browser_426329.js
browser/components/search/test/browser/browser_addEngine.js
browser/components/search/test/browser/browser_contextmenu.js
browser/components/search/test/browser/browser_hiddenOneOffs_diacritics.js
browser/components/search/test/browser/browser_oneOffContextMenu_setDefault.js
browser/modules/test/browser/browser_ContentSearch.js
toolkit/components/places/tests/unifiedcomplete/test_search_suggestions.js
toolkit/components/search/tests/xpcshell/test_currentEngine_fallback.js
toolkit/components/search/tests/xpcshell/test_defaultEngine.js
toolkit/components/search/tests/xpcshell/test_notifications.js
toolkit/components/search/tests/xpcshell/test_selectedEngine.js
--- a/browser/base/content/test/urlbar/browser_autocomplete_a11y_label.js
+++ b/browser/base/content/test/urlbar/browser_autocomplete_a11y_label.js
@@ -16,23 +16,23 @@ add_task(async function switchToTab() {
   gURLBar.popup.hidePopup();
   await promisePopupHidden(gURLBar.popup);
   gBrowser.removeTab(tab);
 });
 
 add_task(async function searchSuggestions() {
   let engine = await SearchTestUtils.promiseNewSearchEngine(
     getRootDirectory(gTestPath) + TEST_ENGINE_BASENAME);
-  let oldCurrentEngine = Services.search.defaultEngine;
+  let oldDefaultEngine = Services.search.defaultEngine;
   Services.search.defaultEngine = engine;
   Services.prefs.setBoolPref(SUGGEST_ALL_PREF, true);
   let suggestionsEnabled = Services.prefs.getBoolPref(SUGGEST_URLBAR_PREF);
   Services.prefs.setBoolPref(SUGGEST_URLBAR_PREF, true);
   registerCleanupFunction(function() {
-    Services.search.defaultEngine = oldCurrentEngine;
+    Services.search.defaultEngine = oldDefaultEngine;
     Services.prefs.clearUserPref(SUGGEST_ALL_PREF);
     Services.prefs.setBoolPref(SUGGEST_URLBAR_PREF, suggestionsEnabled);
   });
 
   await promiseAutocompleteResultPopup("foo");
   await waitForAutocompleteResultAt(2);
   // Don't assume that the search doesn't match history or bookmarks left around
   // by earlier tests.
--- a/browser/base/content/test/urlbar/browser_canonizeURL.js
+++ b/browser/base/content/test/urlbar/browser_canonizeURL.js
@@ -39,19 +39,19 @@ add_task(async function checkCtrlWorks()
     await promiseLoad;
   }
 });
 
 add_task(async function checkPrefTurnsOffCanonize() {
   // Add a dummy search engine to avoid hitting the network.
   let engine = await SearchTestUtils.promiseNewSearchEngine(
     getRootDirectory(gTestPath) + TEST_ENGINE_BASENAME);
-  let oldCurrentEngine = Services.search.defaultEngine;
+  let oldDefaultEngine = Services.search.defaultEngine;
   Services.search.defaultEngine = engine;
-  registerCleanupFunction(() => { Services.search.defaultEngine = oldCurrentEngine; });
+  registerCleanupFunction(() => { Services.search.defaultEngine = oldDefaultEngine; });
 
   let tabsToClose = [];
   // Ensure we don't end up loading something in the current tab becuase it's empty:
   if (gBrowser.selectedTab.isEmpty) {
     tabsToClose.push(await BrowserTestUtils.openNewForegroundTab({gBrowser, opening: "about:mozilla"}));
   }
   let initialTabURL = gBrowser.selectedBrowser.currentURI.spec;
   let initialTab = gBrowser.selectedTab;
--- a/browser/base/content/test/urlbar/browser_urlbarOneOffs_searchSuggestions.js
+++ b/browser/base/content/test/urlbar/browser_urlbarOneOffs_searchSuggestions.js
@@ -3,21 +3,21 @@ const TEST_ENGINE_BASENAME = "searchSugg
 add_task(async function init() {
   await PlacesUtils.history.clear();
   await SpecialPowers.pushPrefEnv({
     set: [["browser.urlbar.oneOffSearches", true],
           ["browser.urlbar.suggest.searches", true]],
   });
   let engine = await SearchTestUtils.promiseNewSearchEngine(
     getRootDirectory(gTestPath) + TEST_ENGINE_BASENAME);
-  let oldCurrentEngine = Services.search.defaultEngine;
+  let oldDefaultEngine = Services.search.defaultEngine;
   Services.search.moveEngine(engine, 0);
   Services.search.defaultEngine = engine;
   registerCleanupFunction(async function() {
-    Services.search.defaultEngine = oldCurrentEngine;
+    Services.search.defaultEngine = oldDefaultEngine;
 
     await PlacesUtils.history.clear();
     // Make sure the popup is closed for the next test.
     gURLBar.blur();
     Assert.ok(!gURLBar.popup.popupOpen, "popup should be closed");
   });
 });
 
--- a/browser/base/content/test/urlbar/browser_urlbarSearchSuggestions.js
+++ b/browser/base/content/test/urlbar/browser_urlbarSearchSuggestions.js
@@ -2,21 +2,21 @@ const SUGGEST_URLBAR_PREF = "browser.url
 const TEST_ENGINE_BASENAME = "searchSuggestionEngine.xml";
 
 // Must run first.
 add_task(async function prepare() {
   let suggestionsEnabled = Services.prefs.getBoolPref(SUGGEST_URLBAR_PREF);
   Services.prefs.setBoolPref(SUGGEST_URLBAR_PREF, true);
   let engine = await SearchTestUtils.promiseNewSearchEngine(
     getRootDirectory(gTestPath) + TEST_ENGINE_BASENAME);
-  let oldCurrentEngine = Services.search.defaultEngine;
+  let oldDefaultEngine = Services.search.defaultEngine;
   Services.search.defaultEngine = engine;
   registerCleanupFunction(async function() {
     Services.prefs.setBoolPref(SUGGEST_URLBAR_PREF, suggestionsEnabled);
-    Services.search.defaultEngine = oldCurrentEngine;
+    Services.search.defaultEngine = oldDefaultEngine;
 
     // Clicking suggestions causes visits to search results pages, so clear that
     // history now.
     await PlacesUtils.history.clear();
 
     // Make sure the popup is closed for the next test.
     gURLBar.blur();
     Assert.ok(!gURLBar.popup.popupOpen, "popup should be closed");
--- a/browser/base/content/test/urlbar/browser_urlbarSearchSuggestions_opt-out.js
+++ b/browser/base/content/test/urlbar/browser_urlbarSearchSuggestions_opt-out.js
@@ -9,29 +9,29 @@ const CHOICE_PREF = "browser.urlbar.user
 const TIMES_PREF = "browser.urlbar.timesBeforeHidingSuggestionsHint";
 const TEST_ENGINE_BASENAME = "searchSuggestionEngine.xml";
 const ONEOFF_PREF = "browser.urlbar.oneOffSearches";
 const NO_RESULTS_TIMEOUT_MS = 500;
 
 add_task(async function prepare() {
   let engine = await SearchTestUtils.promiseNewSearchEngine(
     getRootDirectory(gTestPath) + TEST_ENGINE_BASENAME);
-  let oldCurrentEngine = Services.search.defaultEngine;
+  let oldDefaultEngine = Services.search.defaultEngine;
   Services.search.defaultEngine = engine;
   let suggestionsEnabled = Services.prefs.getBoolPref(SUGGEST_URLBAR_PREF);
   let defaults = Services.prefs.getDefaultBranch("browser.urlbar.");
   let searchSuggestionsDefault = defaults.getBoolPref("suggest.searches");
   defaults.setBoolPref("suggest.searches", true);
   let suggestionsChoice = Services.prefs.getBoolPref(CHOICE_PREF);
   Services.prefs.setBoolPref(CHOICE_PREF, false);
   let oneOffs = Services.prefs.getBoolPref(ONEOFF_PREF);
   Services.prefs.setBoolPref(ONEOFF_PREF, true);
   registerCleanupFunction(async function() {
     defaults.setBoolPref("suggest.searches", searchSuggestionsDefault);
-    Services.search.defaultEngine = oldCurrentEngine;
+    Services.search.defaultEngine = oldDefaultEngine;
     Services.prefs.clearUserPref(SUGGEST_ALL_PREF);
     Services.prefs.setBoolPref(SUGGEST_URLBAR_PREF, suggestionsEnabled);
     Services.prefs.setBoolPref(CHOICE_PREF, suggestionsChoice);
     Services.prefs.setBoolPref(ONEOFF_PREF, oneOffs);
     // Make sure the popup is closed for the next test.
     gURLBar.blur();
     Assert.ok(!gURLBar.popup.popupOpen, "popup should be closed");
   });
--- a/browser/base/content/test/urlbar/browser_urlbarSearchTelemetry.js
+++ b/browser/base/content/test/urlbar/browser_urlbarSearchTelemetry.js
@@ -4,22 +4,22 @@ const SUGGEST_URLBAR_PREF = "browser.url
 const TEST_ENGINE_BASENAME = "searchSuggestionEngine.xml";
 
 // Must run first.
 add_task(async function prepare() {
   let suggestionsEnabled = Services.prefs.getBoolPref(SUGGEST_URLBAR_PREF);
   Services.prefs.setBoolPref(SUGGEST_URLBAR_PREF, true);
   let engine = await SearchTestUtils.promiseNewSearchEngine(
     getRootDirectory(gTestPath) + TEST_ENGINE_BASENAME);
-  let oldCurrentEngine = Services.search.defaultEngine;
+  let oldDefaultEngine = Services.search.defaultEngine;
   Services.search.defaultEngine = engine;
 
   registerCleanupFunction(async function() {
     Services.prefs.setBoolPref(SUGGEST_URLBAR_PREF, suggestionsEnabled);
-    Services.search.defaultEngine = oldCurrentEngine;
+    Services.search.defaultEngine = oldDefaultEngine;
 
     // Clicking urlbar results causes visits to their associated pages, so clear
     // that history now.
     await PlacesUtils.history.clear();
 
     // Make sure the popup is closed for the next test.
     gURLBar.blur();
     Assert.ok(!gURLBar.popup.popupOpen, "popup should be closed");
--- a/browser/base/content/test/urlbar/browser_urlbarStopSearchOnSelection.js
+++ b/browser/base/content/test/urlbar/browser_urlbarStopSearchOnSelection.js
@@ -16,21 +16,21 @@ const TEST_ENGINE_NUM_EXPECTED_RESULTS =
 add_task(async function init() {
   await PlacesUtils.history.clear();
   await SpecialPowers.pushPrefEnv({
     set: [["browser.urlbar.suggest.searches", true]],
   });
   // Add a test search engine that returns suggestions on a delay.
   let engine = await SearchTestUtils.promiseNewSearchEngine(
     getRootDirectory(gTestPath) + TEST_ENGINE_BASENAME);
-  let oldCurrentEngine = Services.search.defaultEngine;
+  let oldDefaultEngine = Services.search.defaultEngine;
   Services.search.moveEngine(engine, 0);
   Services.search.defaultEngine = engine;
   registerCleanupFunction(async () => {
-    Services.search.defaultEngine = oldCurrentEngine;
+    Services.search.defaultEngine = oldDefaultEngine;
     await PlacesUtils.history.clear();
     // Make sure the popup is closed for the next test.
     gURLBar.blur();
     Assert.ok(!gURLBar.popup.popupOpen, "popup should be closed");
   });
 });
 
 add_task(async function mainTest() {
--- a/browser/base/content/test/urlbar/browser_urlbar_search_speculative_connect_engine.js
+++ b/browser/base/content/test/urlbar/browser_urlbar_search_speculative_connect_engine.js
@@ -26,22 +26,22 @@ add_task(async function setup() {
           ["network.http.speculative-parallel-limit", 6],
           // The http server is using IPv4, so it's better to disable IPv6 to avoid weird
           // networking problem.
           ["network.dns.disableIPv6", true]],
   });
 
   let engine = await SearchTestUtils.promiseNewSearchEngine(
     getRootDirectory(gTestPath) + TEST_ENGINE_BASENAME);
-  let oldCurrentEngine = Services.search.defaultEngine;
+  let oldDefaultEngine = Services.search.defaultEngine;
   Services.search.defaultEngine = engine;
 
   registerCleanupFunction(async function() {
     await PlacesUtils.history.clear();
-    Services.search.defaultEngine = oldCurrentEngine;
+    Services.search.defaultEngine = oldDefaultEngine;
     gHttpServer.identity.remove(gScheme, gHost, gPort);
     gHttpServer.stop(() => {
       gHttpServer = null;
     });
   });
 });
 
 add_task(async function connect_search_engine_tests() {
--- a/browser/components/extensions/test/browser/browser_ext_webNavigation_urlbar_transitions.js
+++ b/browser/components/extensions/test/browser/browser_ext_webNavigation_urlbar_transitions.js
@@ -52,25 +52,25 @@ function addSearchEngine(basename) {
         ok(false, `addEngine failed with error code ${errCode}`);
         reject();
       },
     });
   });
 }
 
 async function prepareSearchEngine() {
-  let oldCurrentEngine = Services.search.defaultEngine;
+  let oldDefaultEngine = Services.search.defaultEngine;
   let suggestionsEnabled = Services.prefs.getBoolPref(SUGGEST_URLBAR_PREF);
   Services.prefs.setBoolPref(SUGGEST_URLBAR_PREF, true);
   let engine = await addSearchEngine(TEST_ENGINE_BASENAME);
   Services.search.defaultEngine = engine;
 
   registerCleanupFunction(async function() {
     Services.prefs.setBoolPref(SUGGEST_URLBAR_PREF, suggestionsEnabled);
-    Services.search.defaultEngine = oldCurrentEngine;
+    Services.search.defaultEngine = oldDefaultEngine;
 
     // Make sure the popup is closed for the next test.
     gURLBar.blur();
     gURLBar.popup.selectedIndex = -1;
     gURLBar.popup.hidePopup();
     ok(!gURLBar.popup.popupOpen, "popup should be closed");
 
     // Clicking suggestions causes visits to search results pages, so clear that
--- a/browser/components/newtab/test/unit/unit-entry.js
+++ b/browser/components/newtab/test/unit/unit-entry.js
@@ -221,17 +221,16 @@ const TEST_GLOBAL = {
         }),
         spec,
       }),
     },
     search: {
       init(cb) { cb(); },
       getVisibleEngines: () => [{identifier: "google"}, {identifier: "bing"}],
       defaultEngine: {identifier: "google", searchForm: "https://www.google.com/search?q=&ie=utf-8&oe=utf-8&client=firefox-b"},
-      currentEngine: {identifier: "google", searchForm: "https://www.google.com/search?q=&ie=utf-8&oe=utf-8&client=firefox-b"},
     },
     scriptSecurityManager: {
       createNullPrincipal() {},
       getSystemPrincipal() {},
     },
     wm: {getMostRecentWindow: () => window, getEnumerator: () => []},
     ww: {registerNotification() {}, unregisterNotification() {}},
     appinfo: {appBuildID: "20180710100040"},
--- a/browser/components/search/test/browser/browser_426329.js
+++ b/browser/components/search/test/browser/browser_426329.js
@@ -63,17 +63,17 @@ function promiseSetEngine() {
     function observer(aSub, aTopic, aData) {
       switch (aData) {
         case "engine-added":
           let engine = ss.getEngineByName("Bug 426329");
           ok(engine, "Engine was added.");
           ss.defaultEngine = engine;
           break;
         case "engine-current":
-          ok(ss.defaultEngine.name == "Bug 426329", "currentEngine set");
+          ok(ss.defaultEngine.name == "Bug 426329", "defaultEngine set");
           searchBar = BrowserSearch.searchBar;
           searchButton = searchBar.querySelector(".search-go-button");
           ok(searchButton, "got search-go-button");
           searchBar.value = "test";
 
           Services.obs.removeObserver(observer, "browser-search-engine-modified");
           resolve();
           break;
--- a/browser/components/search/test/browser/browser_addEngine.js
+++ b/browser/components/search/test/browser/browser_addEngine.js
@@ -62,32 +62,32 @@ var gTests = [
       is(engine, engineFromSS, "engine is obtainable via getEngineByName");
 
       let aEngine = gSS.getEngineByAlias("fooalias");
       ok(!aEngine, "Alias was not parsed from engine description");
 
       gSS.defaultEngine = engine;
     },
     current(engine) {
-      let currentEngine = gSS.defaultEngine;
-      is(engine, currentEngine, "engine is current");
+      let defaultEngine = gSS.defaultEngine;
+      is(engine, defaultEngine, "engine is current");
       is(engine.name, this.engine.name, "current engine was changed successfully");
 
       gSS.removeEngine(engine);
     },
     removed(engine) {
-      // Remove the observer before calling the currentEngine getter,
-      // as that getter will set the currentEngine to the original default
+      // Remove the observer before calling the defaultEngine getter,
+      // as that getter will set the defaultEngine to the original default
       // which will trigger a notification causing the test to loop over all
       // engines.
       Services.obs.removeObserver(observer, "browser-search-engine-modified");
 
-      let currentEngine = gSS.defaultEngine;
-      ok(currentEngine, "An engine is present.");
-      isnot(currentEngine.name, this.engine.name, "Current engine reset after removal");
+      let defaultEngine = gSS.defaultEngine;
+      ok(defaultEngine, "An engine is present.");
+      isnot(defaultEngine.name, this.engine.name, "Current engine reset after removal");
 
       nextTest();
     },
   },
 ];
 
 var gCurrentTest = null;
 function nextTest() {
--- a/browser/components/search/test/browser/browser_contextmenu.js
+++ b/browser/components/search/test/browser/browser_contextmenu.js
@@ -30,17 +30,17 @@ add_task(async function() {
         case "engine-added":
           let engine = ss.getEngineByName(ENGINE_NAME);
           ok(engine, "Engine was added.");
           ss.defaultEngine = engine;
           envService.set("XPCSHELL_TEST_PROFILE_DIR", originalValue);
           resProt.setSubstitution("search-plugins", originalSubstitution);
           break;
         case "engine-current":
-          is(ss.defaultEngine.name, ENGINE_NAME, "currentEngine set");
+          is(ss.defaultEngine.name, ENGINE_NAME, "defaultEngine set");
           resolve();
           break;
         case "engine-removed":
           Services.obs.removeObserver(observer, "browser-search-engine-modified");
           if (searchDonePromise) {
             searchDonePromise();
           }
           break;
--- a/browser/components/search/test/browser/browser_hiddenOneOffs_diacritics.js
+++ b/browser/components/search/test/browser/browser_hiddenOneOffs_diacritics.js
@@ -14,20 +14,20 @@ let searchIcon;
 
 add_task(async function init() {
   let searchbar = await gCUITestUtils.addSearchBar();
   registerCleanupFunction(() => {
     gCUITestUtils.removeSearchBar();
   });
   searchIcon = searchbar.querySelector(".searchbar-search-button");
 
-  let currentEngine = Services.search.defaultEngine;
+  let defaultEngine = Services.search.defaultEngine;
   await promiseNewEngine("testEngine_diacritics.xml", {setAsCurrent: false});
   registerCleanupFunction(() => {
-    Services.search.defaultEngine = currentEngine;
+    Services.search.defaultEngine = defaultEngine;
     Services.prefs.clearUserPref("browser.search.hiddenOneOffs");
   });
 });
 
 add_task(async function test_hidden() {
   Preferences.set("browser.search.hiddenOneOffs", diacritic_engine);
 
   let promise = promiseEvent(searchPopup, "popupshown");
--- a/browser/components/search/test/browser/browser_oneOffContextMenu_setDefault.js
+++ b/browser/components/search/test/browser/browser_oneOffContextMenu_setDefault.js
@@ -39,17 +39,17 @@ add_task(async function test_searchBarCh
                                                        searchOneOff,
                                                        SEARCHBAR_BASE_ID);
 
   const setDefaultEngineMenuItem = searchOneOff.querySelector(
     ".search-one-offs-context-set-default"
   );
 
   // Click the set default engine menu item.
-  let promise = promiseCurrentEngineChanged();
+  let promise = promisedefaultEngineChanged();
   EventUtils.synthesizeMouseAtCenter(setDefaultEngineMenuItem, {});
 
   // This also checks the engine correctly changed.
   await promise;
 
   Assert.equal(oneOffButton.id, SEARCHBAR_BASE_ID + originalEngine.name,
                "Should now have the original engine's id for the button");
   Assert.equal(oneOffButton.getAttribute("tooltiptext"), originalEngine.name,
@@ -73,46 +73,46 @@ add_task(async function test_urlBarChang
                                                        urlBarOneOff,
                                                        URLBAR_BASE_ID);
 
   const setDefaultEngineMenuItem = urlBarOneOff.querySelector(
     ".search-one-offs-context-set-default"
   );
 
   // Click the set default engine menu item.
-  let promise = promiseCurrentEngineChanged();
+  let promise = promisedefaultEngineChanged();
   EventUtils.synthesizeMouseAtCenter(setDefaultEngineMenuItem, {});
 
   // This also checks the engine correctly changed.
   await promise;
 
-  let currentEngine = Services.search.defaultEngine;
+  let defaultEngine = Services.search.defaultEngine;
 
   // For the urlbar, we should keep the new engine's icon.
-  Assert.equal(oneOffButton.id, URLBAR_BASE_ID + currentEngine.name,
+  Assert.equal(oneOffButton.id, URLBAR_BASE_ID + defaultEngine.name,
                "Should now have the original engine's id for the button");
-  Assert.equal(oneOffButton.getAttribute("tooltiptext"), currentEngine.name,
+  Assert.equal(oneOffButton.getAttribute("tooltiptext"), defaultEngine.name,
                "Should now have the original engine's name for the tooltip");
-  Assert.equal(oneOffButton.image, currentEngine.iconURI.spec,
+  Assert.equal(oneOffButton.image, defaultEngine.iconURI.spec,
                "Should now have the original engine's uri for the image");
 
   await promiseClosePopup(urlbarPopup);
 });
 
 /**
  * Promises that an engine change has happened for the current engine, which
  * has resulted in the test engine now being the current engine.
  *
  * @returns {Promise} Resolved once the test engine is set as the current engine.
  */
-function promiseCurrentEngineChanged() {
+function promisedefaultEngineChanged() {
   return new Promise(resolve => {
     function observer(aSub, aTopic, aData) {
       if (aData == "engine-current") {
-        Assert.equal(Services.search.defaultEngine.name, TEST_ENGINE_NAME, "currentEngine set");
+        Assert.equal(Services.search.defaultEngine.name, TEST_ENGINE_NAME, "defaultEngine set");
         Services.obs.removeObserver(observer, "browser-search-engine-modified");
         resolve();
       }
     }
 
     Services.obs.addObserver(observer, "browser-search-engine-modified");
   });
 }
--- a/browser/modules/test/browser/browser_ContentSearch.js
+++ b/browser/modules/test/browser/browser_ContentSearch.js
@@ -35,59 +35,59 @@ add_task(async function GetState() {
   });
   let msg = await waitForTestMsg(mm, "State");
   checkMsg(msg, {
     type: "State",
     data: await currentStateObj(),
   });
 });
 
-add_task(async function SetCurrentEngine() {
+add_task(async function SetDefaultEngine() {
   let { mm } = await addTab();
-  let newCurrentEngine = null;
-  let oldCurrentEngine = Services.search.defaultEngine;
+  let newDefaultEngine = null;
+  let oldDefaultEngine = Services.search.defaultEngine;
   let engines = Services.search.getVisibleEngines();
   for (let engine of engines) {
-    if (engine != oldCurrentEngine) {
-      newCurrentEngine = engine;
+    if (engine != oldDefaultEngine) {
+      newDefaultEngine = engine;
       break;
     }
   }
-  if (!newCurrentEngine) {
+  if (!newDefaultEngine) {
     info("Couldn't find a non-selected search engine, " +
          "skipping this part of the test");
     return;
   }
   mm.sendAsyncMessage(TEST_MSG, {
     type: "SetCurrentEngine",
-    data: newCurrentEngine.name,
+    data: newDefaultEngine.name,
   });
   let deferred = PromiseUtils.defer();
   Services.obs.addObserver(function obs(subj, topic, data) {
     info("Test observed " + data);
     if (data == "engine-current") {
       ok(true, "Test observed engine-current");
       Services.obs.removeObserver(obs, "browser-search-engine-modified");
       deferred.resolve();
     }
   }, "browser-search-engine-modified");
   let searchPromise = waitForTestMsg(mm, "CurrentEngine");
   info("Waiting for test to observe engine-current...");
   await deferred.promise;
   let msg = await searchPromise;
   checkMsg(msg, {
     type: "CurrentEngine",
-    data: await currentEngineObj(newCurrentEngine),
+    data: await defaultEngineObj(newDefaultEngine),
   });
 
-  Services.search.defaultEngine = oldCurrentEngine;
+  Services.search.defaultEngine = oldDefaultEngine;
   msg = await waitForTestMsg(mm, "CurrentEngine");
   checkMsg(msg, {
     type: "CurrentEngine",
-    data: await currentEngineObj(oldCurrentEngine),
+    data: await defaultEngineObj(oldDefaultEngine),
   });
 });
 
 add_task(async function modifyEngine() {
   let { mm } = await addTab();
   let engine = Services.search.defaultEngine;
   let oldAlias = engine.alias;
   engine.alias = "ContentSearchTest";
@@ -357,31 +357,31 @@ async function addTab() {
   let mm = tab.linkedBrowser.messageManager;
   mm.loadFrameScript(url, false);
   return { browser: tab.linkedBrowser, mm };
 }
 
 var currentStateObj = async function() {
   let state = {
     engines: [],
-    currentEngine: await currentEngineObj(),
+    currentEngine: await defaultEngineObj(),
   };
   for (let engine of Services.search.getVisibleEngines()) {
     let uri = engine.getIconURLBySize(16, 16);
     state.engines.push({
       name: engine.name,
       iconBuffer: await arrayBufferFromDataURI(uri),
       hidden: false,
       identifier: engine.identifier,
     });
   }
   return state;
 };
 
-var currentEngineObj = async function() {
+var defaultEngineObj = async function() {
   let engine = Services.search.defaultEngine;
   let uriFavicon = engine.getIconURLBySize(16, 16);
   let bundle = Services.strings.createBundle("chrome://global/locale/autocomplete.properties");
   return {
     name: engine.name,
     placeholder: bundle.formatStringFromName("searchWithEngine", [engine.name], 1),
     iconBuffer: await arrayBufferFromDataURI(uriFavicon),
   };
--- a/toolkit/components/places/tests/unifiedcomplete/test_search_suggestions.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_search_suggestions.js
@@ -30,18 +30,18 @@ add_task(async function setup() {
     return suggestionsFn(searchStr);
   });
   setSuggestionsFn(searchStr => {
     let suffixes = ["foo", "bar"];
     return [searchStr].concat(suffixes.map(s => searchStr + " " + s));
   });
 
   // Install the test engine.
-  let oldCurrentEngine = Services.search.defaultEngine;
-  registerCleanupFunction(() => Services.search.defaultEngine = oldCurrentEngine);
+  let oldDefaultEngine = Services.search.defaultEngine;
+  registerCleanupFunction(() => Services.search.defaultEngine = oldDefaultEngine);
   Services.search.defaultEngine = engine;
 
   // We must make sure the FormHistoryStartup component is initialized.
   Cc["@mozilla.org/satchel/form-history-startup;1"]
     .getService(Ci.nsIObserver)
     .observe(null, "profile-after-change", null);
   await updateSearchHistory("bump", "hello Fred!");
   await updateSearchHistory("bump", "hello Barney!");
--- a/toolkit/components/search/tests/xpcshell/test_currentEngine_fallback.js
+++ b/toolkit/components/search/tests/xpcshell/test_currentEngine_fallback.js
@@ -1,25 +1,25 @@
 /* Any copyright is dedicated to the Public Domain.
    http://creativecommons.org/publicdomain/zero/1.0/ */
 
 function run_test() {
   Assert.ok(Services.search.getVisibleEngines().length > 1);
   Assert.ok(Services.search.isInitialized);
 
   // Remove the current engine...
-  let currentEngine = Services.search.defaultEngine;
-  Services.search.removeEngine(currentEngine);
+  let defaultEngine = Services.search.defaultEngine;
+  Services.search.removeEngine(defaultEngine);
 
   // ... and verify a new current engine has been set.
-  Assert.notEqual(Services.search.defaultEngine.name, currentEngine.name);
-  Assert.ok(currentEngine.hidden);
+  Assert.notEqual(Services.search.defaultEngine.name, defaultEngine.name);
+  Assert.ok(defaultEngine.hidden);
 
   // Remove all the other engines.
   Services.search.getVisibleEngines().forEach(Services.search.removeEngine);
   Assert.equal(Services.search.getVisibleEngines().length, 0);
 
   // Verify the original default engine is used as a fallback and no
   // longer hidden.
-  Assert.equal(Services.search.defaultEngine.name, currentEngine.name);
-  Assert.ok(!currentEngine.hidden);
+  Assert.equal(Services.search.defaultEngine.name, defaultEngine.name);
+  Assert.ok(!defaultEngine.hidden);
   Assert.equal(Services.search.getVisibleEngines().length, 1);
 }
--- a/toolkit/components/search/tests/xpcshell/test_defaultEngine.js
+++ b/toolkit/components/search/tests/xpcshell/test_defaultEngine.js
@@ -1,14 +1,14 @@
 /* Any copyright is dedicated to the Public Domain.
- *    http://creativecommons.org/publicdomain/zero/1.0/ */
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
 
 /*
- * Test that currentEngine and defaultEngine properties can be set and yield the
- * proper events and behavior (search results)
+ * Test that defaultEngine property can be set and yields the proper events and\
+ * behavior (search results)
  */
 
 "use strict";
 
 function run_test() {
   useHttpServer();
 
   run_next_test();
--- a/toolkit/components/search/tests/xpcshell/test_notifications.js
+++ b/toolkit/components/search/tests/xpcshell/test_notifications.js
@@ -5,18 +5,18 @@
 
 var gTestLog = [];
 
 /**
  * The order of notifications expected for this test is:
  *  - engine-changed (while we're installing the engine, we modify it, which notifies - bug 606886)
  *  - engine-added (engine was added to the store by the search service)
  *   -> our search observer is called, which sets:
- *    - .defaultEngine, triggering engine-default
- *    - .currentEngine, triggering engine-current (after bug 493051 - for now the search service sets this after engine-added)
+ *    - .defaultEngine, triggering engine-default and engine-current (after bug
+ *      493051 - for now the search service sets this after engine-added)
  *   ...and then schedules a removal
  *  - engine-loaded (the search service's observer is garanteed to fire first, which is what causes engine-added to fire)
  *  - engine-removed (due to the removal schedule above)
  */
 var expectedLog = [
   "engine-changed", // XXX bug 606886
   "engine-added",
   "engine-default",
@@ -31,17 +31,16 @@ function search_observer(subject, topic,
 
   info("Observer: " + data + " for " + engine.name);
 
   switch (data) {
     case "engine-added":
       let retrievedEngine = Services.search.getEngineByName("Test search engine");
       Assert.equal(engine, retrievedEngine);
       Services.search.defaultEngine = engine;
-      Services.search.defaultEngine = engine;
       executeSoon(function() {
         Services.search.removeEngine(engine);
       });
       break;
     case "engine-removed":
       let engineNameOutput = " for Test search engine";
       expectedLog = expectedLog.map(logLine => logLine + engineNameOutput);
       info("expectedLog:\n" + expectedLog.join("\n"));
--- a/toolkit/components/search/tests/xpcshell/test_selectedEngine.js
+++ b/toolkit/components/search/tests/xpcshell/test_selectedEngine.js
@@ -121,28 +121,28 @@ add_task(async function test_fallback_ke
   await promiseAfterCache();
 
   // Remove that engine...
   Services.search.removeEngine(nonDefaultBuiltInEngine);
   // The engine being a default (built-in) one, it should be hidden
   // rather than actually removed.
   Assert.ok(nonDefaultBuiltInEngine.hidden);
 
-  // Using the currentEngine getter should force a fallback to the
+  // Using the defaultEngine getter should force a fallback to the
   // original default engine.
   Assert.equal(Services.search.defaultEngine.name, defaultName);
 
   // Restoring the default engines should unhide our built-in test
-  // engine, but not change the value of currentEngine.
+  // engine, but not change the value of defaultEngine.
   Services.search.restoreDefaultEngines();
   Assert.ok(!nonDefaultBuiltInEngine.hidden);
   Assert.equal(Services.search.defaultEngine.name, defaultName);
   await promiseAfterCache();
 
-  // After a restart, the currentEngine value should still be unchanged.
+  // After a restart, the defaultEngine value should still be unchanged.
   await asyncReInit();
   Assert.equal(Services.search.defaultEngine.name, defaultName);
 });
 
 
 function run_test() {
   Assert.ok(!Services.search.isInitialized);