Bug 1532170 - Bustage fix for test_ext_settings_overrides_shutdown.js - wait for settings to complete before shutdown. r+a=bustage-fix
authorMark Banner <standard8@mozilla.com>
Tue, 23 Apr 2019 20:57:02 +0100
changeset 523308 acf5db7c3d0c67b6a32723b893145cb4d99a57dc
parent 523307 c53e3fd7696496c92cc74ac23c361c33d883f735
child 523309 98899972b4b3dbf39e1cafad74c0538c68067db9
push id11139
push usermbanner@mozilla.com
push dateTue, 23 Apr 2019 19:57:35 +0000
treeherdermozilla-beta@acf5db7c3d0c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1532170
milestone67.0
Bug 1532170 - Bustage fix for test_ext_settings_overrides_shutdown.js - wait for settings to complete before shutdown. r+a=bustage-fix
browser/components/extensions/test/xpcshell/test_ext_settings_overrides_shutdown.js
--- a/browser/components/extensions/test/xpcshell/test_ext_settings_overrides_shutdown.js
+++ b/browser/components/extensions/test/xpcshell/test_ext_settings_overrides_shutdown.js
@@ -1,23 +1,26 @@
 /* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
 /* vim: set sts=2 sw=2 et tw=80: */
 
 "use strict";
 
 const {AddonTestUtils} = ChromeUtils.import("resource://testing-common/AddonTestUtils.jsm");
+const {SearchTestUtils} = ChromeUtils.import("resource://testing-common/SearchTestUtils.jsm");
 // Lazily import ExtensionParent to allow AddonTestUtils.createAppInfo to
 // override Services.appinfo.
 ChromeUtils.defineModuleGetter(this, "ExtensionParent",
                                "resource://gre/modules/ExtensionParent.jsm");
 
 AddonTestUtils.init(this);
 AddonTestUtils.overrideCertDB();
 AddonTestUtils.createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "42", "42");
 
+Services.prefs.setBoolPref("browser.search.log", true);
+
 add_task(async function shutdown_during_search_provider_startup() {
   await AddonTestUtils.promiseStartupManager();
 
   let extension = ExtensionTestUtils.loadExtension({
     useAddonManager: "permanent",
     manifest: {
       chrome_settings_overrides: {
         search_provider: {
@@ -71,25 +74,29 @@ add_task(async function shutdown_during_
 
   let uninstalledPromise = extension.addon.uninstall();
   let uninstalled = false;
   uninstalledPromise.then(() => { uninstalled = true; });
 
   await uninstallingPromise;
   Assert.ok(!uninstalled, "Uninstall should not be finished yet");
   Assert.ok(!initialized, "Search service should still be uninitialized");
+  let searchSettingsUpdatePromise = SearchTestUtils.promiseSearchNotification("settings-update-complete");
+
   await Services.search.init();
   Assert.ok(initialized, "Search service should be initialized");
 
   // After initializing the search service, the search provider registration
   // promises should settle eventually.
 
   // Despite the interrupted startup, the promise should still resolve without
   // an error.
   await extStartPromise;
   // The extension that is still active. The promise should just resolve.
   await extRestartPromise;
 
   // After initializing the search service, uninstall should eventually finish.
   await uninstalledPromise;
 
+  await searchSettingsUpdatePromise;
+
   await AddonTestUtils.promiseShutdownManager();
 });