michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this file, michael@0: * You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: // Functional tests for inline autocomplete michael@0: michael@0: add_autocomplete_test([ michael@0: "Check disabling autocomplete disables autofill", michael@0: "vis", michael@0: "vis", michael@0: function () michael@0: { michael@0: Services.prefs.setBoolPref("browser.urlbar.autocomplete.enabled", false); michael@0: promiseAddVisits({ uri: NetUtil.newURI("http://visit.mozilla.org"), michael@0: transition: TRANSITION_TYPED }); michael@0: } michael@0: ]); michael@0: michael@0: add_autocomplete_test([ michael@0: "Check disabling autofill disables autofill", michael@0: "vis", michael@0: "vis", michael@0: function () michael@0: { michael@0: Services.prefs.setBoolPref("browser.urlbar.autoFill", false); michael@0: promiseAddVisits({ uri: NetUtil.newURI("http://visit.mozilla.org"), michael@0: transition: TRANSITION_TYPED }); michael@0: } michael@0: ]); michael@0: michael@0: add_autocomplete_test([ michael@0: "Add urls, check for correct order", michael@0: "vis", michael@0: "visit2.mozilla.org/", michael@0: function () michael@0: { michael@0: let places = [{ uri: NetUtil.newURI("http://visit1.mozilla.org") }, michael@0: { uri: NetUtil.newURI("http://visit2.mozilla.org"), michael@0: transition: TRANSITION_TYPED }]; michael@0: promiseAddVisits(places); michael@0: } michael@0: ]); michael@0: michael@0: add_autocomplete_test([ michael@0: "Add urls, make sure www and http are ignored", michael@0: "visit1", michael@0: "visit1.mozilla.org/", michael@0: function () michael@0: { michael@0: promiseAddVisits(NetUtil.newURI("http://www.visit1.mozilla.org")); michael@0: } michael@0: ]); michael@0: michael@0: add_autocomplete_test([ michael@0: "Autocompleting after an existing host completes to the url", michael@0: "visit3.mozilla.org/", michael@0: "visit3.mozilla.org/", michael@0: function () michael@0: { michael@0: promiseAddVisits(NetUtil.newURI("http://www.visit3.mozilla.org")); michael@0: } michael@0: ]); michael@0: michael@0: add_autocomplete_test([ michael@0: "Searching for www.me should yield www.me.mozilla.org/", michael@0: "www.me", michael@0: "www.me.mozilla.org/", michael@0: function () michael@0: { michael@0: promiseAddVisits(NetUtil.newURI("http://www.me.mozilla.org")); michael@0: } michael@0: ]); michael@0: michael@0: add_autocomplete_test([ michael@0: "With a bookmark and history, the query result should be the bookmark", michael@0: "bookmark", michael@0: "bookmark1.mozilla.org/", michael@0: function () michael@0: { michael@0: addBookmark({ url: "http://bookmark1.mozilla.org/", }); michael@0: promiseAddVisits(NetUtil.newURI("http://bookmark1.mozilla.org/foo")); michael@0: } michael@0: ]); michael@0: michael@0: add_autocomplete_test([ michael@0: "Check to make sure we get the proper results with full paths", michael@0: "smokey", michael@0: "smokey.mozilla.org/", michael@0: function () michael@0: { michael@0: michael@0: let places = [{ uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=delicious") }, michael@0: { uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=smokey") }]; michael@0: promiseAddVisits(places); michael@0: } michael@0: ]); michael@0: michael@0: add_autocomplete_test([ michael@0: "Check to make sure we autocomplete to the following '/'", michael@0: "smokey.mozilla.org/fo", michael@0: "smokey.mozilla.org/foo/", michael@0: function () michael@0: { michael@0: michael@0: let places = [{ uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=delicious") }, michael@0: { uri: NetUtil.newURI("http://smokey.mozilla.org/foo/bar/baz?bacon=smokey") }]; michael@0: promiseAddVisits(places); michael@0: } michael@0: ]); michael@0: michael@0: add_autocomplete_test([ michael@0: "Check to make sure we autocomplete after ?", michael@0: "smokey.mozilla.org/foo?", michael@0: "smokey.mozilla.org/foo?bacon=delicious", michael@0: function () michael@0: { michael@0: promiseAddVisits(NetUtil.newURI("http://smokey.mozilla.org/foo?bacon=delicious")); michael@0: } michael@0: ]); michael@0: michael@0: add_autocomplete_test([ michael@0: "Check to make sure we autocomplete after #", michael@0: "smokey.mozilla.org/foo?bacon=delicious#bar", michael@0: "smokey.mozilla.org/foo?bacon=delicious#bar", michael@0: function () michael@0: { michael@0: promiseAddVisits(NetUtil.newURI("http://smokey.mozilla.org/foo?bacon=delicious#bar")); michael@0: } michael@0: ]);