Bug 993372 - Part 1 - Port inline tests to unified autocomplete. r=mano
authorMarco Bonardo <mbonardo@mozilla.com>
Fri, 18 Jul 2014 09:42:31 +0200
changeset 216819 93d6fa42ff9f7759bf8e67449c607778c0ba6dd3
parent 216818 5350ded95c514e78d1807694529a2434cb2c2597
child 216820 b16a100a246f0f1f267f89f8b1575e09c444fa0e
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmano
bugs993372
milestone33.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 993372 - Part 1 - Port inline tests to unified autocomplete. r=mano
toolkit/components/places/UnifiedComplete.js
toolkit/components/places/tests/moz.build
toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
toolkit/components/places/tests/unifiedcomplete/test_autocomplete_functional.js
toolkit/components/places/tests/unifiedcomplete/test_casing.js
toolkit/components/places/tests/unifiedcomplete/test_do_not_trim.js
toolkit/components/places/tests/unifiedcomplete/test_keywords.js
toolkit/components/places/tests/unifiedcomplete/test_queryurl.js
toolkit/components/places/tests/unifiedcomplete/test_trimming.js
toolkit/components/places/tests/unifiedcomplete/test_typed.js
toolkit/components/places/tests/unifiedcomplete/test_zero_frecency.js
toolkit/components/places/tests/unifiedcomplete/xpcshell.ini
--- a/toolkit/components/places/UnifiedComplete.js
+++ b/toolkit/components/places/UnifiedComplete.js
@@ -14,17 +14,17 @@ const Ci = Components.interfaces;
 const Cr = Components.results;
 const Cu = Components.utils;
 
 const TOPIC_SHUTDOWN = "places-shutdown";
 const TOPIC_PREFCHANGED = "nsPref:changed";
 
 const DEFAULT_BEHAVIOR = 0;
 
-const PREF_BRANCH = "browser.urlbar";
+const PREF_BRANCH = "browser.urlbar.";
 
 // Prefs are defined as [pref name, default value].
 const PREF_ENABLED =            [ "autocomplete.enabled", true ];
 const PREF_AUTOFILL =           [ "autoFill",             true ];
 const PREF_AUTOFILL_TYPED =     [ "autoFill.typed",       true ];
 const PREF_AUTOFILL_PRIORITY =  [ "autoFill.priority",    true ];
 const PREF_DELAY =              [ "delay",                  50 ];
 const PREF_BEHAVIOR =           [ "matchBehavior", MATCH_BOUNDARY_ANYWHERE ];
@@ -182,30 +182,30 @@ const SQL_KEYWORD_QUERY = sql(
   "LEFT JOIN moz_places h ON h.url = search_url",
   "LEFT JOIN moz_favicons f ON f.id = h.favicon_id",
   "LEFT JOIN moz_openpages_temp t ON t.url = search_url",
   "WHERE LOWER(k.keyword) = LOWER(:keyword)",
   "ORDER BY h.frecency DESC");
 
 const SQL_HOST_QUERY = sql(
   "/* do not warn (bug NA): not worth to index on (typed, frecency) */",
-  "SELECT :query_type, host || '/', prefix || host || '/',",
+  "SELECT :query_type, host || '/', IFNULL(prefix, '') || host || '/',",
          "NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, frecency",
   "FROM moz_hosts",
   "WHERE host BETWEEN :searchString AND :searchString || X'FFFF'",
   "AND frecency <> 0",
   "/*CONDITIONS*/",
   "ORDER BY frecency DESC",
   "LIMIT 1");
 
 const SQL_TYPED_HOST_QUERY = SQL_HOST_QUERY.replace("/*CONDITIONS*/",
                                                     "AND typed = 1");
 const SQL_URL_QUERY = sql(
   "/* do not warn (bug no): cannot use an index */",
-  "SELECT :query_type, h.url,",
+  "SELECT :query_type, h.url, NULL,",
          "NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, h.frecency",
   "FROM moz_places h",
   "WHERE h.frecency <> 0",
   "/*CONDITIONS*/",
   "AND AUTOCOMPLETE_MATCH(:searchString, h.url,",
   "h.title, '',",
   "h.visit_count, h.typed, 0, 0,",
   ":matchBehavior, :searchBehavior)",
@@ -435,34 +435,34 @@ function stripPrefix(spec)
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 //// Search Class
 //// Manages a single instance of an autocomplete search.
 
 function Search(searchString, searchParam, autocompleteListener,
                 resultListener, autocompleteSearch) {
-  // We want to store the original string with no leading or trailing
-  // whitespace for case sensitive searches.
-  this._originalSearchString = searchString.trim();
-  this._searchString = fixupSearchText(this._originalSearchString.toLowerCase());
+  // We want to store the original string for case sensitive searches.
+  this._originalSearchString = searchString;
+  this._trimmedOriginalSearchString = searchString.trim();
+  this._searchString = fixupSearchText(this._trimmedOriginalSearchString.toLowerCase());
   this._searchTokens =
     this.filterTokens(getUnfilteredSearchTokens(this._searchString));
   // The protocol and the host are lowercased by nsIURI, so it's fine to
   // lowercase the typed prefix, to add it back to the results later.
-  this._strippedPrefix = this._originalSearchString.slice(
-    0, this._originalSearchString.length - this._searchString.length
+  this._strippedPrefix = this._trimmedOriginalSearchString.slice(
+    0, this._trimmedOriginalSearchString.length - this._searchString.length
   ).toLowerCase();
   // The URIs in the database are fixed-up, so we can match on a lowercased
   // host, but the path must be matched in a case sensitive way.
   let pathIndex =
-    this._originalSearchString.indexOf("/", this._strippedPrefix.length);
+    this._trimmedOriginalSearchString.indexOf("/", this._strippedPrefix.length);
   this._autofillUrlSearchString = fixupSearchText(
-    this._originalSearchString.slice(0, pathIndex).toLowerCase() +
-    this._originalSearchString.slice(pathIndex)
+    this._trimmedOriginalSearchString.slice(0, pathIndex).toLowerCase() +
+    this._trimmedOriginalSearchString.slice(pathIndex)
   );
 
   this._enableActions = searchParam.split(" ").indexOf("enable-actions") != -1;
 
   this._listener = autocompleteListener;
   this._autocompleteSearch = autocompleteSearch;
 
   this._matchBehavior = Prefs.matchBehavior;
@@ -751,17 +751,17 @@ Search.prototype = {
   _processHostRow: function (row) {
     let match = {};
     let trimmedHost = row.getResultByIndex(QUERYINDEX_URL);
     let untrimmedHost = row.getResultByIndex(QUERYINDEX_TITLE);
     let frecency = row.getResultByIndex(QUERYINDEX_FRECENCY);
     // If the untrimmed value doesn't preserve the user's input just
     // ignore it and complete to the found host.
     if (untrimmedHost &&
-        !untrimmedHost.toLowerCase().contains(this._originalSearchString.toLowerCase())) {
+        !untrimmedHost.toLowerCase().contains(this._trimmedOriginalSearchString.toLowerCase())) {
       // THIS CAUSES null TO BE SHOWN AS TITLE.
       untrimmedHost = null;
     }
 
     match.value = this._strippedPrefix + trimmedHost;
     match.comment = trimmedHost;
     match.finalCompleteValue = untrimmedHost;
     match.frecency = frecency;
@@ -786,17 +786,17 @@ Search.prototype = {
       }
       url = url.slice(0, separatorIndex);
     }
 
     // If the untrimmed value doesn't preserve the user's input just
     // ignore it and complete to the found url.
     let untrimmedURL = prefix + url;
     if (untrimmedURL &&
-        !untrimmedURL.toLowerCase().contains(this._originalSearchString.toLowerCase())) {
+        !untrimmedURL.toLowerCase().contains(this._trimmedOriginalSearchString.toLowerCase())) {
       // THIS CAUSES null TO BE SHOWN AS TITLE.
       untrimmedURL = null;
      }
 
     match.value = this._strippedPrefix + url;
     match.comment = url;
     match.finalCompleteValue = untrimmedURL;
     match.frecency = frecency;
@@ -922,17 +922,17 @@ Search.prototype = {
    * Obtains the query to search for keywords.
    *
    * @return an array consisting of the correctly optimized query to search the
    *         database with and an object containing the params to bound.
    */
   get _keywordQuery() {
     // The keyword is the first word in the search string, with the parameters
     // following it.
-    let searchString = this._originalSearchString;
+    let searchString = this._trimmedOriginalSearchString;
     let queryString = "";
     let queryIndex = searchString.indexOf(" ");
     if (queryIndex != -1) {
       queryString = searchString.substring(queryIndex + 1);
     }
     // We need to escape the parameters as if they were the query in a URL
     queryString = encodeURIComponent(queryString).replace("%20", "+", "g");
 
@@ -994,58 +994,58 @@ Search.prototype = {
       return false;
 
     // Then, we should not try to autofill if the behavior is not the default.
     // TODO (bug 751709): Ideally we should have a more fine-grained behavior
     // here, but for now it's enough to just check for default behavior.
     if (Prefs.defaultBehavior != DEFAULT_BEHAVIOR)
       return false;
 
+    // Don't try to autofill if the search term includes any whitespace.
+    // This may confuse completeDefaultIndex cause the AUTOCOMPLETE_MATCH
+    // tokenizer ends up trimming the search string and returning a value
+    // that doesn't match it, or is even shorter.
+    if (/\s/.test(this._originalSearchString)) {
+      return false;
+    }
+
     // Don't autoFill if the search term is recognized as a keyword, otherwise
     // it will override default keywords behavior.  Note that keywords are
     // hashed on first use, so while the first query may delay a little bit,
     // next ones will just hit the memory hash.
     if (this._searchString.length == 0 ||
         PlacesUtils.bookmarks.getURIForKeyword(this._searchString)) {
       return false;
     }
 
-    // Don't try to autofill if the search term includes any whitespace.
-    // This may confuse completeDefaultIndex cause the AUTOCOMPLETE_MATCH
-    // tokenizer ends up trimming the search string and returning a value
-    // that doesn't match it, or is even shorter.
-    if (/\s/.test(this._searchString)) {
-      return false;
-    }
-
     return true;
   },
 
   /**
    * Obtains the query to search for autoFill host results.
    *
    * @return an array consisting of the correctly optimized query to search the
    *         database with and an object containing the params to bound.
    */
   get _hostQuery() [
-    Prefs.autofillTyped ? SQL_TYPED_HOST_QUERY : SQL_TYPED_QUERY,
+    Prefs.autofillTyped ? SQL_TYPED_HOST_QUERY : SQL_HOST_QUERY,
     {
       query_type: QUERYTYPE_AUTOFILL_HOST,
       searchString: this._searchString.toLowerCase()
     }
   ],
 
   /**
    * Obtains the query to search for autoFill url results.
    *
    * @return an array consisting of the correctly optimized query to search the
    *         database with and an object containing the params to bound.
    */
   get _urlQuery() [
-    Prefs.autofillTyped ? SQL_TYPED_HOST_QUERY : SQL_TYPED_QUERY,
+    Prefs.autofillTyped ? SQL_TYPED_URL_QUERY : SQL_URL_QUERY,
     {
       query_type: QUERYTYPE_AUTOFILL_URL,
       searchString: this._autofillUrlSearchString,
       matchBehavior: MATCH_BEGINNING_CASE_SENSITIVE,
       searchBehavior: Ci.mozIPlacesAutoComplete.BEHAVIOR_URL
     }
   ],
 
@@ -1112,17 +1112,18 @@ UnifiedComplete.prototype = {
         // indices.  A larger cache helps reducing IO and improving performance.
         // The value used here is larger than the default Storage value defined
         // as MAX_CACHE_SIZE_BYTES in storage/src/mozStorageConnection.cpp.
         yield conn.execute("PRAGMA cache_size = -6144"); // 6MiB
 
         yield SwitchToTabStorage.initDatabase(conn);
 
         return conn;
-      }.bind(this)).then(null, Cu.reportError);
+      }.bind(this)).then(null, ex => { dump("Couldn't get database handle: " + ex + "\n");
+                                       Cu.reportError(ex); });
     }
     return this._promiseDatabase;
   },
 
   /**
    * Used to stop running queries and close the database handle.
    */
   ensureShutdown: function () {
@@ -1170,17 +1171,18 @@ UnifiedComplete.prototype = {
     }
 
     let search = this._currentSearch;
     this.getDatabaseHandle().then(conn => search.execute(conn))
                             .then(() => {
                               if (search == this._currentSearch) {
                                 this.finishSearch(true);
                               }
-                            }, Cu.reportError);
+                            }, ex => { dump("Query failed: " + ex + "\n");
+                                       Cu.reportError(ex); });
   },
 
   stopSearch: function () {
     if (this._currentSearch) {
       this._currentSearch.cancel();
     }
     this.finishSearch();
   },
