tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

test_providerPlaces_nonEnglish.js (1255B)


      1 /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
      2 /* vim:set ts=2 sw=2 sts=2 et: */
      3 /* This Source Code Form is subject to the terms of the Mozilla Public
      4 * License, v. 2.0. If a copy of the MPL was not distributed with this
      5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      6 
      7 /*
      8 
      9 Test autocomplete for non-English URLs
     10 
     11 - add a visit for a page with a non-English URL
     12 - search
     13 - test number of matches (should be exactly one)
     14 
     15 */
     16 
     17 testEngine_setup();
     18 
     19 add_task(async function test_autocomplete_non_english() {
     20  Services.prefs.setBoolPref("browser.urlbar.suggest.searches", false);
     21  registerCleanupFunction(() => {
     22    Services.prefs.clearUserPref("browser.urlbar.suggest.searches");
     23  });
     24 
     25  let searchTerm = "ユニコード";
     26  let unescaped = "http://www.foobar.com/" + searchTerm + "/";
     27  let uri = Services.io.newURI(unescaped);
     28  await PlacesTestUtils.addVisits(uri);
     29  let context = createContext(searchTerm, { isPrivate: false });
     30  await check_results({
     31    context,
     32    matches: [
     33      makeSearchResult(context, {
     34        engineName: SUGGESTIONS_ENGINE_NAME,
     35        heuristic: true,
     36      }),
     37      makeVisitResult(context, {
     38        uri: uri.spec,
     39        title: `test visit for ${uri.spec}`,
     40      }),
     41    ],
     42  });
     43 });