summaryrefslogtreecommitdiffstats
path: root/toolkit/components/places/tests
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/places/tests')
-rw-r--r--toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js8
-rw-r--r--toolkit/components/places/tests/unifiedcomplete/test_tab_matches.js53
2 files changed, 11 insertions, 50 deletions
diff --git a/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js b/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
index 11e917e18..bc252efe0 100644
--- a/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
+++ b/toolkit/components/places/tests/unifiedcomplete/head_autocomplete.js
@@ -286,19 +286,19 @@ var addBookmark = Task.async(function* (aBookmarkObj) {
}
});
-function addOpenPages(aUri, aCount=1, aUserContextId=0) {
+function addOpenPages(aUri, aCount=1) {
let ac = Cc["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"]
.getService(Ci.mozIPlacesAutoComplete);
for (let i = 0; i < aCount; i++) {
- ac.registerOpenPage(aUri, aUserContextId);
+ ac.registerOpenPage(aUri);
}
}
-function removeOpenPages(aUri, aCount=1, aUserContextId=0) {
+function removeOpenPages(aUri, aCount=1) {
let ac = Cc["@mozilla.org/autocomplete/search;1?name=unifiedcomplete"]
.getService(Ci.mozIPlacesAutoComplete);
for (let i = 0; i < aCount; i++) {
- ac.unregisterOpenPage(aUri, aUserContextId);
+ ac.unregisterOpenPage(aUri);
}
}
diff --git a/toolkit/components/places/tests/unifiedcomplete/test_tab_matches.js b/toolkit/components/places/tests/unifiedcomplete/test_tab_matches.js
index 740b8d8ed..646519c32 100644
--- a/toolkit/components/places/tests/unifiedcomplete/test_tab_matches.js
+++ b/toolkit/components/places/tests/unifiedcomplete/test_tab_matches.js
@@ -11,11 +11,9 @@ add_task(function* test_tab_matches() {
let uri2 = NetUtil.newURI("http://xyz.net/");
let uri3 = NetUtil.newURI("about:mozilla");
let uri4 = NetUtil.newURI("data:text/html,test");
- let uri5 = NetUtil.newURI("http://foobar.org");
yield PlacesTestUtils.addVisits([
{ uri: uri1, title: "ABC rocks" },
- { uri: uri2, title: "xyz.net - we're better than ABC" },
- { uri: uri5, title: "foobar.org - much better than ABC, definitely better than XYZ" }
+ { uri: uri2, title: "xyz.net - we're better than ABC" }
]);
addOpenPages(uri1, 1);
// Pages that cannot be registered in history.
@@ -37,8 +35,7 @@ add_task(function* test_tab_matches() {
searchParam: "enable-actions",
matches: [ makeSearchMatch("abc", { heuristic: true }),
makeSwitchToTabMatch("http://abc.com/", { title: "ABC rocks" }),
- { uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] },
- { uri: uri5, title: "foobar.org - much better than ABC, definitely better than XYZ", style: [ "favicon" ] } ]
+ { uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] } ]
});
do_print("three results, both normal results are tab matches");
@@ -48,39 +45,7 @@ add_task(function* test_tab_matches() {
searchParam: "enable-actions",
matches: [ makeSearchMatch("abc", { heuristic: true }),
makeSwitchToTabMatch("http://abc.com/", { title: "ABC rocks" }),
- makeSwitchToTabMatch("http://xyz.net/", { title: "xyz.net - we're better than ABC" }),
- { uri: uri5, title: "foobar.org - much better than ABC, definitely better than XYZ", style: [ "favicon" ] } ]
- });
-
- do_print("a container tab is not visible in 'switch to tab'");
- addOpenPages(uri5, 1, /* userContextId: */ 3);
- yield check_autocomplete({
- search: "abc",
- searchParam: "enable-actions",
- matches: [ makeSearchMatch("abc", { heuristic: true }),
- makeSwitchToTabMatch("http://abc.com/", { title: "ABC rocks" }),
- makeSwitchToTabMatch("http://xyz.net/", { title: "xyz.net - we're better than ABC" }),
- { uri: uri5, title: "foobar.org - much better than ABC, definitely better than XYZ", style: [ "favicon" ] } ]
- });
-
- do_print("a container tab should not see 'switch to tab' for other container tabs");
- yield check_autocomplete({
- search: "abc",
- searchParam: "enable-actions user-context-id:3",
- matches: [ makeSearchMatch("abc", { heuristic: true }),
- makeSwitchToTabMatch("http://foobar.org/", { title: "foobar.org - much better than ABC, definitely better than XYZ" }),
- { uri: uri1, title: "ABC rocks", style: [ "favicon" ] },
- { uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] } ]
- });
-
- do_print("a different container tab should not see any 'switch to tab'");
- yield check_autocomplete({
- search: "abc",
- searchParam: "enable-actions user-context-id:2",
- matches: [ makeSearchMatch("abc", { heuristic: true }),
- { uri: uri1, title: "ABC rocks", style: [ "favicon" ] },
- { uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] },
- { uri: uri5, title: "foobar.org - much better than ABC, definitely better than XYZ", style: [ "favicon" ] } ]
+ makeSwitchToTabMatch("http://xyz.net/", { title: "xyz.net - we're better than ABC" }) ]
});
do_print("three results, both normal results are tab matches, one has multiple tabs");
@@ -90,8 +55,7 @@ add_task(function* test_tab_matches() {
searchParam: "enable-actions",
matches: [ makeSearchMatch("abc", { heuristic: true }),
makeSwitchToTabMatch("http://abc.com/", { title: "ABC rocks" }),
- makeSwitchToTabMatch("http://xyz.net/", { title: "xyz.net - we're better than ABC" }),
- { uri: uri5, title: "foobar.org - much better than ABC, definitely better than XYZ", style: [ "favicon" ] } ]
+ makeSwitchToTabMatch("http://xyz.net/", { title: "xyz.net - we're better than ABC" }) ]
});
do_print("three results, no tab matches (disable-private-actions)");
@@ -100,8 +64,7 @@ add_task(function* test_tab_matches() {
searchParam: "enable-actions disable-private-actions",
matches: [ makeSearchMatch("abc", { heuristic: true }),
{ uri: uri1, title: "ABC rocks", style: [ "favicon" ] },
- { uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] },
- { uri: uri5, title: "foobar.org - much better than ABC, definitely better than XYZ", style: [ "favicon" ] } ]
+ { uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] } ]
});
do_print("two results (actions disabled)");
@@ -109,8 +72,7 @@ add_task(function* test_tab_matches() {
search: "abc",
searchParam: "",
matches: [ { uri: uri1, title: "ABC rocks", style: [ "favicon" ] },
- { uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] },
- { uri: uri5, title: "foobar.org - much better than ABC, definitely better than XYZ", style: [ "favicon" ] } ]
+ { uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] } ]
});
do_print("three results, no tab matches");
@@ -121,8 +83,7 @@ add_task(function* test_tab_matches() {
searchParam: "enable-actions",
matches: [ makeSearchMatch("abc", { heuristic: true }),
{ uri: uri1, title: "ABC rocks", style: [ "favicon" ] },
- { uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] },
- { uri: uri5, title: "foobar.org - much better than ABC, definitely better than XYZ", style: [ "favicon" ] } ]
+ { uri: uri2, title: "xyz.net - we're better than ABC", style: [ "favicon" ] } ]
});
do_print("tab match search with restriction character");