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

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial