Bug 1354681 - Intermittent timeout in browser_ext_omnibox.js. r=mattw draft
authorMarco Bonardo <mbonardo@mozilla.com>
Mon, 10 Apr 2017 12:18:28 +0200
changeset 559676 c9ed9e5a1d32d38a0c2dcaf1c81531692f5d8dfc
parent 559365 45692c884fdd5136a64fb2f8a61a0c8183b69331
child 623461 82a68f65bab9f7e030d4b5977e58505e3db231d5
push id53162
push usermak77@bonardo.net
push dateMon, 10 Apr 2017 10:20:18 +0000
reviewersmattw
bugs1354681
milestone55.0a1
Bug 1354681 - Intermittent timeout in browser_ext_omnibox.js. r=mattw MozReview-Commit-ID: 5gc6IvkMfXt
browser/components/extensions/test/browser/browser_ext_omnibox.js
--- a/browser/components/extensions/test/browser/browser_ext_omnibox.js
+++ b/browser/components/extensions/test/browser/browser_ext_omnibox.js
@@ -95,16 +95,21 @@ add_task(function* () {
 
   function* startInputSession() {
     gURLBar.focus();
     gURLBar.value = keyword;
     EventUtils.synthesizeKey(" ", {});
     yield expectEvent("on-input-started-fired");
     EventUtils.synthesizeKey("t", {});
     yield expectEvent("on-input-changed-fired", {text: "t"});
+    // Wait for the autocomplete search. Note that we cannot wait for the search
+    // to be complete, since the add-on doesn't communicate when it's done, so
+    // just check matches count.
+    yield BrowserTestUtils.waitForCondition(() => gURLBar.controller.matchCount >= 2,
+                                            "waiting urlbar search to complete");
     return "t";
   }
 
   function* testInputEvents() {
     gURLBar.focus();
 
     // Start an input session by typing in <keyword><space>.
     for (let letter of keyword) {
@@ -262,17 +267,16 @@ add_task(function* () {
   });
   yield testSuggestions({
     test: "test-suggestions-after-delay",
     skipHeuristic: true,
     suggestions,
   });
 
   // Start monitoring the console.
-  SimpleTest.waitForExplicitFinish();
   let waitForConsole = new Promise(resolve => {
     SimpleTest.monitorConsole(resolve, [{
       message: new RegExp(`The keyword provided is already registered: "${keyword}"`),
     }]);
   });
 
   // Try registering another extension with the same keyword
   let extension2 = ExtensionTestUtils.loadExtension({