toolkit/components/places/tests/inline/test_queryurl.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/components/places/tests/inline/test_queryurl.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,52 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.6 + * You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +add_autocomplete_test([
     1.9 +  "Searching for host match without slash should match host",
    1.10 +  "file",
    1.11 +  "file.org/",
    1.12 +  function () {
    1.13 +    promiseAddVisits({ uri: NetUtil.newURI("http://file.org/test/"),
    1.14 +                       transition: TRANSITION_TYPED },
    1.15 +                     { uri: NetUtil.newURI("file:///c:/test.html"),
    1.16 +                       transition: TRANSITION_TYPED }
    1.17 +                    );
    1.18 +  },
    1.19 +]);
    1.20 +
    1.21 +add_autocomplete_test([
    1.22 +  "Searching match with slash at the end should do nothing",
    1.23 +  "file.org/",
    1.24 +  "file.org/",
    1.25 +  function () {
    1.26 +    promiseAddVisits({ uri: NetUtil.newURI("http://file.org/test/"),
    1.27 +                       transition: TRANSITION_TYPED },
    1.28 +                     { uri: NetUtil.newURI("file:///c:/test.html"),
    1.29 +                       transition: TRANSITION_TYPED }
    1.30 +                    );
    1.31 +  },
    1.32 +]);
    1.33 +
    1.34 +add_autocomplete_test([
    1.35 +  "Searching match with slash in the middle should match url",
    1.36 +  "file.org/t",
    1.37 +  "file.org/test/",
    1.38 +  function () {
    1.39 +    promiseAddVisits({ uri: NetUtil.newURI("http://file.org/test/"),
    1.40 +                       transition: TRANSITION_TYPED },
    1.41 +                     { uri: NetUtil.newURI("file:///c:/test.html"),
    1.42 +                       transition: TRANSITION_TYPED }
    1.43 +                    );
    1.44 +  },
    1.45 +]);
    1.46 +
    1.47 +add_autocomplete_test([
    1.48 +  "Searching for non-host match without slash should not match url",
    1.49 +  "file",
    1.50 +  "file",
    1.51 +  function () {
    1.52 +    promiseAddVisits({ uri: NetUtil.newURI("file:///c:/test.html"),
    1.53 +                       transition: TRANSITION_TYPED });
    1.54 +  },
    1.55 +]);

mercurial