--- a/toolkit/components/places/tests/moz.build
+++ b/toolkit/components/places/tests/moz.build
@@ -10,16 +10,17 @@ XPCSHELL_TESTS_MANIFESTS += [
     'autocomplete/xpcshell.ini',
     'bookmarks/xpcshell.ini',
     'expiration/xpcshell.ini',
     'favicons/xpcshell.ini',
     'inline/xpcshell.ini',
     'migration/xpcshell.ini',
     'network/xpcshell.ini',
     'queries/xpcshell.ini',
+    'unifiedcomplete/xpcshell.ini',
     'unit/xpcshell.ini',
     'xpcshell.ini',
 ]
 
 BROWSER_CHROME_MANIFESTS += ['browser/browser.ini']
 MOCHITEST_CHROME_MANIFESTS += [
     'chrome.ini',
     'chrome/chrome.ini',
copy from toolkit/components/places/tests/inline/head_autocomplete.js
copy to toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
--- a/toolkit/components/places/tests/inline/head_autocomplete.js
+++ b/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
@@ -12,185 +12,142 @@ Cu.import("resource://gre/modules/Servic
 // Import common head.
 let (commonFile = do_get_file("../head_common.js", false)) {
   let uri = Services.io.newFileURI(commonFile);
   Services.scriptloader.loadSubScript(uri.spec, this);
 }
 
 // Put any other stuff relative to this test folder below.
 
-XPCOMUtils.defineLazyServiceGetter(this, "gHistory",
-                                   "@mozilla.org/browser/history;1",
-                                   "mozIAsyncHistory");
+function run_test() {
+  run_next_test();
+}
+
+function* cleanup() {
+  Services.prefs.clearUserPref("browser.urlbar.autocomplete.enabled");
+  Services.prefs.clearUserPref("browser.urlbar.autoFill");
+  Services.prefs.clearUserPref("browser.urlbar.autoFill.typed");
+  remove_all_bookmarks();
+  yield promiseClearHistory();
+}
+do_register_cleanup(cleanup);
 
 /**
  * @param aSearches
  *        Array of AutoCompleteSearch names.
  */
 function AutoCompleteInput(aSearches) {
   this.searches = aSearches;
 }
 AutoCompleteInput.prototype = {
-  searches: null,
+  popup: {
+    selectedIndex: -1,
+    invalidate: function () {},
+    QueryInterface: XPCOMUtils.generateQI([Ci.nsIAutoCompletePopup])
+  },
+  popupOpen: false,
+
+  disableAutoComplete: false,
+  completeDefaultIndex: true,
+  completeSelectedIndex: true,
+  forceComplete: false,
+
   minResultsForPopup: 0,
+  maxRows: 0,
+
+  showCommentColumn: false,
+  showImageColumn: false,
+
   timeout: 10,
   searchParam: "",
-  textValue: "",
-  disableAutoComplete: false,
 
-  completeDefaultIndex: true,
-  defaultIndex: 0,
+  get searchCount() {
+    return this.searches.length;
+  },
+  getSearchAt: function(aIndex) {
+    return this.searches[aIndex];
+  },
 
+  textValue: "",
   // Text selection range
   _selStart: 0,
   _selEnd: 0,
   get selectionStart() {
     return this._selStart;
   },
   get selectionEnd() {
     return this._selEnd;
   },
   selectTextRange: function(aStart, aEnd) {
     this._selStart = aStart;
     this._selEnd = aEnd;
   },
 
-  onTextEntered: function() false,
-  onTextReverted: function() false,
-
-  get searchCount() {
-    return this.searches.length;
-  },
-  getSearchAt: function(aIndex) {
-    return this.searches[aIndex];
-  },
-
   onSearchBegin: function () {},
   onSearchComplete: function () {},
 
-  popupOpen: false,
-
-  popup: {
-    selectedIndex: -1,
-    invalidate: function () {},
-
-    QueryInterface: XPCOMUtils.generateQI([Ci.nsIAutoCompletePopup])
-  },
+  onTextEntered: function() false,
+  onTextReverted: function() false,
 
   QueryInterface: XPCOMUtils.generateQI([Ci.nsIAutoCompleteInput])
 }
 
-/**
- * @param aSearchString
- *        String to search.
- * @param aExpectedValue
- *        Expected value returned by autoFill.
- *        May be a string, or an object like
- *        {
- *          autoFilled: the value suggested by autofill,
- *          completed: the value completed on user's confirmation
- *        }
- *        In the latter case this will also check that on user's confirmation
- *        the result's casing is correctly applied.
- */
-function ensure_results(aSearchString, aExpectedValue) {
-  let autoFilledValue, completedValue;
-  if (typeof(aExpectedValue) == "string") {
-    autoFilledValue = aExpectedValue;
-  }
-  else {
-    autoFilledValue = aExpectedValue.autoFilled;
-    completedValue = aExpectedValue.completed;
-  }
+function* check_autocomplete(test) {
+  // At this point frecency could still be updating due to latest pages
+  // updates.
+  // This is not a problem in real life, but autocomplete tests should
+  // return reliable resultsets, thus we have to wait.
+  yield promiseAsyncUpdates();
 
   // Make an AutoCompleteInput that uses our searches and confirms results.
-  let input = new AutoCompleteInput(["urlinline"]);
-  input.textValue = aSearchString;
+  let input = new AutoCompleteInput(["unifiedcomplete"]);
+  input.textValue = test.search;
 
   // Caret must be at the end for autoFill to happen.
-  let strLen = aSearchString.length;
+  let strLen = test.search.length;
   input.selectTextRange(strLen, strLen);
-  do_check_eq(input.selectionStart, strLen);
-  do_check_eq(input.selectionEnd, strLen);
+  Assert.equal(input.selectionStart, strLen, "Selection starts at end");
+  Assert.equal(input.selectionEnd, strLen, "Selection ends at the end");
 
-  let controller = Cc["@mozilla.org/autocomplete/controller;1"].
-                   getService(Ci.nsIAutoCompleteController);
+  let controller = Cc["@mozilla.org/autocomplete/controller;1"]
+                     .getService(Ci.nsIAutoCompleteController);
   controller.input = input;
 
   let numSearchesStarted = 0;
-  input.onSearchBegin = function() {
+  input.onSearchBegin = () => {
+    do_log_info("onSearchBegin received");
     numSearchesStarted++;
-    do_check_eq(numSearchesStarted, 1);
   };
-
-  input.onSearchComplete = function() {
-    // We should be running only one query.
-    do_check_eq(numSearchesStarted, 1);
-
-    // Check the autoFilled result.
-    do_check_eq(input.textValue, autoFilledValue);
+  let deferred = Promise.defer();
+  input.onSearchComplete = () => {
+    do_log_info("onSearchComplete received");
+    deferred.resolve();
+  }
 
-    if (completedValue) {
-      // Now force completion and check correct casing of the result.
-      // This ensures the controller is able to do its magic case-preserving
-      // stuff and correct replacement of the user's casing with result's one.
-      controller.handleEnter(false);
-      do_check_eq(input.textValue, completedValue);
-    }
-
-    waitForCleanup(run_next_test);
-  };
-
-  do_log_info("Searching for: '" + aSearchString + "'");
-  controller.startSearch(aSearchString);
-}
+  do_log_info("Searching for: '" + test.search + "'");
+  controller.startSearch(test.search);
+  yield deferred.promise;
 
-function run_test() {
-  do_register_cleanup(function () {
-    Services.prefs.clearUserPref("browser.urlbar.autocomplete.enabled");
-    Services.prefs.clearUserPref("browser.urlbar.autoFill");
-    Services.prefs.clearUserPref("browser.urlbar.autoFill.typed");
-  });
+  // We should be running only one query.
+  Assert.equal(numSearchesStarted, 1, "Only one search started");
 
-  gAutoCompleteTests.forEach(function (testData) {
-    let [description, searchString, expectedValue, setupFunc] = testData;
-    add_test(function () {
-      do_log_info(description);
-      Services.prefs.setBoolPref("browser.urlbar.autocomplete.enabled", true);
-      Services.prefs.setBoolPref("browser.urlbar.autoFill", true);
-      Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
-
-      if (setupFunc) {
-        setupFunc();
-      }
+  // Check the autoFilled result.
+  Assert.equal(input.textValue, test.autofilled,
+               "Autofilled value is correct");
 
-      // At this point frecency could still be updating due to latest pages
-      // updates.
-      // This is not a problem in real life, but autocomplete tests should
-      // return reliable resultsets, thus we have to wait.
-      promiseAsyncUpdates().then(function () ensure_results(searchString,
-                                                            expectedValue));
-    })
-  }, this);
-
-  run_next_test();
-}
-
-let gAutoCompleteTests = [];
-function add_autocomplete_test(aTestData) {
-  gAutoCompleteTests.push(aTestData);
-}
-
-function waitForCleanup(aCallback) {
-  remove_all_bookmarks();
-  promiseClearHistory().then(aCallback);
+  // Now force completion and check correct casing of the result.
+  // This ensures the controller is able to do its magic case-preserving
+  // stuff and correct replacement of the user's casing with result's one.
+  controller.handleEnter(false);
+  Assert.equal(input.textValue, test.completed,
+               "Completed value is correct");
 }
 
 function addBookmark(aBookmarkObj) {
-  do_check_true(!!aBookmarkObj.url);
+  Assert.ok(!!aBookmarkObj.url, "Bookmark object contains an url");
   let parentId = aBookmarkObj.parentId ? aBookmarkObj.parentId
                                        : PlacesUtils.unfiledBookmarksFolderId;
   let itemId = PlacesUtils.bookmarks
                           .insertBookmark(parentId,
                                           NetUtil.newURI(aBookmarkObj.url),
                                           PlacesUtils.bookmarks.DEFAULT_INDEX,
                                           "A bookmark");
   if (aBookmarkObj.keyword) {
copy from toolkit/components/places/tests/inline/test_autocomplete_functional.js
copy to toolkit/components/places/tests/unifiedcomplete/test_autocomplete_functional.js
--- a/toolkit/components/places/tests/inline/test_autocomplete_functional.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_autocomplete_functional.js
@@ -1,129 +1,147 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // Functional tests for inline autocomplete
 
-add_autocomplete_test([
-  "Check disabling autocomplete disables autofill",
-  "vis",
-  "vis",
-  function ()
-  {
-    Services.prefs.setBoolPref("browser.urlbar.autocomplete.enabled", false);
-    promiseAddVisits({ uri: NetUtil.newURI("http://visit.mozilla.org"),
-                       transition: TRANSITION_TYPED });
-  }
-]);
+add_task(function* test_disabling_autocomplete() {
+  do_log_info("Check disabling autocomplete disables autofill");
+  Services.prefs.setBoolPref("browser.urlbar.autocomplete.enabled", false);
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://visit.mozilla.org"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "vis",
+    autofilled: "vis",
+    completed: "vis"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Check disabling autofill disables autofill",
-  "vis",
-  "vis",
-  function ()
-  {
-    Services.prefs.setBoolPref("browser.urlbar.autoFill", false);
-    promiseAddVisits({ uri: NetUtil.newURI("http://visit.mozilla.org"),
-                       transition: TRANSITION_TYPED });
-  }
-]);
+add_task(function* test_urls_order() {
+  do_log_info("Add urls, check for correct order");
+  let places = [{ uri: NetUtil.newURI("http://visit1.mozilla.org") },
+                { uri: NetUtil.newURI("http://visit2.mozilla.org"),
+                  transition: TRANSITION_TYPED }];
+  yield promiseAddVisits(places);
+  yield check_autocomplete({
+    search: "vis",
+    autofilled: "visit2.mozilla.org/",
+    completed: "visit2.mozilla.org/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Add urls, check for correct order",
-  "vis",
-  "visit2.mozilla.org/",
-  function ()
-  {
-    let places = [{ uri: NetUtil.newURI("http://visit1.mozilla.org") },
-                  { uri: NetUtil.newURI("http://visit2.mozilla.org"),
-                    transition: TRANSITION_TYPED }];
-    promiseAddVisits(places);
-  }
-]);
+add_task(function* test_ignore_prefix() {
+  do_log_info("Add urls, make sure www and http are ignored");
+  Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
+  yield promiseAddVisits(NetUtil.newURI("http://www.visit1.mozilla.org"));
+  yield check_autocomplete({
+    search: "visit1",
+    autofilled: "visit1.mozilla.org/",
+    completed: "visit1.mozilla.org/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Add urls, make sure www and http are ignored",
-  "visit1",
-  "visit1.mozilla.org/",
-  function ()
-  {
-    promiseAddVisits(NetUtil.newURI("http://www.visit1.mozilla.org"));
-  }
-]);
+add_task(function* test_after_host() {
+  do_log_info("Autocompleting after an existing host completes to the url");
+  Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
+  yield promiseAddVisits(NetUtil.newURI("http://www.visit3.mozilla.org"));
+  yield check_autocomplete({
+    search: "visit3.mozilla.org/",
+    autofilled: "visit3.mozilla.org/",
+    completed: "visit3.mozilla.org/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Autocompleting after an existing host completes to the url",
-  "visit3.mozilla.org/",
-  "visit3.mozilla.org/",
-  function ()
-  {
-    promiseAddVisits(NetUtil.newURI("http://www.visit3.mozilla.org"));
-  }
-]);
+add_task(function* test_respect_www() {
+  do_log_info("Searching for www.me should yield www.me.mozilla.org/");
+  Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
+  yield promiseAddVisits(NetUtil.newURI("http://www.me.mozilla.org"));
+  yield check_autocomplete({
+    search: "www.me",
+    autofilled: "www.me.mozilla.org/",
+    completed: "www.me.mozilla.org/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Searching for www.me should yield www.me.mozilla.org/",
-  "www.me",
-  "www.me.mozilla.org/",
-  function ()
-  {
-    promiseAddVisits(NetUtil.newURI("http://www.me.mozilla.org"));
-  }
-]);
+add_task(function* test_bookmark_first() {
+  do_log_info("With a bookmark and history, the query result should be the bookmark");
+  Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
+  addBookmark({ url: "http://bookmark1.mozilla.org/", });
+  yield promiseAddVisits(NetUtil.newURI("http://bookmark1.mozilla.org/foo"));
+  yield check_autocomplete({
+    search: "bookmark",
+    autofilled: "bookmark1.mozilla.org/",
+    completed: "bookmark1.mozilla.org/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "With a bookmark and history, the query result should be the bookmark",
-  "bookmark",
-  "bookmark1.mozilla.org/",
-  function ()
-  {
-    addBookmark({ url: "http://bookmark1.mozilla.org/", });
-    promiseAddVisits(NetUtil.newURI("http://bookmark1.mozilla.org/foo"));
-  }
-]);
-
-add_autocomplete_test([
-  "Check to make sure we get the proper results with full paths",
-  "smokey",
-  "smokey.mozilla.org/",
-  function ()
-  {
+add_task(function* test_full_path() {
+  do_log_info("Check to make sure we get the proper results with full paths");
+  Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
+  let places = [{ uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=delicious") },
+                { uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=smokey") }];
+  yield promiseAddVisits(places);
+  yield check_autocomplete({
+    search: "smokey",
+    autofilled: "smokey.mozilla.org/",
+    completed: "smokey.mozilla.org/"
+  });
+  yield cleanup();
+});
 
-    let places = [{ uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=delicious") },
-                  { uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=smokey") }];
-    promiseAddVisits(places);
-  }
-]);
-
-add_autocomplete_test([
-  "Check to make sure we autocomplete to the following '/'",
-  "smokey.mozilla.org/fo",
-  "smokey.mozilla.org/foo/",
-  function ()
-  {
-
-    let places = [{ uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=delicious") },
-                  { uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=smokey") }];
-    promiseAddVisits(places);
-  }
-]);
+add_task(function* test_complete_to_slash() {
+  do_log_info("Check to make sure we autocomplete to the following '/'");
+  Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
+  let places = [{ uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=delicious") },
+                { uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=smokey") }];
+  yield promiseAddVisits(places);
+  yield check_autocomplete({
+    search: "smokey.mozilla.org/fo",
+    autofilled: "smokey.mozilla.org/foo/",
+    completed: "http://smokey.mozilla.org/foo/",
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Check to make sure we autocomplete after ?",
-  "smokey.mozilla.org/foo?",
-  "smokey.mozilla.org/foo?bacon=delicious",
-  function ()
-  {
-    promiseAddVisits(NetUtil.newURI("http://smokey.mozilla.org/foo?bacon=delicious"));
-  }
-]);
+add_task(function* test_complete_to_slash_with_www() {
+  do_log_info("Check to make sure we autocomplete to the following '/'");
+  Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
+  let places = [{ uri: NetUtil.newURI("http://www.smokey.mozilla.org/foo/bar/baz?bacon=delicious") },
+                { uri: NetUtil.newURI("http://www.smokey.mozilla.org/foo/bar/baz?bacon=smokey") }];
+  yield promiseAddVisits(places);
+  yield check_autocomplete({
+    search: "smokey.mozilla.org/fo",
+    autofilled: "smokey.mozilla.org/foo/",
+    completed: "http://www.smokey.mozilla.org/foo/",
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Check to make sure we autocomplete after #",
-  "smokey.mozilla.org/foo?bacon=delicious#bar",
-  "smokey.mozilla.org/foo?bacon=delicious#bar",
-  function ()
-  {
-    promiseAddVisits(NetUtil.newURI("http://smokey.mozilla.org/foo?bacon=delicious#bar"));
-  }
-]);
+add_task(function* test_complete_querystring() {
+  do_log_info("Check to make sure we autocomplete after ?");
+  Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
+  yield promiseAddVisits(NetUtil.newURI("http://smokey.mozilla.org/foo?bacon=delicious"));
+  yield check_autocomplete({
+    search: "smokey.mozilla.org/foo?",
+    autofilled: "smokey.mozilla.org/foo?bacon=delicious",
+    completed: "http://smokey.mozilla.org/foo?bacon=delicious",
+  });
+  yield cleanup();
+});
+
+add_task(function* test_complete_fragment() {
+  do_log_info("Check to make sure we autocomplete after #");
+  Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
+  yield promiseAddVisits(NetUtil.newURI("http://smokey.mozilla.org/foo?bacon=delicious#bar"));
+  yield check_autocomplete({
+    search: "smokey.mozilla.org/foo?bacon=delicious#bar",
+    autofilled: "smokey.mozilla.org/foo?bacon=delicious#bar",
+    completed: "http://smokey.mozilla.org/foo?bacon=delicious#bar",
+  });
+  yield cleanup();
+});
copy from toolkit/components/places/tests/inline/test_casing.js
copy to toolkit/components/places/tests/unifiedcomplete/test_casing.js
--- a/toolkit/components/places/tests/inline/test_casing.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_casing.js
@@ -1,102 +1,135 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-add_autocomplete_test([
-  "Searching for cased entry 1",
-  "MOZ",
-  { autoFilled: "MOZilla.org/", completed: "mozilla.org/" },
-  function () {
-    addBookmark({ url: "http://mozilla.org/test/" });
-  }
-]);
+add_task(function* test_casing_1() {
+  do_log_info("Searching for cased entry 1");
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "MOZ",
+    autofilled: "MOZilla.org/",
+    completed: "mozilla.org/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Searching for cased entry 2",
-  "mozilla.org/T",
-  { autoFilled: "mozilla.org/T", completed: "mozilla.org/T" },
-  function () {
-    addBookmark({ url: "http://mozilla.org/test/" });
-  }
-]);
+add_task(function* test_casing_2() {
+  do_log_info("Searching for cased entry 2");
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "mozilla.org/T",
+    autofilled: "mozilla.org/T",
+    completed: "mozilla.org/T"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Searching for cased entry 3",
-  "mozilla.org/T",
-  { autoFilled: "mozilla.org/Test/", completed: "http://mozilla.org/Test/" },
-  function () {
-    addBookmark({ url: "http://mozilla.org/Test/" });
-  }
-]);
+add_task(function* test_casing_3() {
+  do_log_info("Searching for cased entry 3");
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "mozilla.org/T",
+    autofilled: "mozilla.org/Test/",
+    completed: "http://mozilla.org/Test/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Searching for cased entry 4",
-  "mOzilla.org/t",
-  { autoFilled: "mOzilla.org/t", completed: "mOzilla.org/t" },
-  function () {
-    addBookmark({ url: "http://mozilla.org/Test/" });
-  },
-]);
+add_task(function* test_casing_4() {
+  do_log_info("Searching for cased entry 4");
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "mOzilla.org/t",
+    autofilled: "mOzilla.org/t",
+    completed: "mOzilla.org/t"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Searching for cased entry 5",
-  "mOzilla.org/T",
-  { autoFilled: "mOzilla.org/Test/", completed: "http://mozilla.org/Test/" },
-  function () {
-    addBookmark({ url: "http://mozilla.org/Test/" });
-  },
-]);
+add_task(function* test_casing_5() {
+  do_log_info("Searching for cased entry 5");
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "mOzilla.org/T",
+    autofilled: "mOzilla.org/Test/",
+    completed: "http://mozilla.org/Test/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Searching for untrimmed cased entry",
-  "http://mOz",
-  { autoFilled: "http://mOzilla.org/", completed: "http://mozilla.org/" },
-  function () {
-    addBookmark({ url: "http://mozilla.org/Test/" });
-  },
-]);
+add_task(function* test_untrimmed_casing() {
+  do_log_info("Searching for untrimmed cased entry");
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "http://mOz",
+    autofilled: "http://mOzilla.org/",
+    completed: "http://mozilla.org/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Searching for untrimmed cased entry with www",
-  "http://www.mOz",
-  { autoFilled: "http://www.mOzilla.org/", completed: "http://www.mozilla.org/" },
-  function () {
-    addBookmark({ url: "http://www.mozilla.org/Test/" });
-  },
-]);
+add_task(function* test_untrimmed_www_casing() {
+  do_log_info("Searching for untrimmed cased entry with www");
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/Test/"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "http://www.mOz",
+    autofilled: "http://www.mOzilla.org/",
+    completed: "http://www.mozilla.org/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Searching for untrimmed cased entry with path",
-  "http://mOzilla.org/t",
-  { autoFilled: "http://mOzilla.org/t", completed: "http://mOzilla.org/t" },
-  function () {
-    addBookmark({ url: "http://mozilla.org/Test/" });
-  },
-]);
+add_task(function* test_untrimmed_path_casing() {
+  do_log_info("Searching for untrimmed cased entry with path");
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "http://mOzilla.org/t",
+    autofilled: "http://mOzilla.org/t",
+    completed: "http://mOzilla.org/t"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Searching for untrimmed cased entry with path 2",
-  "http://mOzilla.org/T",
-  { autoFilled: "http://mOzilla.org/Test/", completed: "http://mozilla.org/Test/" },
-  function () {
-    addBookmark({ url: "http://mozilla.org/Test/" });
-  },
-]);
+add_task(function* test_untrimmed_path_casing_2() {
+  do_log_info("Searching for untrimmed cased entry with path 2");
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/Test/"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "http://mOzilla.org/T",
+    autofilled: "http://mOzilla.org/Test/",
+    completed: "http://mozilla.org/Test/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Searching for untrimmed cased entry with www and path",
-  "http://www.mOzilla.org/t",
-  { autoFilled: "http://www.mOzilla.org/t", completed: "http://www.mOzilla.org/t" },
-  function () {
-    addBookmark({ url: "http://www.mozilla.org/Test/" });
-  },
-]);
+add_task(function* test_untrimmed_path_www_casing() {
+  do_log_info("Searching for untrimmed cased entry with www and path");
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/Test/"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "http://www.mOzilla.org/t",
+    autofilled: "http://www.mOzilla.org/t",
+    completed: "http://www.mOzilla.org/t"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Searching for untrimmed cased entry with www and path 2",
-  "http://www.mOzilla.org/T",
-  { autoFilled: "http://www.mOzilla.org/Test/", completed: "http://www.mozilla.org/Test/" },
-  function () {
-    addBookmark({ url: "http://www.mozilla.org/Test/" });
-  },
-]);
+add_task(function* test_untrimmed_path_www_casing_2() {
+  do_log_info("Searching for untrimmed cased entry with www and path 2");
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/Test/"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "http://www.mOzilla.org/T",
+    autofilled: "http://www.mOzilla.org/Test/",
+    completed: "http://www.mozilla.org/Test/"
+  });
+  yield cleanup();
+});
copy from toolkit/components/places/tests/inline/test_do_not_trim.js
copy to toolkit/components/places/tests/unifiedcomplete/test_do_not_trim.js
--- a/toolkit/components/places/tests/inline/test_do_not_trim.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_do_not_trim.js
@@ -1,67 +1,79 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // Inline should never return matches shorter than the search string, since
 // that largely confuses completeDefaultIndex
 
-add_autocomplete_test([
-  "Do not autofill whitespaced entry 1",
-  "mozilla.org ",
-  "mozilla.org ",
-  function () {
-    promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"),
-                       transition: TRANSITION_TYPED });
-  }
-]);
+add_task(function* test_not_autofill_ws_1() {
+  do_log_info("Do not autofill whitespaced entry 1");
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "mozilla.org ",
+    autofilled: "mozilla.org ",
+    completed: "mozilla.org "
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Do not autofill whitespaced entry 2",
-  "mozilla.org/ ",
-  "mozilla.org/ ",
-  function () {
-    promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"),
-                       transition: TRANSITION_TYPED });
-  }
-]);
+add_task(function* test_not_autofill_ws_2() {
+  do_log_info("Do not autofill whitespaced entry 2");
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "mozilla.org/ ",
+    autofilled: "mozilla.org/ ",
+    completed: "mozilla.org/ "
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Do not autofill whitespaced entry 3",
-  "mozilla.org/link ",
-  "mozilla.org/link ",
-  function () {
-    promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"),
-                       transition: TRANSITION_TYPED });
-  }
-]);
+add_task(function* test_not_autofill_ws_3() {
+  do_log_info("Do not autofill whitespaced entry 3");
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "mozilla.org/link ",
+    autofilled: "mozilla.org/link ",
+    completed: "mozilla.org/link "
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Do not autofill whitespaced entry 4",
-  "mozilla.org/link/ ",
-  "mozilla.org/link/ ",
-  function () {
-    promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"),
-                       transition: TRANSITION_TYPED });
-  }
-]);
+add_task(function* test_not_autofill_ws_4() {
+  do_log_info("Do not autofill whitespaced entry 4");
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "mozilla.org/link/ ",
+    autofilled: "mozilla.org/link/ ",
+    completed: "mozilla.org/link/ "
+  });
+  yield cleanup();
+});
 
 
-add_autocomplete_test([
-  "Do not autofill whitespaced entry 5",
-  "moz illa ",
-  "moz illa ",
-  function () {
-    promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"),
-                       transition: TRANSITION_TYPED });
-  }
-]);
+add_task(function* test_not_autofill_ws_5() {
+  do_log_info("Do not autofill whitespaced entry 5");
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "moz illa ",
+    autofilled: "moz illa ",
+    completed: "moz illa "
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Do not autofill whitespaced entry 6",
-  " mozilla",
-  " mozilla",
-  function () {
-    promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"),
-                       transition: TRANSITION_TYPED });
-  }
-]);
+add_task(function* test_not_autofill_ws_6() {
+  do_log_info("Do not autofill whitespaced entry 6");
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: " mozilla",
+    autofilled: " mozilla",
+    completed: " mozilla"
+  });
+  yield cleanup();
+});
copy from toolkit/components/places/tests/inline/test_keywords.js
copy to toolkit/components/places/tests/unifiedcomplete/test_keywords.js
--- a/toolkit/components/places/tests/inline/test_keywords.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_keywords.js
@@ -1,48 +1,68 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-add_autocomplete_test([
-  "Searching for non-keyworded entry should autoFill it",
-  "moz",
-  "mozilla.org/",
-  function () {
-    addBookmark({ url: "http://mozilla.org/test/" });
-  }
-]);
+add_task(function* test_non_keyword() {
+  do_log_info("Searching for non-keyworded entry should autoFill it");
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"),
+                           transition: TRANSITION_TYPED });
+  addBookmark({ url: "http://mozilla.org/test/" });
+  yield check_autocomplete({
+    search: "moz",
+    autofilled: "mozilla.org/",
+    completed: "mozilla.org/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Searching for keyworded entry should not autoFill it",
-  "moz",
-  "moz",
-  function () {
-    addBookmark({ url: "http://mozilla.org/test/", keyword: "moz" });
-  }
-]);
+add_task(function* test_keyword() {
+  do_log_info("Searching for keyworded entry should not autoFill it");
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"),
+                           transition: TRANSITION_TYPED });
+  addBookmark({ url: "http://mozilla.org/test/", keyword: "moz" });
+  yield check_autocomplete({
+    search: "moz",
+    autofilled: "moz",
+    completed: "moz",
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Searching for more than keyworded entry should autoFill it",
-  "mozi",
-  "mozilla.org/",
-  function () {
-    addBookmark({ url: "http://mozilla.org/test/", keyword: "moz" });
-  }
-]);
+add_task(function* test_more_than_keyword() {
+  do_log_info("Searching for more than keyworded entry should autoFill it");
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"),
+                           transition: TRANSITION_TYPED });
+  addBookmark({ url: "http://mozilla.org/test/", keyword: "moz" });
+  yield check_autocomplete({
+    search: "mozi",
+    autofilled: "mozilla.org/",
+    completed: "mozilla.org/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Searching for less than keyworded entry should autoFill it",
-  "mo",
-  "mozilla.org/",
-  function () {
-    addBookmark({ url: "http://mozilla.org/test/", keyword: "moz" });
-  }
-]);
+add_task(function* test_less_than_keyword() {
+  do_log_info("Searching for less than keyworded entry should autoFill it");
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"),
+                           transition: TRANSITION_TYPED });
+  addBookmark({ url: "http://mozilla.org/test/", keyword: "moz" });
+  yield check_autocomplete({
+    search: "mo",
+    autofilled: "mozilla.org/",
+    completed: "mozilla.org/",
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Searching for keyworded entry is case-insensitive",
-  "MoZ",
-  "MoZ",
-  function () {
-    addBookmark({ url: "http://mozilla.org/test/", keyword: "moz" });
-  }
-]);
+add_task(function* test_keyword_casing() {
+  do_log_info("Searching for keyworded entry is case-insensitive");
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"),
+                           transition: TRANSITION_TYPED });
+  addBookmark({ url: "http://mozilla.org/test/", keyword: "moz" });
+  yield check_autocomplete({
+    search: "MoZ",
+    autofilled: "MoZ",
+    completed: "MoZ"
+  });
+  yield cleanup();
+});
copy from toolkit/components/places/tests/inline/test_queryurl.js
copy to toolkit/components/places/tests/unifiedcomplete/test_queryurl.js
--- a/toolkit/components/places/tests/inline/test_queryurl.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_queryurl.js
@@ -1,52 +1,57 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-add_autocomplete_test([
-  "Searching for host match without slash should match host",
-  "file",
-  "file.org/",
-  function () {
-    promiseAddVisits({ uri: NetUtil.newURI("http://file.org/test/"),
-                       transition: TRANSITION_TYPED },
-                     { uri: NetUtil.newURI("file:///c:/test.html"),
-                       transition: TRANSITION_TYPED }
-                    );
-  },
-]);
+add_task(function* test_no_slash() {
+  do_log_info("Searching for host match without slash should match host");
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://file.org/test/"),
+                           transition: TRANSITION_TYPED },
+                         { uri: NetUtil.newURI("file:///c:/test.html"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "file",
+    autofilled: "file.org/",
+    completed: "file.org/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Searching match with slash at the end should do nothing",
-  "file.org/",
-  "file.org/",
-  function () {
-    promiseAddVisits({ uri: NetUtil.newURI("http://file.org/test/"),
-                       transition: TRANSITION_TYPED },
-                     { uri: NetUtil.newURI("file:///c:/test.html"),
-                       transition: TRANSITION_TYPED }
-                    );
-  },
-]);
+add_task(function* test_w_slash() {
+  do_log_info("Searching match with slash at the end should do nothing");
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://file.org/test/"),
+                          transition: TRANSITION_TYPED },
+                         { uri: NetUtil.newURI("file:///c:/test.html"),
+                          transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "file.org/",
+    autofilled: "file.org/",
+    completed: "file.org/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Searching match with slash in the middle should match url",
-  "file.org/t",
-  "file.org/test/",
-  function () {
-    promiseAddVisits({ uri: NetUtil.newURI("http://file.org/test/"),
-                       transition: TRANSITION_TYPED },
-                     { uri: NetUtil.newURI("file:///c:/test.html"),
-                       transition: TRANSITION_TYPED }
-                    );
-  },
-]);
+add_task(function* test_middle() {
+  do_log_info("Searching match with slash in the middle should match url");
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://file.org/test/"),
+                           transition: TRANSITION_TYPED },
+                         { uri: NetUtil.newURI("file:///c:/test.html"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "file.org/t",
+    autofilled: "file.org/test/",
+    completed: "http://file.org/test/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Searching for non-host match without slash should not match url",
-  "file",
-  "file",
-  function () {
-    promiseAddVisits({ uri: NetUtil.newURI("file:///c:/test.html"),
-                       transition: TRANSITION_TYPED });
-  },
-]);
+add_task(function* test_nonhost() {
+  do_log_info("Searching for non-host match without slash should not match url");
+  yield promiseAddVisits({ uri: NetUtil.newURI("file:///c:/test.html"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "file",
+    autofilled: "file",
+    completed: "file"
+  });
+  yield cleanup();
+});
copy from toolkit/components/places/tests/inline/test_trimming.js
copy to toolkit/components/places/tests/unifiedcomplete/test_trimming.js
--- a/toolkit/components/places/tests/inline/test_trimming.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_trimming.js
@@ -1,249 +1,298 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
-add_autocomplete_test([
-  "Searching for untrimmed https://www entry",
-  "mo",
-  { autoFilled: "mozilla.org/", completed: "https://www.mozilla.org/" },
-  function () {
-    promiseAddVisits({ uri: NetUtil.newURI("https://www.mozilla.org/test/"),
-                       transition: TRANSITION_TYPED });
-  },
-]);
+add_task(function* test_untrimmed_secure_www() {
+  do_log_info("Searching for untrimmed https://www entry");
+  yield promiseAddVisits({ uri: NetUtil.newURI("https://www.mozilla.org/test/"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "mo",
+    autofilled: "mozilla.org/",
+    completed: "https://www.mozilla.org/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Searching for untrimmed https://www entry with path",
-  "mozilla.org/t",
-  { autoFilled: "mozilla.org/test/", completed: "https://www.mozilla.org/test/" },
-  function () {
-    promiseAddVisits({ uri: NetUtil.newURI("https://www.mozilla.org/test/"),
-                       transition: TRANSITION_TYPED });
-  },
-]);
+add_task(function* test_untrimmed_secure_www_path() {
+  do_log_info("Searching for untrimmed https://www entry with path");
+  yield promiseAddVisits({ uri: NetUtil.newURI("https://www.mozilla.org/test/"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "mozilla.org/t",
+    autofilled: "mozilla.org/test/",
+    completed: "https://www.mozilla.org/test/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Searching for untrimmed https:// entry",
-  "mo",
-  { autoFilled: "mozilla.org/", completed: "https://mozilla.org/" },
-  function () {
-    promiseAddVisits({ uri: NetUtil.newURI("https://mozilla.org/test/"),
-                       transition: TRANSITION_TYPED });
-  },
-]);
+add_task(function* test_untrimmed_secure() {
+  do_log_info("Searching for untrimmed https:// entry");
+  yield promiseAddVisits({ uri: NetUtil.newURI("https://mozilla.org/test/"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "mo",
+    autofilled: "mozilla.org/",
+    completed: "https://mozilla.org/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Searching for untrimmed https:// entry with path",
-  "mozilla.org/t",
-  { autoFilled: "mozilla.org/test/", completed: "https://mozilla.org/test/" },
-  function () {
-    promiseAddVisits({ uri: NetUtil.newURI("https://mozilla.org/test/"),
-                       transition: TRANSITION_TYPED });
-  },
-]);
+add_task(function* test_untrimmed_secure_path() {
+  do_log_info("Searching for untrimmed https:// entry with path");
+  yield promiseAddVisits({ uri: NetUtil.newURI("https://mozilla.org/test/"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "mozilla.org/t",
+    autofilled: "mozilla.org/test/",
+    completed: "https://mozilla.org/test/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Searching for untrimmed http://www entry",
-  "mo",
-  { autoFilled: "mozilla.org/", completed: "www.mozilla.org/" },
-  function () {
-    promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/test/"),
-                       transition: TRANSITION_TYPED });
-  },
-]);
+add_task(function* test_untrimmed_www() {
+  do_log_info("Searching for untrimmed http://www entry");
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/test/"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "mo",
+    autofilled: "mozilla.org/",
+    completed: "www.mozilla.org/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Searching for untrimmed http://www entry with path",
-  "mozilla.org/t",
-  { autoFilled: "mozilla.org/test/", completed: "http://www.mozilla.org/test/" },
-  function () {
-    promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/test/"),
-                       transition: TRANSITION_TYPED });
-  },
-]);
+add_task(function* test_untrimmed_www_path() {
+  do_log_info("Searching for untrimmed http://www entry with path");
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/test/"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "mozilla.org/t",
+    autofilled: "mozilla.org/test/",
+    completed: "http://www.mozilla.org/test/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Searching for untrimmed ftp:// entry",
-  "mo",
-  { autoFilled: "mozilla.org/", completed: "ftp://mozilla.org/" },
-  function () {
-    promiseAddVisits({ uri: NetUtil.newURI("ftp://mozilla.org/test/"),
-                       transition: TRANSITION_TYPED });
-  },
-]);
+add_task(function* test_untrimmed_ftp() {
+  do_log_info("Searching for untrimmed ftp:// entry");
+  yield promiseAddVisits({ uri: NetUtil.newURI("ftp://mozilla.org/test/"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "mo",
+    autofilled: "mozilla.org/",
+    completed: "ftp://mozilla.org/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Searching for untrimmed ftp:// entry with path",
-  "mozilla.org/t",
-  { autoFilled: "mozilla.org/test/", completed: "ftp://mozilla.org/test/" },
-  function () {
-    promiseAddVisits({ uri: NetUtil.newURI("ftp://mozilla.org/test/"),
-                       transition: TRANSITION_TYPED });
-  },
-]);
+add_task(function* test_untrimmed_ftp_path() {
+  do_log_info("Searching for untrimmed ftp:// entry with path");
+  yield promiseAddVisits({ uri: NetUtil.newURI("ftp://mozilla.org/test/"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "mozilla.org/t",
+    autofilled: "mozilla.org/test/",
+    completed: "ftp://mozilla.org/test/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Ensuring correct priority 1",
-  "mo",
-  { autoFilled: "mozilla.org/", completed: "mozilla.org/" },
-  function () {
-    promiseAddVisits({ uri: NetUtil.newURI("https://www.mozilla.org/test/"),
-                       transition: TRANSITION_TYPED });
-    promiseAddVisits({ uri: NetUtil.newURI("https://mozilla.org/test/"),
-                       transition: TRANSITION_TYPED });
-    promiseAddVisits({ uri: NetUtil.newURI("ftp://mozilla.org/test/"),
-                       transition: TRANSITION_TYPED });
-    promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/test/"),
-                       transition: TRANSITION_TYPED });
-    promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"),
-                       transition: TRANSITION_TYPED });
-  },
-]);
+add_task(function* test_priority_1() {
+  do_log_info("Ensuring correct priority 1");
+  yield promiseAddVisits([{ uri: NetUtil.newURI("https://www.mozilla.org/test/"),
+                            transition: TRANSITION_TYPED },
+                          { uri: NetUtil.newURI("https://mozilla.org/test/"),
+                            transition: TRANSITION_TYPED },
+                          { uri: NetUtil.newURI("ftp://mozilla.org/test/"),
+                            transition: TRANSITION_TYPED },
+                          { uri: NetUtil.newURI("http://www.mozilla.org/test/"),
+                            transition: TRANSITION_TYPED },
+                          { uri: NetUtil.newURI("http://mozilla.org/test/"),
+                            transition: TRANSITION_TYPED }]);
+  yield check_autocomplete({
+    search: "mo",
+    autofilled: "mozilla.org/",
+    completed: "mozilla.org/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Ensuring correct priority 2",
-  "mo",
-  { autoFilled: "mozilla.org/", completed: "mozilla.org/" },
-  function () {
-    promiseAddVisits({ uri: NetUtil.newURI("https://mozilla.org/test/"),
-                       transition: TRANSITION_TYPED });
-    promiseAddVisits({ uri: NetUtil.newURI("ftp://mozilla.org/test/"),
-                       transition: TRANSITION_TYPED });
-    promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/test/"),
-                       transition: TRANSITION_TYPED });
-    promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"),
-                       transition: TRANSITION_TYPED });
-  },
-]);
+add_task(function* test_periority_2() {
+  do_log_info( "Ensuring correct priority 2");
+  yield promiseAddVisits([{ uri: NetUtil.newURI("https://mozilla.org/test/"),
+                            transition: TRANSITION_TYPED },
+                          { uri: NetUtil.newURI("ftp://mozilla.org/test/"),
+                            transition: TRANSITION_TYPED },
+                          { uri: NetUtil.newURI("http://www.mozilla.org/test/"),
+                            transition: TRANSITION_TYPED },
+                          { uri: NetUtil.newURI("http://mozilla.org/test/"),
+                            transition: TRANSITION_TYPED }]);
+  yield check_autocomplete({
+    search: "mo",
+    autofilled: "mozilla.org/",
+    completed: "mozilla.org/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Ensuring correct priority 3",
-  "mo",
-  { autoFilled: "mozilla.org/", completed: "mozilla.org/" },
-  function () {
-    promiseAddVisits({ uri: NetUtil.newURI("ftp://mozilla.org/test/"),
-                       transition: TRANSITION_TYPED });
-    promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/test/"),
-                       transition: TRANSITION_TYPED });
-    promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"),
-                       transition: TRANSITION_TYPED });
-  },
-]);
+add_task(function* test_periority_3() {
+  do_log_info("Ensuring correct priority 3");
+  yield promiseAddVisits([{ uri: NetUtil.newURI("ftp://mozilla.org/test/"),
+                            transition: TRANSITION_TYPED },
+                          { uri: NetUtil.newURI("http://www.mozilla.org/test/"),
+                            transition: TRANSITION_TYPED },
+                          { uri: NetUtil.newURI("http://mozilla.org/test/"),
+                            transition: TRANSITION_TYPED }]);
+  yield check_autocomplete({
+    search: "mo",
+    autofilled: "mozilla.org/",
+    completed: "mozilla.org/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Ensuring correct priority 4",
-  "mo",
-  { autoFilled: "mozilla.org/", completed: "mozilla.org/" },
-  function () {
-    promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/test/"),
-                       transition: TRANSITION_TYPED });
-    promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/test/"),
-                       transition: TRANSITION_TYPED });
-  },
-]);
+add_task(function* test_periority_4() {
+  do_log_info("Ensuring correct priority 4");
+  yield promiseAddVisits([{ uri: NetUtil.newURI("http://www.mozilla.org/test/"),
+                            transition: TRANSITION_TYPED },
+                          { uri: NetUtil.newURI("http://mozilla.org/test/"),
+                            transition: TRANSITION_TYPED }]);
+  yield check_autocomplete({
+    search: "mo",
+    autofilled: "mozilla.org/",
+    completed: "mozilla.org/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Ensuring correct priority 5",
-  "mo",
-  { autoFilled: "mozilla.org/", completed: "ftp://mozilla.org/" },
-  function () {
-    promiseAddVisits({ uri: NetUtil.newURI("ftp://mozilla.org/test/"),
-                       transition: TRANSITION_TYPED });
-    promiseAddVisits({ uri: NetUtil.newURI("ftp://www.mozilla.org/test/"),
-                       transition: TRANSITION_TYPED });
-  },
-]);
+add_task(function* test_priority_5() {
+  do_log_info("Ensuring correct priority 5");
+  yield promiseAddVisits([{ uri: NetUtil.newURI("ftp://mozilla.org/test/"),
+                            transition: TRANSITION_TYPED },
+                          { uri: NetUtil.newURI("ftp://www.mozilla.org/test/"),
+                            transition: TRANSITION_TYPED }]);
+  yield check_autocomplete({
+    search: "mo",
+    autofilled: "mozilla.org/",
+    completed: "ftp://mozilla.org/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Ensuring correct priority 6",
-  "mo",
-  { autoFilled: "mozilla.org/", completed: "www.mozilla.org/" },
-  function () {
-    promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/test1/"),
-                       transition: TRANSITION_TYPED });
-    promiseAddVisits({ uri: NetUtil.newURI("http://www.mozilla.org/test2/"),
-                       transition: TRANSITION_TYPED });
-  },
-]);
+add_task(function* test_priority_6() {
+  do_log_info("Ensuring correct priority 6");
+  yield promiseAddVisits([{ uri: NetUtil.newURI("http://www.mozilla.org/test1/"),
+                            transition: TRANSITION_TYPED },
+                          { uri: NetUtil.newURI("http://www.mozilla.org/test2/"),
+                            transition: TRANSITION_TYPED }]);
+  yield check_autocomplete({
+    search: "mo",
+    autofilled: "mozilla.org/",
+    completed: "www.mozilla.org/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Ensuring longer domain can't match",
-  "mo",
-  { autoFilled: "mozilla.co/", completed: "mozilla.co/" },
-  function () {
-    // The .co should be preferred, but should not get the https from the .com.
-    // The .co domain must be added later to activate the trigger bug.
-    promiseAddVisits({ uri: NetUtil.newURI("https://mozilla.com/"),
-                       transition: TRANSITION_TYPED });
-    promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.co/"),
-                       transition: TRANSITION_TYPED });
-    promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.co/"),
-                       transition: TRANSITION_TYPED });
-  },
-]);
+add_task(function* test_longer_domain() {
+  do_log_info("Ensuring longer domain can't match");
+  // The .co should be preferred, but should not get the https from the .com.
+  // The .co domain must be added later to activate the trigger bug.
+  yield promiseAddVisits([{ uri: NetUtil.newURI("https://mozilla.com/"),
+                            transition: TRANSITION_TYPED },
+                          { uri: NetUtil.newURI("http://mozilla.co/"),
+                            transition: TRANSITION_TYPED },
+                          { uri: NetUtil.newURI("http://mozilla.co/"),
+                            transition: TRANSITION_TYPED }]);
+  yield check_autocomplete({
+    search: "mo",
+    autofilled: "mozilla.co/",
+    completed: "mozilla.co/"
+  });
+
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Searching for URL with characters that are normally escaped",
-  "https://www.mozilla.org/啊-test",
-  { autoFilled: "https://www.mozilla.org/啊-test", completed: "https://www.mozilla.org/啊-test" },
-  function () {
-    promiseAddVisits({ uri: NetUtil.newURI("https://www.mozilla.org/啊-test"),
-                       transition: TRANSITION_TYPED });
-  },
-]);
+add_task(function* test_escaped_chars() {
+  do_log_info("Searching for URL with characters that are normally escaped");
+  yield promiseAddVisits({ uri: NetUtil.newURI("https://www.mozilla.org/啊-test"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "https://www.mozilla.org/啊-test",
+    autofilled: "https://www.mozilla.org/啊-test",
+    completed: "https://www.mozilla.org/啊-test"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Don't return unsecure URL when searching for secure ones",
-  "https://test.moz.org/t",
-  { autoFilled: "https://test.moz.org/test/", completed: "https://test.moz.org/test/" },
-  function () {
-    promiseAddVisits({ uri: NetUtil.newURI("http://test.moz.org/test/"),
-                       transition: TRANSITION_TYPED });
-  },
-]);
+add_task(function* test_unsecure_secure() {
+  do_log_info("Don't return unsecure URL when searching for secure ones");
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://test.moz.org/test/"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "https://test.moz.org/t",
+    autofilled: "https://test.moz.org/test/",
+    completed: "https://test.moz.org/test/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Don't return unsecure domain when searching for secure ones",
-  "https://test.moz",
-  { autoFilled: "https://test.moz.org/", completed: "https://test.moz.org/" },
-  function () {
-    promiseAddVisits({ uri: NetUtil.newURI("http://test.moz.org/test/"),
-                       transition: TRANSITION_TYPED });
-  },
-]);
+add_task(function* test_unsecure_secure_domain() {
+  do_log_info("Don't return unsecure domain when searching for secure ones");
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://test.moz.org/test/"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "https://test.moz",
+    autofilled: "https://test.moz.org/",
+    completed: "https://test.moz.org/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Untyped is not accounted for www",
-  "mo",
-  { autoFilled: "moz.org/", completed: "moz.org/" },
-  function () {
-    promiseAddVisits({ uri: NetUtil.newURI("http://www.moz.org/test/") });
-  },
-]);
+add_task(function* test_untyped_www() {
+  do_log_info("Untyped is not accounted for www");
+  Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://www.moz.org/test/") });
+  yield check_autocomplete({
+    search: "mo",
+    autofilled: "moz.org/",
+    completed: "moz.org/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Untyped is not accounted for ftp",
-  "mo",
-  { autoFilled: "moz.org/", completed: "moz.org/" },
-  function () {
-    promiseAddVisits({ uri: NetUtil.newURI("ftp://moz.org/test/") });
-  },
-]);
+add_task(function* test_untyped_ftp() {
+  do_log_info("Untyped is not accounted for ftp");
+  Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
+  yield promiseAddVisits({ uri: NetUtil.newURI("ftp://moz.org/test/") });
+  yield check_autocomplete({
+    search: "mo",
+    autofilled: "moz.org/",
+    completed: "moz.org/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Untyped is not accounted for https",
-  "mo",
-  { autoFilled: "moz.org/", completed: "moz.org/" },
-  function () {
-    promiseAddVisits({ uri: NetUtil.newURI("https://moz.org/test/") });
-  },
-]);
+add_task(function* test_untyped_secure() {
+  do_log_info("Untyped is not accounted for https");
+  Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
+  yield promiseAddVisits({ uri: NetUtil.newURI("https://moz.org/test/") });
+  yield check_autocomplete({
+    search: "mo",
+    autofilled: "moz.org/",
+    completed: "moz.org/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Untyped is not accounted for https://www",
-  "mo",
-  { autoFilled: "moz.org/", completed: "moz.org/" },
-  function () {
-    promiseAddVisits({ uri: NetUtil.newURI("https://www.moz.org/test/") });
-  },
-]);
+add_task(function* test_untyped_secure_www() {
+  do_log_info("Untyped is not accounted for https://www");
+  Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
+  yield promiseAddVisits({ uri: NetUtil.newURI("https://www.moz.org/test/") });
+  yield check_autocomplete({
+    search: "mo",
+    autofilled: "moz.org/",
+    completed: "moz.org/"
+  });
+  yield cleanup();
+});
copy from toolkit/components/places/tests/inline/test_typed.js
copy to toolkit/components/places/tests/unifiedcomplete/test_typed.js
--- a/toolkit/components/places/tests/inline/test_typed.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_typed.js
@@ -1,70 +1,78 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // First do searches with typed behavior forced to false, so later tests will
 // ensure autocomplete is able to dinamically switch behavior.
 
-add_autocomplete_test([
-  "Searching for domain should autoFill it",
-  "moz",
-  "mozilla.org/",
-  function () {
-    Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
-    promiseAddVisits(NetUtil.newURI("http://mozilla.org/link/"));
-  }
-]);
+add_task(function* test_domain() {
+  do_log_info("Searching for domain should autoFill it");
+  Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
+  yield promiseAddVisits(NetUtil.newURI("http://mozilla.org/link/"));
+  yield check_autocomplete({
+    search: "moz",
+    autofilled: "mozilla.org/",
+    completed:  "mozilla.org/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Searching for url should autoFill it",
-  "mozilla.org/li",
-  "mozilla.org/link/",
-  function () {
-    Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
-    promiseAddVisits(NetUtil.newURI("http://mozilla.org/link/"));
-  }
-]);
+add_task(function* test_url() {
+  do_log_info("Searching for url should autoFill it");
+  Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
+  yield promiseAddVisits(NetUtil.newURI("http://mozilla.org/link/"));
+  yield check_autocomplete({
+    search: "mozilla.org/li",
+    autofilled: "mozilla.org/link/",
+    completed: "http://mozilla.org/link/"
+  });
+  yield cleanup();
+});
 
 // Now do searches with typed behavior forced to true.
 
-add_autocomplete_test([
-  "Searching for non-typed domain should not autoFill it",
-  "moz",
-  "moz",
-  function () {
-    Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", true);
-    promiseAddVisits(NetUtil.newURI("http://mozilla.org/link/"));
-  }
-]);
+add_task(function* test_untyped_domain() {
+  do_log_info("Searching for non-typed domain should not autoFill it");
+  yield promiseAddVisits(NetUtil.newURI("http://mozilla.org/link/"));
+  yield check_autocomplete({
+    search: "moz",
+    autofilled: "moz",
+    completed: "moz"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Searching for typed domain should autoFill it",
-  "moz",
-  "mozilla.org/",
-  function () {
-    Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", true);
-    promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/typed/"),
-                       transition: TRANSITION_TYPED });
-  }
-]);
+add_task(function* test_typed_domain() {
+  do_log_info("Searching for typed domain should autoFill it");
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/typed/"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "moz",
+    autofilled: "mozilla.org/",
+    completed: "mozilla.org/"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Searching for non-typed url should not autoFill it",
-  "mozilla.org/li",
-  "mozilla.org/li",
-  function () {
-    Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", true);
-    promiseAddVisits(NetUtil.newURI("http://mozilla.org/link/"));
-  }
-]);
+add_task(function* test_untyped_url() {
+  do_log_info("Searching for non-typed url should not autoFill it");
+  yield promiseAddVisits(NetUtil.newURI("http://mozilla.org/link/"));
+  yield check_autocomplete({
+    search: "mozilla.org/li",
+    autofilled: "mozilla.org/li",
+    completed: "mozilla.org/li"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Searching for typed url should autoFill it",
-  "mozilla.org/li",
-  "mozilla.org/link/",
-  function () {
-    Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", true);
-    promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"),
-                       transition: TRANSITION_TYPED });
-  }
-]);
+add_task(function* test_typed_url() {
+  do_log_info("Searching for typed url should autoFill it");
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/link/"),
+                           transition: TRANSITION_TYPED });
+  yield check_autocomplete({
+    search: "mozilla.org/li",
+    autofilled: "mozilla.org/link/",
+    completed: "http://mozilla.org/link/"
+  });
+  yield cleanup();
+});
copy from toolkit/components/places/tests/inline/test_zero_frecency.js
copy to toolkit/components/places/tests/unifiedcomplete/test_zero_frecency.js
--- a/toolkit/components/places/tests/inline/test_zero_frecency.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_zero_frecency.js
@@ -1,27 +1,31 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // Ensure inline autocomplete doesn't return zero frecency pages.
 
-add_autocomplete_test([
-  "Searching for zero frecency domain should not autoFill it",
-  "moz",
-  "moz",
-  function () {
-    Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
-    promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/framed_link/"),
-                       transition: TRANSITION_FRAMED_LINK });
-  }
-]);
+add_task(function* test_zzero_frec_domain() {
+  do_log_info("Searching for zero frecency domain should not autoFill it");
+  Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/framed_link/"),
+                           transition: TRANSITION_FRAMED_LINK });
+  yield check_autocomplete({
+    search: "moz",
+    autofilled: "moz",
+    completed:  "moz"
+  });
+  yield cleanup();
+});
 
-add_autocomplete_test([
-  "Searching for zero frecency url should not autoFill it",
-  "mozilla.org/f",
-  "mozilla.org/f",
-  function () {
-    Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
-    promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/framed_link/"),
-                       transition: TRANSITION_FRAMED_LINK });
-  }
-]);
+add_task(function* test_zzero_frec_url() {
+  do_log_info("Searching for zero frecency url should not autoFill it");
+  Services.prefs.setBoolPref("browser.urlbar.autoFill.typed", false);
+  yield promiseAddVisits({ uri: NetUtil.newURI("http://mozilla.org/framed_link/"),
+                           transition: TRANSITION_FRAMED_LINK });
+  yield check_autocomplete({
+    search: "mozilla.org/f",
+    autofilled: "mozilla.org/f",
+    completed:  "mozilla.org/f"
+  });
+  yield cleanup();
+});
copy from toolkit/components/places/tests/inline/xpcshell.ini
copy to toolkit/components/places/tests/unifiedcomplete/xpcshell.ini