test_dedupe_switchTab.js (914B)
1 /* Any copyright is dedicated to the Public Domain. 2 * http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 "use strict"; 5 6 testEngine_setup(); 7 8 add_task(async function test_deduplication_for_switch_tab() { 9 // Set up Places to think the tab is open locally. 10 let uri = Services.io.newURI("http://example.com/"); 11 12 await PlacesTestUtils.addVisits({ uri, title: "An Example" }); 13 await addOpenPages(uri, 1); 14 await UrlbarUtils.addToInputHistory("http://example.com/", "An"); 15 16 let query = "An"; 17 let context = createContext(query, { isPrivate: false }); 18 await check_results({ 19 context, 20 matches: [ 21 makeSearchResult(context, { 22 engineName: SUGGESTIONS_ENGINE_NAME, 23 heuristic: true, 24 }), 25 makeTabSwitchResult(context, { 26 uri: "http://example.com/", 27 title: "An Example", 28 }), 29 ], 30 }); 31 32 await removeOpenPages(uri, 1); 33 await cleanupPlaces(); 34 });