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

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:59433e131127
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
3 * You can obtain one at http://mozilla.org/MPL/2.0/. */
4
5 // Functional tests for inline autocomplete
6
7 add_autocomplete_test([
8 "Check disabling autocomplete disables autofill",
9 "vis",
10 "vis",
11 function ()
12 {
13 Services.prefs.setBoolPref("browser.urlbar.autocomplete.enabled", false);
14 promiseAddVisits({ uri: NetUtil.newURI("http://visit.mozilla.org"),
15 transition: TRANSITION_TYPED });
16 }
17 ]);
18
19 add_autocomplete_test([
20 "Check disabling autofill disables autofill",
21 "vis",
22 "vis",
23 function ()
24 {
25 Services.prefs.setBoolPref("browser.urlbar.autoFill", false);
26 promiseAddVisits({ uri: NetUtil.newURI("http://visit.mozilla.org"),
27 transition: TRANSITION_TYPED });
28 }
29 ]);
30
31 add_autocomplete_test([
32 "Add urls, check for correct order",
33 "vis",
34 "visit2.mozilla.org/",
35 function ()
36 {
37 let places = [{ uri: NetUtil.newURI("http://visit1.mozilla.org") },
38 { uri: NetUtil.newURI("http://visit2.mozilla.org"),
39 transition: TRANSITION_TYPED }];
40 promiseAddVisits(places);
41 }
42 ]);
43
44 add_autocomplete_test([
45 "Add urls, make sure www and http are ignored",
46 "visit1",
47 "visit1.mozilla.org/",
48 function ()
49 {
50 promiseAddVisits(NetUtil.newURI("http://www.visit1.mozilla.org"));
51 }
52 ]);
53
54 add_autocomplete_test([
55 "Autocompleting after an existing host completes to the url",
56 "visit3.mozilla.org/",
57 "visit3.mozilla.org/",
58 function ()
59 {
60 promiseAddVisits(NetUtil.newURI("http://www.visit3.mozilla.org"));
61 }
62 ]);
63
64 add_autocomplete_test([
65 "Searching for www.me should yield www.me.mozilla.org/",
66 "www.me",
67 "www.me.mozilla.org/",
68 function ()
69 {
70 promiseAddVisits(NetUtil.newURI("http://www.me.mozilla.org"));
71 }
72 ]);
73
74 add_autocomplete_test([
75 "With a bookmark and history, the query result should be the bookmark",
76 "bookmark",
77 "bookmark1.mozilla.org/",
78 function ()
79 {
80 addBookmark({ url: "http://bookmark1.mozilla.org/", });
81 promiseAddVisits(NetUtil.newURI("http://bookmark1.mozilla.org/foo"));
82 }
83 ]);
84
85 add_autocomplete_test([
86 "Check to make sure we get the proper results with full paths",
87 "smokey",
88 "smokey.mozilla.org/",
89 function ()
90 {
91
92 let places = [{ uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=delicious") },
93 { uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=smokey") }];
94 promiseAddVisits(places);
95 }
96 ]);
97
98 add_autocomplete_test([
99 "Check to make sure we autocomplete to the following '/'",
100 "smokey.mozilla.org/fo",
101 "smokey.mozilla.org/foo/",
102 function ()
103 {
104
105 let places = [{ uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=delicious") },
106 { uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=smokey") }];
107 promiseAddVisits(places);
108 }
109 ]);
110
111 add_autocomplete_test([
112 "Check to make sure we autocomplete after ?",
113 "smokey.mozilla.org/foo?",
114 "smokey.mozilla.org/foo?bacon=delicious",
115 function ()
116 {
117 promiseAddVisits(NetUtil.newURI("http://smokey.mozilla.org/foo?bacon=delicious"));
118 }
119 ]);
120
121 add_autocomplete_test([
122 "Check to make sure we autocomplete after #",
123 "smokey.mozilla.org/foo?bacon=delicious#bar",
124 "smokey.mozilla.org/foo?bacon=delicious#bar",
125 function ()
126 {
127 promiseAddVisits(NetUtil.newURI("http://smokey.mozilla.org/foo?bacon=delicious#bar"));
128 }
129 ]);

mercurial