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

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Mark Banner 2019-01-09 15:11:45 +00:00
Родитель 865c90cc75
Коммит a290cfc473
2 изменённых файлов: 5 добавлений и 5 удалений

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

@ -87,7 +87,7 @@ 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() {

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

@ -61,12 +61,12 @@ add_task(async function test_basic_search() {
});
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);
@ -77,7 +77,7 @@ add_task(async function test_cancel_search() {
Assert.equal(params[0], context);
info("Should tell the provider the query is canceled");
await providerCanceledPromise;
await providerCanceledDeferred.promise;
params = await cancelPromise;
});