Bug 1515081 - Fix the cancel search test for the UrlbarController to actually test the cancel. r=mak
authorMark Banner <standard8@mozilla.com>
Wed, 09 Jan 2019 15:11:45 +0000
changeset 510158 5747fe4edb8ab19b37598d76fb7577b4320ade0f
parent 510157 38ba5d0973cd60a8f4126e60fd9b10bac5d7490b
child 510159 068f7beef2c8bf034eb11e4de744644a615ca463
push id10547
push userffxbld-merge
push dateMon, 21 Jan 2019 13:03:58 +0000
treeherdermozilla-beta@24ec1916bffe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmak
bugs1515081
milestone66.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1515081 - Fix the cancel search test for the UrlbarController to actually test the cancel. r=mak Currently, it only passes that test due to awaiting for a non-promise. Differential Revision: https://phabricator.services.mozilla.com/D15817
browser/components/urlbar/tests/unit/head.js
browser/components/urlbar/tests/unit/test_UrlbarController_integration.js
--- a/browser/components/urlbar/tests/unit/head.js
+++ b/browser/components/urlbar/tests/unit/head.js
@@ -82,17 +82,17 @@ function promiseControllerNotification(c
 
 /**
  * A basic test provider, returning all the provided matches.
  */
 class TestProvider extends UrlbarProvider {
   constructor(matches, cancelCallback) {
     super();
     this._name = "TestProvider" + Math.floor(Math.random() * 100000);
-    this._cancel = cancelCallback;
+    this._cancelCallback = cancelCallback;
     this._matches = matches;
   }
   get name() {
     return this._name;
   }
   get type() {
     return UrlbarUtils.PROVIDER_TYPE.PROFILE;
   }
--- a/browser/components/urlbar/tests/unit/test_UrlbarController_integration.js
+++ b/browser/components/urlbar/tests/unit/test_UrlbarController_integration.js
@@ -56,28 +56,28 @@ add_task(async function test_basic_searc
 
   params = await resultsPromise;
 
   Assert.deepEqual(params[0].results, [match],
     "Should have the expected match");
 });
 
 add_task(async function test_cancel_search() {
-  let providerCanceledPromise = PromiseUtils.defer();
-  let providerName = registerBasicTestProvider([match], providerCanceledPromise.resolve);
+  let providerCanceledDeferred = PromiseUtils.defer();
+  let providerName = registerBasicTestProvider([match], providerCanceledDeferred.resolve);
   const context = createContext(TEST_URL, {providers: [providerName]});
 
   let startedPromise = promiseControllerNotification(controller, "onQueryStarted");
-  let cancelPromise = promiseControllerNotification(controller, "onQueryResults");
+  let cancelPromise = promiseControllerNotification(controller, "onQueryCancelled");
 
   await controller.startQuery(context);
 
   let params = await startedPromise;
 
   controller.cancelQuery(context);
 
   Assert.equal(params[0], context);
 
   info("Should tell the provider the query is canceled");
-  await providerCanceledPromise;
+  await providerCanceledDeferred.promise;
 
   params = await cancelPromise;
 });