1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/components/places/tests/inline/test_autocomplete_functional.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,129 @@ 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 +// Functional tests for inline autocomplete 1.9 + 1.10 +add_autocomplete_test([ 1.11 + "Check disabling autocomplete disables autofill", 1.12 + "vis", 1.13 + "vis", 1.14 + function () 1.15 + { 1.16 + Services.prefs.setBoolPref("browser.urlbar.autocomplete.enabled", false); 1.17 + promiseAddVisits({ uri: NetUtil.newURI("http://visit.mozilla.org"), 1.18 + transition: TRANSITION_TYPED }); 1.19 + } 1.20 +]); 1.21 + 1.22 +add_autocomplete_test([ 1.23 + "Check disabling autofill disables autofill", 1.24 + "vis", 1.25 + "vis", 1.26 + function () 1.27 + { 1.28 + Services.prefs.setBoolPref("browser.urlbar.autoFill", false); 1.29 + promiseAddVisits({ uri: NetUtil.newURI("http://visit.mozilla.org"), 1.30 + transition: TRANSITION_TYPED }); 1.31 + } 1.32 +]); 1.33 + 1.34 +add_autocomplete_test([ 1.35 + "Add urls, check for correct order", 1.36 + "vis", 1.37 + "visit2.mozilla.org/", 1.38 + function () 1.39 + { 1.40 + let places = [{ uri: NetUtil.newURI("http://visit1.mozilla.org") }, 1.41 + { uri: NetUtil.newURI("http://visit2.mozilla.org"), 1.42 + transition: TRANSITION_TYPED }]; 1.43 + promiseAddVisits(places); 1.44 + } 1.45 +]); 1.46 + 1.47 +add_autocomplete_test([ 1.48 + "Add urls, make sure www and http are ignored", 1.49 + "visit1", 1.50 + "visit1.mozilla.org/", 1.51 + function () 1.52 + { 1.53 + promiseAddVisits(NetUtil.newURI("http://www.visit1.mozilla.org")); 1.54 + } 1.55 +]); 1.56 + 1.57 +add_autocomplete_test([ 1.58 + "Autocompleting after an existing host completes to the url", 1.59 + "visit3.mozilla.org/", 1.60 + "visit3.mozilla.org/", 1.61 + function () 1.62 + { 1.63 + promiseAddVisits(NetUtil.newURI("http://www.visit3.mozilla.org")); 1.64 + } 1.65 +]); 1.66 + 1.67 +add_autocomplete_test([ 1.68 + "Searching for www.me should yield www.me.mozilla.org/", 1.69 + "www.me", 1.70 + "www.me.mozilla.org/", 1.71 + function () 1.72 + { 1.73 + promiseAddVisits(NetUtil.newURI("http://www.me.mozilla.org")); 1.74 + } 1.75 +]); 1.76 + 1.77 +add_autocomplete_test([ 1.78 + "With a bookmark and history, the query result should be the bookmark", 1.79 + "bookmark", 1.80 + "bookmark1.mozilla.org/", 1.81 + function () 1.82 + { 1.83 + addBookmark({ url: "http://bookmark1.mozilla.org/", }); 1.84 + promiseAddVisits(NetUtil.newURI("http://bookmark1.mozilla.org/foo")); 1.85 + } 1.86 +]); 1.87 + 1.88 +add_autocomplete_test([ 1.89 + "Check to make sure we get the proper results with full paths", 1.90 + "smokey", 1.91 + "smokey.mozilla.org/", 1.92 + function () 1.93 + { 1.94 + 1.95 + let places = [{ uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=delicious") }, 1.96 + { uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=smokey") }]; 1.97 + promiseAddVisits(places); 1.98 + } 1.99 +]); 1.100 + 1.101 +add_autocomplete_test([ 1.102 + "Check to make sure we autocomplete to the following '/'", 1.103 + "smokey.mozilla.org/fo", 1.104 + "smokey.mozilla.org/foo/", 1.105 + function () 1.106 + { 1.107 + 1.108 + let places = [{ uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=delicious") }, 1.109 + { uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=smokey") }]; 1.110 + promiseAddVisits(places); 1.111 + } 1.112 +]); 1.113 + 1.114 +add_autocomplete_test([ 1.115 + "Check to make sure we autocomplete after ?", 1.116 + "smokey.mozilla.org/foo?", 1.117 + "smokey.mozilla.org/foo?bacon=delicious", 1.118 + function () 1.119 + { 1.120 + promiseAddVisits(NetUtil.newURI("http://smokey.mozilla.org/foo?bacon=delicious")); 1.121 + } 1.122 +]); 1.123 + 1.124 +add_autocomplete_test([ 1.125 + "Check to make sure we autocomplete after #", 1.126 + "smokey.mozilla.org/foo?bacon=delicious#bar", 1.127 + "smokey.mozilla.org/foo?bacon=delicious#bar", 1.128 + function () 1.129 + { 1.130 + promiseAddVisits(NetUtil.newURI("http://smokey.mozilla.org/foo?bacon=delicious#bar")); 1.131 + } 1.132 +]);