summaryrefslogtreecommitdiffstats
path: root/browser/components/urlbar/tests/engagementTelemetry
diff options
context:
space:
mode:
Diffstat (limited to 'browser/components/urlbar/tests/engagementTelemetry')
-rw-r--r--browser/components/urlbar/tests/engagementTelemetry/browser/browser.toml22
-rw-r--r--browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_abandonment_tips.js2
-rw-r--r--browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_abandonment_type.js109
-rw-r--r--browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_engagement_edge_cases.js8
-rw-r--r--browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_engagement_groups.js8
-rw-r--r--browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_engagement_interaction.js8
-rw-r--r--browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_engagement_selected_result.js269
-rw-r--r--browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_engagement_tips.js4
-rw-r--r--browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_engagement_type.js16
-rw-r--r--browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_exposure_edge_cases.js626
-rw-r--r--browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_groups.js258
-rw-r--r--browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_interaction.js68
-rw-r--r--browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_interaction_persisted_search_terms_disabled.js57
-rw-r--r--browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_interaction_persisted_search_terms_enabled.js61
-rw-r--r--browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_n_chars_n_words.js40
-rw-r--r--browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_preferences.js41
-rw-r--r--browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_sap.js38
-rw-r--r--browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_search_engine_default_id.js28
-rw-r--r--browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_search_mode.js72
-rw-r--r--browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_timing.js91
-rw-r--r--browser/components/urlbar/tests/engagementTelemetry/browser/head-groups.js32
-rw-r--r--browser/components/urlbar/tests/engagementTelemetry/browser/head-interaction.js23
-rw-r--r--browser/components/urlbar/tests/engagementTelemetry/browser/head-n_chars_n_words.js8
-rw-r--r--browser/components/urlbar/tests/engagementTelemetry/browser/head-sap.js5
-rw-r--r--browser/components/urlbar/tests/engagementTelemetry/browser/head-search_engine_default_id.js4
-rw-r--r--browser/components/urlbar/tests/engagementTelemetry/browser/head-search_mode.js12
-rw-r--r--browser/components/urlbar/tests/engagementTelemetry/browser/head.js28
27 files changed, 950 insertions, 988 deletions
diff --git a/browser/components/urlbar/tests/engagementTelemetry/browser/browser.toml b/browser/components/urlbar/tests/engagementTelemetry/browser/browser.toml
index 68a7881399..cf6bc80318 100644
--- a/browser/components/urlbar/tests/engagementTelemetry/browser/browser.toml
+++ b/browser/components/urlbar/tests/engagementTelemetry/browser/browser.toml
@@ -26,6 +26,8 @@ prefs = ["browser.bookmarks.testing.skipDefaultBookmarksImport=true"]
["browser_glean_telemetry_abandonment_n_chars_n_words.js"]
+["browser_glean_telemetry_abandonment_type.js"]
+
["browser_glean_telemetry_abandonment_sap.js"]
["browser_glean_telemetry_abandonment_search_engine_default_id.js"]
@@ -64,24 +66,4 @@ skip-if = ["verify"] # Bug 1852375 - MerinoTestUtils.initWeather() doesn't play
["browser_glean_telemetry_exposure_edge_cases.js"]
-["browser_glean_telemetry_impression_groups.js"]
-
-["browser_glean_telemetry_impression_interaction.js"]
-
-["browser_glean_telemetry_impression_interaction_persisted_search_terms_disabled.js"]
-
-["browser_glean_telemetry_impression_interaction_persisted_search_terms_enabled.js"]
-
-["browser_glean_telemetry_impression_n_chars_n_words.js"]
-
-["browser_glean_telemetry_impression_preferences.js"]
-
-["browser_glean_telemetry_impression_sap.js"]
-
-["browser_glean_telemetry_impression_search_engine_default_id.js"]
-
-["browser_glean_telemetry_impression_search_mode.js"]
-
-["browser_glean_telemetry_impression_timing.js"]
-
["browser_glean_telemetry_record_preferences.js"]
diff --git a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_abandonment_tips.js b/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_abandonment_tips.js
index 71087d03d0..ca21ca476c 100644
--- a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_abandonment_tips.js
+++ b/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_abandonment_tips.js
@@ -38,7 +38,7 @@ add_setup(async function () {
});
add_task(async function tip_persist() {
- await doTest(async browser => {
+ await doTest(async () => {
await showPersistSearchTip("test");
gURLBar.focus();
await UrlbarTestUtils.promisePopupClose(window, () => {
diff --git a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_abandonment_type.js b/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_abandonment_type.js
new file mode 100644
index 0000000000..99145d7cc3
--- /dev/null
+++ b/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_abandonment_type.js
@@ -0,0 +1,109 @@
+/* Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+// Test for the following data of abandonment telemetry.
+// - reason
+
+function checkUrlbarFocus(win, focusState) {
+ let urlbar = win.gURLBar;
+ is(
+ focusState ? win.document.activeElement : !win.document.activeElement,
+ focusState ? urlbar.inputField : !urlbar.inputField,
+ `URL Bar should ${focusState ? "" : "not "}be focused`
+ );
+}
+
+// Tests that a tab switch from a focused URL bar to another tab with a focused
+// URL bar records the correct abandonment telemetry with abandonment type
+// "tab_swtich".
+add_task(async function tabSwitchFocusedToFocused() {
+ await doTest(async browser => {
+ await UrlbarTestUtils.promiseAutocompleteResultPopup({
+ window,
+ value: "test search",
+ });
+ checkUrlbarFocus(window, true);
+
+ let promiseTabOpened = BrowserTestUtils.waitForEvent(
+ gBrowser.tabContainer,
+ "TabOpen"
+ );
+ EventUtils.synthesizeMouseAtCenter(gBrowser.tabContainer.newTabButton, {});
+ let openEvent = await promiseTabOpened;
+ let tab2 = openEvent.target;
+ checkUrlbarFocus(window, true);
+
+ await assertAbandonmentTelemetry([{ abandonment_type: "tab_switch" }]);
+
+ await BrowserTestUtils.removeTab(tab2);
+ });
+});
+
+// Verifies that switching from a tab with a focused URL bar to a tab where the
+// URL bar loses focus logs abandonment telemetry with abandonment type
+// "blur".
+add_task(async function tabSwitchFocusedToUnfocused() {
+ await doTest(async browser => {
+ await UrlbarTestUtils.promiseAutocompleteResultPopup({
+ window,
+ value: "test search",
+ });
+ checkUrlbarFocus(window, true);
+
+ let tab2 = await BrowserTestUtils.openNewForegroundTab(window.gBrowser);
+ checkUrlbarFocus(window, false);
+
+ await assertAbandonmentTelemetry([{ abandonment_type: "blur" }]);
+
+ await BrowserTestUtils.removeTab(tab2);
+ });
+});
+
+// Ensures that switching from a tab with an unfocused URL bar to a tab where
+// the URL bar gains focus does not record any abandonment telemetry, reflecting
+// no change in focus state relevant to abandonment.
+add_task(async function tabSwitchUnFocusedToFocused() {
+ await doTest(async browser => {
+ checkUrlbarFocus(window, false);
+
+ let promiseTabOpened = BrowserTestUtils.waitForEvent(
+ gBrowser.tabContainer,
+ "TabOpen"
+ );
+ EventUtils.synthesizeMouseAtCenter(gBrowser.tabContainer.newTabButton, {});
+ let openEvent = await promiseTabOpened;
+ let tab2 = openEvent.target;
+ checkUrlbarFocus(window, true);
+
+ const telemetries = Glean.urlbar.abandonment.testGetValue() ?? [];
+ Assert.equal(
+ telemetries.length,
+ 0,
+ "Telemetry event length matches expected event length."
+ );
+
+ await BrowserTestUtils.removeTab(tab2);
+ });
+});
+
+// Checks that switching between two tabs, both with unfocused URL bars, does
+// not trigger any abandonment telmetry.
+add_task(async function tabSwitchUnFocusedToUnFocused() {
+ await doTest(async browser => {
+ checkUrlbarFocus(window, false);
+
+ let tab2 = await BrowserTestUtils.openNewForegroundTab(window.gBrowser);
+ checkUrlbarFocus(window, false);
+
+ const telemetries = Glean.urlbar.abandonment.testGetValue() ?? [];
+ Assert.equal(
+ telemetries.length,
+ 0,
+ "Telemetry event length matches expected event length."
+ );
+
+ await BrowserTestUtils.removeTab(tab2);
+ });
+});
diff --git a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_engagement_edge_cases.js b/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_engagement_edge_cases.js
index fcac924879..04ef7e9757 100644
--- a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_engagement_edge_cases.js
+++ b/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_engagement_edge_cases.js
@@ -22,7 +22,7 @@ class NoResponseTestProvider extends UrlbarTestUtils.TestProvider {
return UrlbarUtils.PROVIDER_TYPE.HEURISTIC;
}
- async startQuery(context, addCallback) {
+ async startQuery(_context, _addCallback) {
await this.#deferred.promise;
}
@@ -98,7 +98,7 @@ add_task(async function engagement_before_showing_results() {
};
registerCleanupFunction(cleanup);
- await doTest(async browser => {
+ await doTest(async () => {
// Try to show the results.
await UrlbarTestUtils.inputIntoURLBar(window, "exam");
@@ -156,7 +156,7 @@ add_task(async function engagement_after_closing_results() {
];
for (const trigger of TRIGGERS) {
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("test");
await UrlbarTestUtils.promisePopupClose(window, () => {
trigger();
@@ -186,7 +186,7 @@ add_task(async function engagement_after_closing_results() {
});
add_task(async function enter_to_reload_current_url() {
- await doTest(async browser => {
+ await doTest(async () => {
// Open a URL once.
await openPopup("https://example.com");
await doEnter();
diff --git a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_engagement_groups.js b/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_engagement_groups.js
index 8779487960..d46c874403 100644
--- a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_engagement_groups.js
+++ b/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_engagement_groups.js
@@ -247,13 +247,13 @@ add_task(async function always_empty_if_drop_go() {
},
];
- await doTest(async browser => {
+ await doTest(async () => {
await doDropAndGo("example.com");
assertEngagementTelemetry(expected);
});
- await doTest(async browser => {
+ await doTest(async () => {
// Open the results view once.
await showResultByArrowDown();
await UrlbarTestUtils.promisePopupClose(window);
@@ -274,13 +274,13 @@ add_task(async function always_empty_if_paste_go() {
},
];
- await doTest(async browser => {
+ await doTest(async () => {
await doPasteAndGo("example.com");
assertEngagementTelemetry(expected);
});
- await doTest(async browser => {
+ await doTest(async () => {
// Open the results view once.
await showResultByArrowDown();
await UrlbarTestUtils.promisePopupClose(window);
diff --git a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_engagement_interaction.js b/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_engagement_interaction.js
index f4880d2205..2866186c30 100644
--- a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_engagement_interaction.js
+++ b/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_engagement_interaction.js
@@ -35,13 +35,13 @@ add_task(async function typed() {
});
add_task(async function dropped() {
- await doTest(async browser => {
+ await doTest(async () => {
await doDropAndGo("example.com");
assertEngagementTelemetry([{ interaction: "dropped" }]);
});
- await doTest(async browser => {
+ await doTest(async () => {
await showResultByArrowDown();
await doDropAndGo("example.com");
@@ -60,13 +60,13 @@ add_task(async function pasted() {
assert: () => assertEngagementTelemetry([{ interaction: "pasted" }]),
});
- await doTest(async browser => {
+ await doTest(async () => {
await doPasteAndGo("www.example.com");
assertEngagementTelemetry([{ interaction: "pasted" }]);
});
- await doTest(async browser => {
+ await doTest(async () => {
await showResultByArrowDown();
await doPasteAndGo("www.example.com");
diff --git a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_engagement_selected_result.js b/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_engagement_selected_result.js
index 6a3422d939..bea266dbf4 100644
--- a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_engagement_selected_result.js
+++ b/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_engagement_selected_result.js
@@ -13,6 +13,7 @@
ChromeUtils.defineESModuleGetters(this, {
UrlbarProviderClipboard:
"resource:///modules/UrlbarProviderClipboard.sys.mjs",
+ SearchUtils: "resource://gre/modules/SearchUtils.sys.mjs",
});
// This test has many subtests and can time out in verify mode.
@@ -23,7 +24,7 @@ add_setup(async function () {
});
add_task(async function selected_result_autofill_about() {
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("about:about");
await doEnter();
@@ -44,7 +45,7 @@ add_task(async function selected_result_autofill_adaptive() {
set: [["browser.urlbar.autoFill.adaptiveHistory.enabled", true]],
});
- await doTest(async browser => {
+ await doTest(async () => {
await PlacesTestUtils.addVisits("https://example.com/test");
await UrlbarUtils.addToInputHistory("https://example.com/test", "exa");
await openPopup("exa");
@@ -65,7 +66,7 @@ add_task(async function selected_result_autofill_adaptive() {
});
add_task(async function selected_result_autofill_origin() {
- await doTest(async browser => {
+ await doTest(async () => {
await PlacesTestUtils.addVisits("https://example.com/test");
await PlacesFrecencyRecalculator.recalculateAnyOutdatedFrecencies();
await openPopup("exa");
@@ -84,7 +85,7 @@ add_task(async function selected_result_autofill_origin() {
});
add_task(async function selected_result_autofill_url() {
- await doTest(async browser => {
+ await doTest(async () => {
await PlacesTestUtils.addVisits("https://example.com/test");
await PlacesFrecencyRecalculator.recalculateAnyOutdatedFrecencies();
await openPopup("https://example.com/test");
@@ -103,7 +104,7 @@ add_task(async function selected_result_autofill_url() {
});
add_task(async function selected_result_bookmark() {
- await doTest(async browser => {
+ await doTest(async () => {
await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
url: "https://example.com/bookmark",
@@ -131,7 +132,7 @@ add_task(async function selected_result_history() {
set: [["browser.urlbar.autoFill", false]],
});
- await doTest(async browser => {
+ await doTest(async () => {
await PlacesTestUtils.addVisits("https://example.com/test");
await openPopup("example");
@@ -153,7 +154,7 @@ add_task(async function selected_result_history() {
});
add_task(async function selected_result_keyword() {
- await doTest(async browser => {
+ await doTest(async () => {
await PlacesUtils.keywords.insert({
keyword: "keyword",
url: "https://example.com/?q=%s",
@@ -177,7 +178,7 @@ add_task(async function selected_result_keyword() {
});
add_task(async function selected_result_search_engine() {
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("x");
await doEnter();
@@ -201,7 +202,7 @@ add_task(async function selected_result_search_suggest() {
],
});
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("foo");
await selectRowByURL("http://mochi.test:8888/?terms=foofoo");
await doEnter();
@@ -228,7 +229,7 @@ add_task(async function selected_result_search_history() {
],
});
- await doTest(async browser => {
+ await doTest(async () => {
await UrlbarTestUtils.formHistory.add(["foofoo", "foobar"]);
await openPopup("foo");
@@ -250,7 +251,7 @@ add_task(async function selected_result_search_history() {
});
add_task(async function selected_result_url() {
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("https://example.com/");
await doEnter();
@@ -267,7 +268,7 @@ add_task(async function selected_result_url() {
});
add_task(async function selected_result_action() {
- await doTest(async browser => {
+ await doTest(async () => {
await showResultByArrowDown();
await selectRowByProvider("quickactions");
const onLoad = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser);
@@ -289,7 +290,7 @@ add_task(async function selected_result_action() {
add_task(async function selected_result_tab() {
const tab = BrowserTestUtils.addTab(gBrowser, "https://example.com/");
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("example");
await selectRowByProvider("Places");
EventUtils.synthesizeKey("KEY_Enter");
@@ -312,7 +313,7 @@ add_task(async function selected_result_tab() {
add_task(async function selected_result_remote_tab() {
const remoteTab = await loadRemoteTab("https://example.com");
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("example");
await selectRowByProvider("RemoteTabs");
await doEnter();
@@ -335,7 +336,7 @@ add_task(async function selected_result_addon() {
const addon = loadOmniboxAddon({ keyword: "omni" });
await addon.startup();
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("omni test");
await doEnter();
@@ -363,7 +364,7 @@ add_task(async function selected_result_tab_to_search() {
search_url: "https://mozengine/",
});
- await doTest(async browser => {
+ await doTest(async () => {
for (let i = 0; i < 3; i++) {
await PlacesTestUtils.addVisits(["https://mozengine/"]);
}
@@ -389,7 +390,7 @@ add_task(async function selected_result_tab_to_search() {
});
add_task(async function selected_result_top_site() {
- await doTest(async browser => {
+ await doTest(async () => {
await addTopSites("https://example.com/");
await showResultByArrowDown();
await selectRowByURL("https://example.com/");
@@ -412,7 +413,7 @@ add_task(async function selected_result_calc() {
set: [["browser.urlbar.suggest.calculator", true]],
});
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("8*8");
await selectRowByProvider("calculator");
await SimpleTest.promiseClipboardChange("64", () => {
@@ -444,7 +445,7 @@ add_task(async function selected_result_clipboard() {
"https://example.com/selected_result_clipboard"
);
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("");
await selectRowByProvider("UrlbarProviderClipboard");
await doEnter();
@@ -470,7 +471,7 @@ add_task(async function selected_result_unit() {
set: [["browser.urlbar.unitConversion.enabled", true]],
});
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("1m to cm");
await selectRowByProvider("UnitConversion");
await SimpleTest.promiseClipboardChange("100 cm", () => {
@@ -496,7 +497,7 @@ add_task(async function selected_result_site_specific_contextual_search() {
set: [["browser.urlbar.contextualSearch.enabled", true]],
});
- await doTest(async browser => {
+ await doTest(async () => {
const extension = await SearchTestUtils.installSearchExtension(
{
name: "Contextual",
@@ -540,7 +541,7 @@ add_task(async function selected_result_rs_adm_sponsored() {
prefs: [["quicksuggest.rustEnabled", false]],
});
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("sponsored");
await selectRowByURL("https://example.com/sponsored");
await doEnter();
@@ -564,7 +565,7 @@ add_task(async function selected_result_rs_adm_nonsponsored() {
prefs: [["quicksuggest.rustEnabled", false]],
});
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("nonsponsored");
await selectRowByURL("https://example.com/nonsponsored");
await doEnter();
@@ -594,13 +595,13 @@ add_task(async function selected_result_input_field() {
},
];
- await doTest(async browser => {
+ await doTest(async () => {
await doDropAndGo("example.com");
assertEngagementTelemetry(expected);
});
- await doTest(async browser => {
+ await doTest(async () => {
await doPasteAndGo("example.com");
assertEngagementTelemetry(expected);
@@ -618,7 +619,7 @@ add_task(async function selected_result_weather() {
let provider = UrlbarPrefs.get("quickSuggestRustEnabled")
? "UrlbarProviderQuickSuggest"
: "Weather";
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup(MerinoTestUtils.WEATHER_KEYWORD);
await selectRowByProvider(provider);
await doEnter();
@@ -653,7 +654,7 @@ add_task(async function selected_result_navigational() {
],
});
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("only match the Merino suggestion");
await selectRowByProvider("UrlbarProviderQuickSuggest");
await doEnter();
@@ -688,7 +689,7 @@ add_task(async function selected_result_dynamic_wikipedia() {
],
});
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("only match the Merino suggestion");
await selectRowByProvider("UrlbarProviderQuickSuggest");
await doEnter();
@@ -708,7 +709,7 @@ add_task(async function selected_result_dynamic_wikipedia() {
});
add_task(async function selected_result_search_shortcut_button() {
- await doTest(async browser => {
+ await doTest(async () => {
const oneOffSearchButtons = UrlbarTestUtils.getOneOffSearchButtons(window);
await openPopup("x");
Assert.ok(!oneOffSearchButtons.selectedButton);
@@ -756,31 +757,78 @@ add_task(async function selected_result_trending() {
});
let defaultEngine = await Services.search.getDefault();
- let extension = await SearchTestUtils.installSearchExtension(
- {
- name: "mozengine",
- search_url: "https://example.org/",
- },
- { setAsDefault: true, skipUnload: true }
- );
+ let extension;
+ if (!SearchUtils.newSearchConfigEnabled) {
+ extension = await SearchTestUtils.installSearchExtension(
+ {
+ name: "mozengine",
+ search_url: "https://example.org/",
+ },
+ { setAsDefault: true, skipUnload: true }
+ );
+ }
SearchTestUtils.useMockIdleService();
- await SearchTestUtils.updateRemoteSettingsConfig([
- {
- webExtension: { id: "mozengine@tests.mozilla.org" },
- urls: {
- trending: {
- fullPath:
- "https://example.com/browser/browser/components/search/test/browser/trendingSuggestionEngine.sjs",
- query: "",
- },
- },
- appliesTo: [{ included: { everywhere: true } }],
- default: "yes",
- },
- ]);
+ await SearchTestUtils.updateRemoteSettingsConfig(
+ SearchUtils.newSearchConfigEnabled
+ ? [
+ {
+ recordType: "engine",
+ identifier: "mozengine",
+ base: {
+ name: "mozengine",
+ urls: {
+ search: {
+ base: "https://example.org/",
+ searchTermParamName: "q",
+ },
+ trending: {
+ base: "https://example.com/browser/browser/components/search/test/browser/trendingSuggestionEngine.sjs",
+ method: "GET",
+ },
+ },
+ },
+ variants: [
+ {
+ environment: { allRegionsAndLocales: true },
+ },
+ ],
+ },
+ {
+ recordType: "defaultEngines",
+ globalDefault: "mozengine",
+ specificDefaults: [],
+ },
+ {
+ recordType: "engineOrders",
+ orders: [],
+ },
+ ]
+ : [
+ {
+ webExtension: { id: "mozengine@tests.mozilla.org" },
+ urls: {
+ trending: {
+ fullPath:
+ "https://example.com/browser/browser/components/search/test/browser/trendingSuggestionEngine.sjs",
+ query: "",
+ },
+ },
+ appliesTo: [{ included: { everywhere: true } }],
+ default: "yes",
+ },
+ ]
+ );
- await doTest(async browser => {
+ if (SearchUtils.newSearchConfigEnabled) {
+ let engine = Services.search.getEngineByName("mozengine");
+ await Services.search.setDefault(
+ engine,
+ Ci.nsISearchService.CHANGE_REASON_UNKNOWN
+ );
+ }
+
+ await doTest(async () => {
await openPopup("");
await selectRowByProvider("SearchSuggestions");
await doEnter();
@@ -796,7 +844,13 @@ add_task(async function selected_result_trending() {
]);
});
- await extension.unload();
+ if (SearchUtils.newSearchConfigEnabled) {
+ let engine = Services.search.getEngineByName("mozengine");
+ await Services.search.removeEngine(engine);
+ } else {
+ await extension.unload();
+ }
+
await Services.search.setDefault(
defaultEngine,
Ci.nsISearchService.CHANGE_REASON_UNKNOWN
@@ -823,31 +877,84 @@ add_task(async function selected_result_trending_rich() {
});
let defaultEngine = await Services.search.getDefault();
- let extension = await SearchTestUtils.installSearchExtension(
- {
- name: "mozengine",
- search_url: "https://example.org/",
- },
- { setAsDefault: true, skipUnload: true }
- );
+ let extension;
+ if (!SearchUtils.newSearchConfigEnabled) {
+ extension = await SearchTestUtils.installSearchExtension(
+ {
+ name: "mozengine",
+ search_url: "https://example.org/",
+ },
+ { setAsDefault: true, skipUnload: true }
+ );
+ }
SearchTestUtils.useMockIdleService();
- await SearchTestUtils.updateRemoteSettingsConfig([
- {
- webExtension: { id: "mozengine@tests.mozilla.org" },
- urls: {
- trending: {
- fullPath:
- "https://example.com/browser/browser/components/search/test/browser/trendingSuggestionEngine.sjs?richsuggestions=true",
- query: "",
- },
- },
- appliesTo: [{ included: { everywhere: true } }],
- default: "yes",
- },
- ]);
+ await SearchTestUtils.updateRemoteSettingsConfig(
+ SearchUtils.newSearchConfigEnabled
+ ? [
+ {
+ recordType: "engine",
+ identifier: "mozengine",
+ base: {
+ name: "mozengine",
+ urls: {
+ search: {
+ base: "https://example.org/",
+ searchTermParamName: "q",
+ },
+ trending: {
+ base: "https://example.com/browser/browser/components/search/test/browser/trendingSuggestionEngine.sjs",
+ method: "GET",
+ params: [
+ {
+ name: "richsuggestions",
+ value: "true",
+ },
+ ],
+ },
+ },
+ },
+ variants: [
+ {
+ environment: { allRegionsAndLocales: true },
+ },
+ ],
+ },
+ {
+ recordType: "defaultEngines",
+ globalDefault: "mozengine",
+ specificDefaults: [],
+ },
+ {
+ recordType: "engineOrders",
+ orders: [],
+ },
+ ]
+ : [
+ {
+ webExtension: { id: "mozengine@tests.mozilla.org" },
+ urls: {
+ trending: {
+ fullPath:
+ "https://example.com/browser/browser/components/search/test/browser/trendingSuggestionEngine.sjs?richsuggestions=true",
+ query: "",
+ },
+ },
+ appliesTo: [{ included: { everywhere: true } }],
+ default: "yes",
+ },
+ ]
+ );
- await doTest(async browser => {
+ if (SearchUtils.newSearchConfigEnabled) {
+ let engine = Services.search.getEngineByName("mozengine");
+ await Services.search.setDefault(
+ engine,
+ Ci.nsISearchService.CHANGE_REASON_UNKNOWN
+ );
+ }
+
+ await doTest(async () => {
await openPopup("");
await selectRowByProvider("SearchSuggestions");
await doEnter();
@@ -863,7 +970,13 @@ add_task(async function selected_result_trending_rich() {
]);
});
- await extension.unload();
+ if (SearchUtils.newSearchConfigEnabled) {
+ let engine = Services.search.getEngineByName("mozengine");
+ await Services.search.removeEngine(engine);
+ } else {
+ await extension.unload();
+ }
+
await Services.search.setDefault(
defaultEngine,
Ci.nsISearchService.CHANGE_REASON_UNKNOWN
@@ -905,7 +1018,7 @@ add_task(async function selected_result_addons() {
],
});
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("only match the Merino suggestion");
await selectRowByProvider("UrlbarProviderQuickSuggest");
await doEnter();
@@ -930,7 +1043,7 @@ add_task(async function selected_result_rust_adm_sponsored() {
prefs: [["quicksuggest.rustEnabled", true]],
});
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("sponsored");
await selectRowByURL("https://example.com/sponsored");
await doEnter();
@@ -954,7 +1067,7 @@ add_task(async function selected_result_rust_adm_nonsponsored() {
prefs: [["quicksuggest.rustEnabled", true]],
});
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("nonsponsored");
await selectRowByURL("https://example.com/nonsponsored");
await doEnter();
diff --git a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_engagement_tips.js b/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_engagement_tips.js
index 2b38631747..ff31bdc52a 100644
--- a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_engagement_tips.js
+++ b/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_engagement_tips.js
@@ -69,7 +69,7 @@ add_task(async function selected_result_tip() {
});
UrlbarProvidersManager.registerProvider(provider);
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("example");
await selectRowByType(type);
EventUtils.synthesizeKey("VK_RETURN");
@@ -159,7 +159,7 @@ add_task(async function selected_result_intervention_update() {
});
async function doInterventionTest(keyword, type, dialog, expectedTelemetry) {
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup(keyword);
await selectRowByType(type);
const onDialog = BrowserTestUtils.promiseAlertDialog("cancel", dialog, {
diff --git a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_engagement_type.js b/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_engagement_type.js
index 5972dd331d..6b1dedbce2 100644
--- a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_engagement_type.js
+++ b/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_engagement_type.js
@@ -14,7 +14,7 @@ add_setup(async function () {
});
add_task(async function engagement_type_click() {
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("x");
await doClick();
@@ -23,7 +23,7 @@ add_task(async function engagement_type_click() {
});
add_task(async function engagement_type_enter() {
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("x");
await doEnter();
@@ -32,7 +32,7 @@ add_task(async function engagement_type_enter() {
});
add_task(async function engagement_type_go_button() {
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("x");
EventUtils.synthesizeMouseAtCenter(gURLBar.goButton, {});
@@ -41,7 +41,7 @@ add_task(async function engagement_type_go_button() {
});
add_task(async function engagement_type_drop_go() {
- await doTest(async browser => {
+ await doTest(async () => {
await doDropAndGo("example.com");
assertEngagementTelemetry([{ engagement_type: "drop_go" }]);
@@ -49,7 +49,7 @@ add_task(async function engagement_type_drop_go() {
});
add_task(async function engagement_type_paste_go() {
- await doTest(async browser => {
+ await doTest(async () => {
await doPasteAndGo("www.example.com");
assertEngagementTelemetry([{ engagement_type: "paste_go" }]);
@@ -59,7 +59,7 @@ add_task(async function engagement_type_paste_go() {
add_task(async function engagement_type_dismiss() {
const cleanupQuickSuggest = await ensureQuickSuggestInit();
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("sponsored");
const originalResultCount = UrlbarTestUtils.getResultCount(window);
@@ -84,7 +84,7 @@ add_task(async function engagement_type_dismiss() {
]);
});
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("sponsored");
const originalResultCount = UrlbarTestUtils.getResultCount(window);
@@ -103,7 +103,7 @@ add_task(async function engagement_type_dismiss() {
add_task(async function engagement_type_help() {
const cleanupQuickSuggest = await ensureQuickSuggestInit();
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("sponsored");
await selectRowByURL("https://example.com/sponsored");
const onTabOpened = BrowserTestUtils.waitForNewTab(gBrowser);
diff --git a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_exposure_edge_cases.js b/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_exposure_edge_cases.js
index d28352b417..725240c9b1 100644
--- a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_exposure_edge_cases.js
+++ b/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_exposure_edge_cases.js
@@ -38,8 +38,12 @@ add_setup(async function () {
gProvider = new TestProvider();
UrlbarProvidersManager.registerProvider(gProvider);
- // Increase the timeout of the stale-rows timer so it doesn't interfere with
- // this test, which specifically tests what happens before the timer fires.
+ // This test specifically checks the view's behavior before and after it
+ // removes stale rows, so it needs to control when that occurs. There are two
+ // times the view removes stale rows: (1) when the stale-rows timer fires, (2)
+ // when a query finishes. We prevent (1) from occuring by increasing the
+ // timer's timeout so it never fires during the test. We'll rely on (2) to
+ // trigger stale rows removal.
let originalRemoveStaleRowsTimeout = UrlbarView.removeStaleRowsTimeout;
UrlbarView.removeStaleRowsTimeout = 30000;
@@ -49,11 +53,17 @@ add_setup(async function () {
});
});
-// Does one query that fills up the view with search suggestions, starts a
-// second query that returns a history result, and cancels it before it can
-// finish but after the view is updated. Regardless of `showExposureResults`,
-// the history result should not trigger an exposure since it never had a chance
-// to be visible in the view.
+// Does the following:
+//
+// 1. Starts and finishes a query that fills up the view
+// 2. Starts a second query with results that cannot replace rows from the first
+// query and that therefore must be appended and hidden
+// 3. Cancels the second query before it finishes (so that stale rows are not
+// removed)
+//
+// Results in the second query should not trigger an exposure. They can never be
+// visible in the view since the second query is canceled before stale rows are
+// removed.
add_task(async function noExposure() {
for (let showExposureResults of [true, false]) {
await do_noExposure(showExposureResults);
@@ -116,7 +126,7 @@ async function do_noExposure(showExposureResults) {
// When the provider's `startQuery()` is called, let it add its results but
// don't let it return. That will cause the view to be updated with the new
// results but prevent it from showing hidden rows since the query won't
- // finish.
+ // finish (so stale rows won't be removed).
let queryResolver = Promise.withResolvers();
gProvider.finishQueryPromise = queryResolver.promise;
@@ -147,14 +157,24 @@ async function do_noExposure(showExposureResults) {
// Make sure the view is full of visible rows as expected, plus the one or two
// hidden rows for the history and/or bookmark results.
- let rows = UrlbarTestUtils.getResultsContainer(window);
- let expectedCount = MAX_RESULT_COUNT + 1;
+ let expected = [
+ {
+ source: UrlbarUtils.RESULT_SOURCE.BOOKMARKS,
+ type: UrlbarUtils.RESULT_TYPE.URL,
+ url: bookmarkUrl,
+ },
+ ];
if (showExposureResults) {
- expectedCount++;
+ expected.unshift({
+ source: UrlbarUtils.RESULT_SOURCE.HISTORY,
+ type: UrlbarUtils.RESULT_TYPE.URL,
+ url: historyUrl,
+ });
}
+ let rows = UrlbarTestUtils.getResultsContainer(window);
Assert.equal(
rows.children.length,
- expectedCount,
+ MAX_RESULT_COUNT + expected.length,
"The view has the expected number of rows"
);
@@ -176,24 +196,15 @@ async function do_noExposure(showExposureResults) {
}
// Check the hidden history and/or bookmark rows.
- let expected = [
- { source: UrlbarUtils.RESULT_SOURCE.BOOKMARKS, url: bookmarkUrl },
- ];
- if (showExposureResults) {
- expected.unshift({
- source: UrlbarUtils.RESULT_SOURCE.HISTORY,
- url: historyUrl,
- });
- }
for (let i = 0; i < expected.length; i++) {
- let { source, url } = expected[i];
+ let { source, type, url } = expected[i];
let row = rows.children[MAX_RESULT_COUNT + i];
Assert.ok(row, `rows[${i}] should exist`);
Assert.ok(BrowserTestUtils.isHidden(row), `rows[${i}] should be hidden`);
Assert.equal(
row.result.type,
- UrlbarUtils.RESULT_TYPE.URL,
- `rows[${i}].result.type should be URL`
+ type,
+ `rows[${i}].result.type should be as expected`
);
Assert.equal(
row.result.source,
@@ -212,8 +223,8 @@ async function do_noExposure(showExposureResults) {
await UrlbarTestUtils.promisePopupClose(window);
gURLBar.blur();
- // No exposure should have been recorded since the history result was never
- // visible.
+ // No exposure should have been recorded since the history result could never
+ // be visible.
assertExposureTelemetry([]);
// Clean up.
@@ -221,17 +232,24 @@ async function do_noExposure(showExposureResults) {
await queryPromise;
await SpecialPowers.popPrefEnv();
Services.fog.testResetFOG();
+ gProvider.finishQueryPromise = null;
}
-// Does one query that underfills the view and then a second query that returns
-// a search suggestion. The search suggestion should be appended and trigger an
-// exposure. When `showExposureResults` is true, it should also be shown. After
-// the view is updated, it shouldn't matter whether or not the second query is
-// canceled.
-add_task(async function exposure_append() {
+// Does the following:
+//
+// 1. Starts and finishes a query that underfills the view
+// 2. Starts a second query
+// 3. Waits for rows from the second query to be appended. They will be
+// immediately visible since the first query underfilled the view.
+// 4. Either cancels the second query (so stale rows are not removed) or waits
+// for it to finish (so stale rows are removed)
+//
+// Results in the second query should trigger an exposure since they are made
+// visible in step 3. Step 4 should not actually matter.
+add_task(async function exposure_append_underfilled() {
for (let showExposureResults of [true, false]) {
for (let cancelSecondQuery of [true, false]) {
- await do_exposure_append({
+ await do_exposure_append_underfilled({
showExposureResults,
cancelSecondQuery,
});
@@ -239,7 +257,10 @@ add_task(async function exposure_append() {
}
});
-async function do_exposure_append({ showExposureResults, cancelSecondQuery }) {
+async function do_exposure_append_underfilled({
+ showExposureResults,
+ cancelSecondQuery,
+}) {
info(
"Starting do_exposure_append: " +
JSON.stringify({ showExposureResults, cancelSecondQuery })
@@ -287,7 +308,8 @@ async function do_exposure_append({ showExposureResults, cancelSecondQuery }) {
// When the provider's `startQuery()` is called, let it add its results but
// don't let it return. That will cause the view to be updated with the new
- // results but let us test the specific case where the query doesn't finish.
+ // results but let us test the specific case where the query doesn't finish
+ // (so stale rows are not removed).
let queryResolver = Promise.withResolvers();
gProvider.finishQueryPromise = queryResolver.promise;
@@ -357,13 +379,19 @@ async function do_exposure_append({ showExposureResults, cancelSecondQuery }) {
await queryPromise;
await SpecialPowers.popPrefEnv();
Services.fog.testResetFOG();
+ gProvider.finishQueryPromise = null;
}
-// Does one query that returns a search suggestion and then a second query that
-// returns a new search suggestion. The new search suggestion can replace the
-// old one, so it should trigger an exposure. When `showExposureResults` is
-// true, it should actually replace it. After the view is updated, it shouldn't
-// matter whether or not the second query is canceled.
+// Does the following:
+//
+// 1. Starts and finishes a query
+// 2. Starts a second query with a result that can replace an existing row from
+// the previous query
+// 3. Either cancels the second query (so stale rows are not removed) or waits
+// for it to finish (so stale rows are removed)
+//
+// The result in the second query should trigger an exposure since it's made
+// visible in step 2. Step 3 should not actually matter.
add_task(async function exposure_replace() {
for (let showExposureResults of [true, false]) {
for (let cancelSecondQuery of [true, false]) {
@@ -433,7 +461,8 @@ async function do_exposure_replace({ showExposureResults, cancelSecondQuery }) {
// When the provider's `startQuery()` is called, let it add its results but
// don't let it return. That will cause the view to be updated with the new
- // results but let us test the specific case where the query doesn't finish.
+ // results but let us test the specific case where the query doesn't finish
+ // (so stale rows are not removed).
let queryResolver = Promise.withResolvers();
gProvider.finishQueryPromise = queryResolver.promise;
@@ -503,6 +532,519 @@ async function do_exposure_replace({ showExposureResults, cancelSecondQuery }) {
await queryPromise;
await SpecialPowers.popPrefEnv();
Services.fog.testResetFOG();
+ gProvider.finishQueryPromise = null;
+}
+
+// Does the following:
+//
+// 1. Starts and finishes a query that fills up the view
+// 2. Starts a second query with a result that cannot replace any rows from the
+// first query and that therefore must be appended and hidden
+// 3. Finishes the second query
+//
+// The result in the second query should trigger an exposure since it's made
+// visible in step 3.
+add_task(async function exposure_append_full() {
+ for (let showExposureResults of [true, false]) {
+ await do_exposure_append_full(showExposureResults);
+ }
+});
+
+async function do_exposure_append_full(showExposureResults) {
+ info(
+ "Starting do_exposure_append_full: " +
+ JSON.stringify({ showExposureResults })
+ );
+
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ ["browser.urlbar.exposureResults", "history"],
+ ["browser.urlbar.showExposureResults", showExposureResults],
+ ],
+ });
+
+ // Make the provider return enough search suggestions to fill the view.
+ gProvider.results = [];
+ for (let i = 0; i < MAX_RESULT_COUNT; i++) {
+ gProvider.results.push(
+ new UrlbarResult(
+ UrlbarUtils.RESULT_TYPE.SEARCH,
+ UrlbarUtils.RESULT_SOURCE.SEARCH,
+ {
+ suggestion: "suggestion " + i,
+ engine: Services.search.defaultEngine.name,
+ }
+ )
+ );
+ }
+
+ // Do the first query to fill the view with search suggestions.
+ info("Doing first query");
+ await UrlbarTestUtils.promiseAutocompleteResultPopup({
+ window,
+ value: "test 1",
+ });
+
+ // Now make the provider return a history result and bookmark. If
+ // `showExposureResults` is true, the history result will be added to the view
+ // but it should be hidden since the view is already full. If it's false, it
+ // shouldn't be added at all. The bookmark will always be added, which will
+ // tell us when the view has been updated either way. (It also will be hidden
+ // since the view is already full.)
+ let historyUrl = "https://example.com/history";
+ let bookmarkUrl = "https://example.com/bookmark";
+ gProvider.results = [
+ new UrlbarResult(
+ UrlbarUtils.RESULT_TYPE.URL,
+ UrlbarUtils.RESULT_SOURCE.HISTORY,
+ { url: historyUrl }
+ ),
+ new UrlbarResult(
+ UrlbarUtils.RESULT_TYPE.URL,
+ UrlbarUtils.RESULT_SOURCE.BOOKMARKS,
+ { url: bookmarkUrl }
+ ),
+ ];
+
+ // When the provider's `startQuery()` is called, let it add its results but
+ // don't let it return. That will cause the view to be updated with the new
+ // results but prevent it from showing hidden rows since the query won't
+ // finish (so stale rows won't be removed).
+ let queryResolver = Promise.withResolvers();
+ gProvider.finishQueryPromise = queryResolver.promise;
+
+ // Observe when the view appends the bookmark row. This will tell us when the
+ // view has been updated with the provider's new results. The bookmark row
+ // will be hidden since the view is already full with search suggestions.
+ let lastRowPromise = promiseLastRowAppended(
+ row => row.result.payload.url == bookmarkUrl
+ );
+
+ // Now start the second query but don't await it.
+ info("Starting second query");
+ let queryPromise = UrlbarTestUtils.promiseAutocompleteResultPopup({
+ window,
+ value: "test 2",
+ reopenOnBlur: false,
+ });
+
+ // Wait for the view to be updated.
+ info("Waiting for last row");
+ let lastRow = await lastRowPromise;
+ info("Done waiting for last row");
+
+ Assert.ok(
+ BrowserTestUtils.isHidden(lastRow),
+ "The new bookmark row should be hidden since the view is full"
+ );
+
+ // Make sure the view is full of visible rows as expected, plus the one or two
+ // hidden rows for the history and bookmark results.
+ let expected = [
+ {
+ source: UrlbarUtils.RESULT_SOURCE.BOOKMARKS,
+ type: UrlbarUtils.RESULT_TYPE.URL,
+ url: bookmarkUrl,
+ },
+ ];
+ if (showExposureResults) {
+ expected.unshift({
+ source: UrlbarUtils.RESULT_SOURCE.HISTORY,
+ type: UrlbarUtils.RESULT_TYPE.URL,
+ url: historyUrl,
+ });
+ }
+ let rows = UrlbarTestUtils.getResultsContainer(window);
+ Assert.equal(
+ rows.children.length,
+ MAX_RESULT_COUNT + expected.length,
+ "The view has the expected number of rows"
+ );
+
+ // Check the visible rows.
+ for (let i = 0; i < MAX_RESULT_COUNT; i++) {
+ let row = rows.children[i];
+ Assert.ok(BrowserTestUtils.isVisible(row), `rows[${i}] should be visible`);
+ Assert.ok(
+ row.result.type == UrlbarUtils.RESULT_TYPE.SEARCH,
+ `rows[${i}].result.type should be SEARCH`
+ );
+ // The heuristic won't have a suggestion so skip it.
+ if (i > 0) {
+ Assert.ok(
+ row.result.payload.suggestion,
+ `rows[${i}] should have a suggestion`
+ );
+ }
+ }
+
+ // Check the hidden history and bookmark rows.
+ for (let i = 0; i < expected.length; i++) {
+ let { source, type, url } = expected[i];
+ let row = rows.children[MAX_RESULT_COUNT + i];
+ Assert.ok(row, `rows[${i}] should exist`);
+ Assert.ok(BrowserTestUtils.isHidden(row), `rows[${i}] should be hidden`);
+ Assert.equal(
+ row.result.type,
+ type,
+ `rows[${i}].result.type should be as expected`
+ );
+ Assert.equal(
+ row.result.source,
+ source,
+ `rows[${i}].result.source should be as expected`
+ );
+ Assert.equal(
+ row.result.payload.url,
+ url,
+ `rows[${i}] URL should be as expected`
+ );
+ }
+
+ // Now let the query finish (so stale rows are removed).
+ queryResolver.resolve();
+ info("Waiting for second query to finish");
+ await queryPromise;
+ info("Second query finished");
+
+ rows = UrlbarTestUtils.getResultsContainer(window);
+ Assert.equal(
+ rows.children.length,
+ // + 1 for the heurustic.
+ 1 + expected.length,
+ "The view has the expected number of rows"
+ );
+
+ // Check the visible rows (except the heuristic).
+ for (let i = 0; i < expected.length; i++) {
+ let { source, type, url } = expected[i];
+ let index = i + 1;
+ let row = rows.children[index];
+ Assert.ok(row, `rows[${index}] should exist`);
+ Assert.ok(
+ BrowserTestUtils.isVisible(row),
+ `rows[${index}] should be visible`
+ );
+ Assert.equal(
+ row.result.type,
+ type,
+ `rows[${index}].result.type should be as expected`
+ );
+ Assert.equal(
+ row.result.source,
+ source,
+ `rows[${index}].result.source should be as expected`
+ );
+ Assert.equal(
+ row.result.payload.url,
+ url,
+ `rows[${index}] URL should be as expected`
+ );
+ }
+
+ // Close the view. Blur the urlbar to end the session.
+ info("Closing view and blurring");
+ await UrlbarTestUtils.promisePopupClose(window);
+ gURLBar.blur();
+
+ // An exposure for the history result should have been recorded.
+ assertExposureTelemetry([{ results: "history" }]);
+
+ // Clean up.
+ await SpecialPowers.popPrefEnv();
+ Services.fog.testResetFOG();
+ gProvider.finishQueryPromise = null;
+}
+
+// Does the following:
+//
+// 1. Starts and finishes a query that fills up the view
+// 2. Starts a second query with results that cannot replace rows from the first
+// query and that therefore must be appended and hidden
+// 3. Before the second query finishes (i.e., before stale rows are removed),
+// starts and finishes a third query (after which stale rows are removed)
+//
+// Results in the third query should trigger an exposure since they become
+// visible when the query finishes (and stale rows are removed) in step 3.
+// Results in the second query should not trigger an exposure since they could
+// never be visible since the query is canceled before stale rows are removed.
+add_task(async function exposure_append_full_twice() {
+ for (let showExposureResults of [true, false]) {
+ await do_exposure_append_full_twice(showExposureResults);
+ }
+});
+
+async function do_exposure_append_full_twice(showExposureResults) {
+ info(
+ "Starting do_exposure_append_full_twice: " +
+ JSON.stringify({ showExposureResults })
+ );
+
+ // Exposure results are history and tab.
+ await SpecialPowers.pushPrefEnv({
+ set: [
+ ["browser.urlbar.exposureResults", "history,tab"],
+ ["browser.urlbar.showExposureResults", showExposureResults],
+ ],
+ });
+
+ // Make the provider return enough search suggestions to fill the view.
+ gProvider.results = [];
+ for (let i = 0; i < MAX_RESULT_COUNT; i++) {
+ gProvider.results.push(
+ new UrlbarResult(
+ UrlbarUtils.RESULT_TYPE.SEARCH,
+ UrlbarUtils.RESULT_SOURCE.SEARCH,
+ {
+ suggestion: "suggestion " + i,
+ engine: Services.search.defaultEngine.name,
+ }
+ )
+ );
+ }
+
+ // Do the first query to fill the view with search suggestions.
+ info("Doing first query");
+ await UrlbarTestUtils.promiseAutocompleteResultPopup({
+ window,
+ value: "test 1",
+ });
+
+ // Now make the provider return a history result, tab, and bookmark. If
+ // `showExposureResults` is true, the history and tab results will be added to
+ // the view but they should be hidden since the view is already full. If it's
+ // false, they shouldn't be added at all. The bookmark will always be added,
+ // which will tell us when the view has been updated either way. (It also will
+ // be hidden since the view is already full.)
+ let historyUrl = "https://example.com/history";
+ let tabUrl = "https://example.com/tab";
+ let bookmarkUrl = "https://example.com/bookmark";
+ gProvider.results = [
+ new UrlbarResult(
+ UrlbarUtils.RESULT_TYPE.URL,
+ UrlbarUtils.RESULT_SOURCE.HISTORY,
+ { url: historyUrl }
+ ),
+ new UrlbarResult(
+ UrlbarUtils.RESULT_TYPE.TAB_SWITCH,
+ UrlbarUtils.RESULT_SOURCE.TABS,
+ { url: tabUrl }
+ ),
+ new UrlbarResult(
+ UrlbarUtils.RESULT_TYPE.URL,
+ UrlbarUtils.RESULT_SOURCE.BOOKMARKS,
+ { url: bookmarkUrl }
+ ),
+ ];
+
+ // When the provider's `startQuery()` is called, let it add its results but
+ // don't let it return. That will cause the view to be updated with the new
+ // results but prevent it from showing hidden rows since the query won't
+ // finish (so stale rows won't be removed).
+ let secondQueryResolver = Promise.withResolvers();
+ gProvider.finishQueryPromise = secondQueryResolver.promise;
+
+ // Observe when the view appends the bookmark row. This will tell us when the
+ // view has been updated with the provider's new results. The bookmark row
+ // will be hidden since the view is already full with search suggestions.
+ let lastRowPromise = promiseLastRowAppended(
+ row => row.result.payload.url == bookmarkUrl
+ );
+
+ // Now start the second query but don't await it.
+ info("Starting second query");
+ let secondQueryPromise = UrlbarTestUtils.promiseAutocompleteResultPopup({
+ window,
+ value: "test 2",
+ reopenOnBlur: false,
+ });
+
+ // Wait for the view to be updated.
+ info("Waiting for last row");
+ let lastRow = await lastRowPromise;
+ info("Done waiting for last row");
+
+ Assert.ok(
+ BrowserTestUtils.isHidden(lastRow),
+ "The new bookmark row should be hidden since the view is full"
+ );
+
+ // Make sure the view is full of visible rows as expected, plus the one or
+ // three hidden rows for the history, tab, and bookmark results.
+ let expected = [
+ {
+ source: UrlbarUtils.RESULT_SOURCE.BOOKMARKS,
+ type: UrlbarUtils.RESULT_TYPE.URL,
+ url: bookmarkUrl,
+ },
+ ];
+ if (showExposureResults) {
+ expected.unshift(
+ {
+ source: UrlbarUtils.RESULT_SOURCE.HISTORY,
+ type: UrlbarUtils.RESULT_TYPE.URL,
+ url: historyUrl,
+ },
+ {
+ source: UrlbarUtils.RESULT_SOURCE.TABS,
+ type: UrlbarUtils.RESULT_TYPE.TAB_SWITCH,
+ url: tabUrl,
+ }
+ );
+ }
+ let rows = UrlbarTestUtils.getResultsContainer(window);
+ Assert.equal(
+ rows.children.length,
+ MAX_RESULT_COUNT + expected.length,
+ "The view has the expected number of rows"
+ );
+
+ // Check the visible rows.
+ for (let i = 0; i < MAX_RESULT_COUNT; i++) {
+ let row = rows.children[i];
+ Assert.ok(BrowserTestUtils.isVisible(row), `rows[${i}] should be visible`);
+ Assert.ok(
+ row.result.type == UrlbarUtils.RESULT_TYPE.SEARCH,
+ `rows[${i}].result.type should be SEARCH`
+ );
+ // The heuristic won't have a suggestion so skip it.
+ if (i > 0) {
+ Assert.ok(
+ row.result.payload.suggestion,
+ `rows[${i}] should have a suggestion`
+ );
+ }
+ }
+
+ // Check the hidden history, tab, and bookmark rows.
+ for (let i = 0; i < expected.length; i++) {
+ let { source, type, url } = expected[i];
+ let row = rows.children[MAX_RESULT_COUNT + i];
+ Assert.ok(row, `rows[${i}] should exist`);
+ Assert.ok(BrowserTestUtils.isHidden(row), `rows[${i}] should be hidden`);
+ Assert.equal(
+ row.result.type,
+ type,
+ `rows[${i}].result.type should be as expected`
+ );
+ Assert.equal(
+ row.result.source,
+ source,
+ `rows[${i}].result.source should be as expected`
+ );
+ Assert.equal(
+ row.result.payload.url,
+ url,
+ `rows[${i}] URL should be as expected`
+ );
+ }
+
+ // Now make the provider return only a history result.
+ gProvider.results = [
+ new UrlbarResult(
+ UrlbarUtils.RESULT_TYPE.URL,
+ UrlbarUtils.RESULT_SOURCE.HISTORY,
+ { url: historyUrl }
+ ),
+ ];
+
+ // Without waiting for the second query to finish (i.e., before stale rows are
+ // removed), do a third query and allow it to finish (so stale rows are
+ // removed). An exposure should be recorded for the history result since it's
+ // present in the third query. An exposure should not be recorded for the tab
+ // result because it could not have been visible since the second query did
+ // not finish.
+
+ let thirdQueryStartedPromise = new Promise(resolve => {
+ let queryListener = {
+ onQueryStarted: () => {
+ gURLBar.controller.removeQueryListener(queryListener);
+ resolve();
+ },
+ };
+ gURLBar.controller.addQueryListener(queryListener);
+ });
+
+ info("Starting third query");
+ let thirdQueryPromise = UrlbarTestUtils.promiseAutocompleteResultPopup({
+ window,
+ value: "test 3",
+ reopenOnBlur: false,
+ });
+
+ // The test provider's `startQuery()` is still awaiting its
+ // `finishQueryPromise`, so we need to resolve it so the provider can respond
+ // to the third query. But before we do that, we need to make sure the third
+ // query has started and canceled the second query because otherwise the
+ // second query could finish and cause stale rows to be removed.
+ info("Waiting for third query to start");
+ await thirdQueryStartedPromise;
+ info("Resolving provider's finishQueryPromise");
+ secondQueryResolver.resolve();
+
+ // Now wait for the third query to finish.
+ info("Waiting for third query to finish");
+ await thirdQueryPromise;
+
+ expected = [];
+ if (showExposureResults) {
+ expected.unshift({
+ source: UrlbarUtils.RESULT_SOURCE.HISTORY,
+ type: UrlbarUtils.RESULT_TYPE.URL,
+ url: historyUrl,
+ });
+ }
+
+ rows = UrlbarTestUtils.getResultsContainer(window);
+ Assert.equal(
+ rows.children.length,
+ // + 1 for the heurustic.
+ 1 + expected.length,
+ "The view has the expected number of rows"
+ );
+
+ // Check the history row.
+ for (let i = 0; i < expected.length; i++) {
+ let { source, type, url } = expected[i];
+ let index = i + 1;
+ let row = rows.children[index];
+ Assert.ok(row, `rows[${index}] should exist`);
+ Assert.ok(
+ BrowserTestUtils.isVisible(row),
+ `rows[${index}] should be visible`
+ );
+ Assert.equal(
+ row.result.type,
+ type,
+ `rows[${index}].result.type should be as expected`
+ );
+ Assert.equal(
+ row.result.source,
+ source,
+ `rows[${index}].result.source should be as expected`
+ );
+ Assert.equal(
+ row.result.payload.url,
+ url,
+ `rows[${index}] URL should be as expected`
+ );
+ }
+
+ // Close the view. Blur the urlbar to end the session.
+ info("Closing view and blurring");
+ await UrlbarTestUtils.promisePopupClose(window);
+ gURLBar.blur();
+
+ // An exposure only for the history result should have been recorded. If an
+ // exposure was also incorrectly recorded for the tab result, this will fail
+ // with "history,tab" instead of only "history".
+ assertExposureTelemetry([{ results: "history" }]);
+
+ // Clean up.
+ await secondQueryPromise;
+ await SpecialPowers.popPrefEnv();
+ Services.fog.testResetFOG();
+ gProvider.finishQueryPromise = null;
}
/**
@@ -523,7 +1065,7 @@ class TestProvider extends UrlbarTestUtils.TestProvider {
function promiseLastRowAppended(predicate) {
return new Promise(resolve => {
let rows = UrlbarTestUtils.getResultsContainer(window);
- let observer = new MutationObserver(mutations => {
+ let observer = new MutationObserver(() => {
let lastRow = rows.children[rows.children.length - 1];
info(
"Observed mutation, lastRow.result is: " +
diff --git a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_groups.js b/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_groups.js
deleted file mode 100644
index 354876e512..0000000000
--- a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_groups.js
+++ /dev/null
@@ -1,258 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-// Test for the following data of impression telemetry.
-// - groups
-// - results
-// - n_results
-
-// This test has many subtests and can time out in verify mode.
-requestLongerTimeout(5);
-
-add_setup(async function () {
- await initGroupTest();
- // Increase the pausing time to ensure to ready for all suggestions.
- await SpecialPowers.pushPrefEnv({
- set: [
- [
- "browser.urlbar.searchEngagementTelemetry.pauseImpressionIntervalMs",
- 500,
- ],
- ],
- });
-});
-
-add_task(async function heuristics() {
- await doHeuristicsTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([
- { reason: "pause", groups: "heuristic", results: "search_engine" },
- ]),
- });
-});
-
-add_task(async function adaptive_history() {
- await doAdaptiveHistoryTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([
- {
- reason: "pause",
- groups: "heuristic,adaptive_history",
- results: "search_engine,history",
- n_results: 2,
- },
- ]),
- });
-});
-
-add_task(async function search_history() {
- await doSearchHistoryTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([
- {
- reason: "pause",
- groups: "heuristic,search_history,search_history",
- results: "search_engine,search_history,search_history",
- n_results: 3,
- },
- ]),
- });
-});
-
-add_task(async function recent_search() {
- await doRecentSearchTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([
- {
- reason: "pause",
- groups: "recent_search,suggested_index",
- results: "recent_search,action",
- n_results: 2,
- },
- ]),
- });
-});
-
-add_task(async function search_suggest() {
- await doSearchSuggestTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([
- {
- reason: "pause",
- groups: "heuristic,search_suggest,search_suggest",
- results: "search_engine,search_suggest,search_suggest",
- n_results: 3,
- },
- ]),
- });
-
- await doTailSearchSuggestTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([
- {
- reason: "pause",
- groups: "heuristic,search_suggest",
- results: "search_engine,search_suggest",
- n_results: 2,
- },
- ]),
- });
-});
-
-add_task(async function top_pick() {
- await doTopPickTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([
- {
- reason: "pause",
- groups: "heuristic,top_pick,search_suggest,search_suggest",
- results:
- "search_engine,merino_top_picks,search_suggest,search_suggest",
- n_results: 4,
- },
- ]),
- });
-});
-
-add_task(async function top_site() {
- await doTopSiteTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([
- {
- reason: "pause",
- groups: "top_site,suggested_index",
- results: "top_site,action",
- n_results: 2,
- },
- ]),
- });
-});
-
-add_task(async function clipboard() {
- await doClipboardTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([
- {
- reason: "pause",
- groups: "general,suggested_index",
- results: "clipboard,action",
- n_results: 2,
- },
- ]),
- });
-});
-
-add_task(async function remote_tab() {
- await doRemoteTabTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([
- {
- reason: "pause",
- groups: "heuristic,remote_tab",
- results: "search_engine,remote_tab",
- n_results: 2,
- },
- ]),
- });
-});
-
-add_task(async function addon() {
- await doAddonTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([
- {
- reason: "pause",
- groups: "addon",
- results: "addon",
- n_results: 1,
- },
- ]),
- });
-});
-
-add_task(async function general() {
- await doGeneralBookmarkTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([
- {
- reason: "pause",
- groups: "heuristic,suggested_index,general",
- results: "search_engine,action,bookmark",
- n_results: 3,
- },
- ]),
- });
-
- await doGeneralHistoryTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([
- {
- reason: "pause",
- groups: "heuristic,general",
- results: "search_engine,history",
- n_results: 2,
- },
- ]),
- });
-});
-
-add_task(async function suggest() {
- await doSuggestTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([
- {
- groups: "heuristic,suggest",
- results: UrlbarPrefs.get("quickSuggestRustEnabled")
- ? "search_engine,rust_adm_nonsponsored"
- : "search_engine,rs_adm_nonsponsored",
- n_results: 2,
- },
- ]),
- });
-});
-
-add_task(async function about_page() {
- await doAboutPageTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([
- {
- reason: "pause",
- groups: "heuristic,about_page,about_page",
- results: "search_engine,history,history",
- n_results: 3,
- },
- ]),
- });
-});
-
-add_task(async function suggested_index() {
- await doSuggestedIndexTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([
- {
- reason: "pause",
- groups: "heuristic,suggested_index",
- results: "search_engine,unit",
- n_results: 2,
- },
- ]),
- });
-});
diff --git a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_interaction.js b/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_interaction.js
deleted file mode 100644
index a16b55cac6..0000000000
--- a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_interaction.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-// Test for the following data of impression telemetry.
-// - interaction
-
-add_setup(async function () {
- await initInteractionTest();
-});
-
-add_task(async function topsites() {
- await doTopsitesTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([{ reason: "pause", interaction: "topsites" }]),
- });
-});
-
-add_task(async function typed() {
- await doTypedTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([{ reason: "pause", interaction: "typed" }]),
- });
-
- await doTypedWithResultsPopupTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([{ reason: "pause", interaction: "typed" }]),
- });
-});
-
-add_task(async function pasted() {
- await doPastedTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([{ reason: "pause", interaction: "pasted" }]),
- });
-
- await doPastedWithResultsPopupTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([{ reason: "pause", interaction: "pasted" }]),
- });
-});
-
-add_task(async function topsite_search() {
- await doTopsitesSearchTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([
- { reason: "pause", interaction: "topsite_search" },
- ]),
- });
-});
-
-add_task(async function returned_restarted_refined() {
- await doReturnedRestartedRefinedTest({
- trigger: () => waitForPauseImpression(),
- assert: expected =>
- assertImpressionTelemetry([
- { reason: "pause" },
- { reason: "pause", interaction: expected },
- ]),
- });
-});
diff --git a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_interaction_persisted_search_terms_disabled.js b/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_interaction_persisted_search_terms_disabled.js
deleted file mode 100644
index af7134b3a0..0000000000
--- a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_interaction_persisted_search_terms_disabled.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-// Test impression telemetry with persisted search terms disabled.
-
-// Allow more time for Mac machines so they don't time out in verify mode.
-if (AppConstants.platform == "macosx") {
- requestLongerTimeout(3);
-}
-
-add_setup(async function () {
- await initInteractionTest();
-
- await SpecialPowers.pushPrefEnv({
- set: [["browser.urlbar.showSearchTerms.featureGate", false]],
- });
-});
-
-add_task(async function persisted_search_terms() {
- await doPersistedSearchTermsTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([
- { reason: "pause" },
- { reason: "pause", interaction: "typed" },
- ]),
- });
-});
-
-add_task(async function persisted_search_terms_restarted_refined() {
- await doPersistedSearchTermsRestartedRefinedTest({
- enabled: false,
- trigger: () => waitForPauseImpression(),
- assert: expected =>
- assertImpressionTelemetry([
- { reason: "pause" },
- { reason: "pause", interaction: expected },
- ]),
- });
-});
-
-add_task(
- async function persisted_search_terms_restarted_refined_via_abandonment() {
- await doPersistedSearchTermsRestartedRefinedViaAbandonmentTest({
- enabled: false,
- trigger: () => waitForPauseImpression(),
- assert: expected =>
- assertImpressionTelemetry([
- { reason: "pause" },
- { reason: "pause" },
- { reason: "pause", interaction: expected },
- ]),
- });
- }
-);
diff --git a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_interaction_persisted_search_terms_enabled.js b/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_interaction_persisted_search_terms_enabled.js
deleted file mode 100644
index a29ff98b78..0000000000
--- a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_interaction_persisted_search_terms_enabled.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-// Test impression telemetry with persisted search terms enabled.
-
-// Allow more time for Mac machines so they don't time out in verify mode.
-if (AppConstants.platform == "macosx") {
- requestLongerTimeout(3);
-}
-
-add_setup(async function () {
- await initInteractionTest();
-
- await SpecialPowers.pushPrefEnv({
- set: [
- ["browser.urlbar.showSearchTerms.featureGate", true],
- ["browser.urlbar.showSearchTerms.enabled", true],
- ["browser.search.widget.inNavBar", false],
- ],
- });
-});
-
-add_task(async function interaction_persisted_search_terms() {
- await doPersistedSearchTermsTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([
- { reason: "pause" },
- { reason: "pause", interaction: "persisted_search_terms" },
- ]),
- });
-});
-
-add_task(async function interaction_persisted_search_terms_restarted_refined() {
- await doPersistedSearchTermsRestartedRefinedTest({
- enabled: true,
- trigger: () => waitForPauseImpression(),
- assert: expected =>
- assertImpressionTelemetry([
- { reason: "pause" },
- { reason: "pause", interaction: expected },
- ]),
- });
-});
-
-add_task(
- async function interaction_persisted_search_terms_restarted_refined_via_abandonment() {
- await doPersistedSearchTermsRestartedRefinedViaAbandonmentTest({
- enabled: true,
- trigger: () => waitForPauseImpression(),
- assert: expected =>
- assertImpressionTelemetry([
- { reason: "pause" },
- { reason: "pause" },
- { reason: "pause", interaction: expected },
- ]),
- });
- }
-);
diff --git a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_n_chars_n_words.js b/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_n_chars_n_words.js
deleted file mode 100644
index 528cc318e0..0000000000
--- a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_n_chars_n_words.js
+++ /dev/null
@@ -1,40 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-// Test for the following data of impression telemetry.
-// - n_chars
-// - n_words
-
-add_setup(async function () {
- await initNCharsAndNWordsTest();
-});
-
-add_task(async function n_chars() {
- await doNCharsTest({
- trigger: () => waitForPauseImpression(),
- assert: nChars =>
- assertImpressionTelemetry([{ reason: "pause", n_chars: nChars }]),
- });
-
- await doNCharsWithOverMaxTextLengthCharsTest({
- trigger: () => waitForPauseImpression(),
- assert: nChars =>
- assertImpressionTelemetry([{ reason: "pause", n_chars: nChars }]),
- });
-});
-
-add_task(async function n_words() {
- await doNWordsTest({
- trigger: () => waitForPauseImpression(),
- assert: nWords =>
- assertImpressionTelemetry([{ reason: "pause", n_words: nWords }]),
- });
-
- await doNWordsWithOverMaxTextLengthCharsTest({
- trigger: () => waitForPauseImpression(),
- assert: nWords =>
- assertImpressionTelemetry([{ reason: "pause", n_words: nWords }]),
- });
-});
diff --git a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_preferences.js b/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_preferences.js
deleted file mode 100644
index 344e238e24..0000000000
--- a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_preferences.js
+++ /dev/null
@@ -1,41 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-// Test the impression telemetry behavior with its preferences.
-
-add_setup(async function () {
- await setup();
-});
-
-add_task(async function pauseImpressionIntervalMs() {
- const additionalInterval = 1000;
- const originalInterval = UrlbarPrefs.get(
- "searchEngagementTelemetry.pauseImpressionIntervalMs"
- );
- await SpecialPowers.pushPrefEnv({
- set: [
- [
- "browser.urlbar.searchEngagementTelemetry.pauseImpressionIntervalMs",
- originalInterval + additionalInterval,
- ],
- ],
- });
-
- await doTest(async browser => {
- await openPopup("https://example.com");
-
- // eslint-disable-next-line mozilla/no-arbitrary-setTimeout
- await new Promise(r => setTimeout(r, originalInterval));
- await Services.fog.testFlushAllChildren();
- assertImpressionTelemetry([]);
-
- // eslint-disable-next-line mozilla/no-arbitrary-setTimeout
- await new Promise(r => setTimeout(r, additionalInterval));
- await Services.fog.testFlushAllChildren();
- assertImpressionTelemetry([{ sap: "urlbar_newtab" }]);
- });
-
- await SpecialPowers.popPrefEnv();
-});
diff --git a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_sap.js b/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_sap.js
deleted file mode 100644
index 482b906024..0000000000
--- a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_sap.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-// Test for the following data of impression telemetry.
-// - sap
-
-add_setup(async function () {
- await initSapTest();
-});
-
-add_task(async function urlbar() {
- await doUrlbarTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([
- { reason: "pause", sap: "urlbar_newtab" },
- { reason: "pause", sap: "urlbar" },
- ]),
- });
-});
-
-add_task(async function handoff() {
- await doHandoffTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([{ reason: "pause", sap: "handoff" }]),
- });
-});
-
-add_task(async function urlbar_addonpage() {
- await doUrlbarAddonpageTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([{ reason: "pause", sap: "urlbar_addonpage" }]),
- });
-});
diff --git a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_search_engine_default_id.js b/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_search_engine_default_id.js
deleted file mode 100644
index c5bd983d7f..0000000000
--- a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_search_engine_default_id.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-// Test for the following data of impression telemetry.
-// - search_engine_default_id
-
-add_setup(async function () {
- await initSearchEngineDefaultIdTest();
- // Increase the pausing time to ensure to ready for all suggestions.
- await SpecialPowers.pushPrefEnv({
- set: [
- [
- "browser.urlbar.searchEngagementTelemetry.pauseImpressionIntervalMs",
- 500,
- ],
- ],
- });
-});
-
-add_task(async function basic() {
- await doSearchEngineDefaultIdTest({
- trigger: () => waitForPauseImpression(),
- assert: engineId =>
- assertImpressionTelemetry([{ search_engine_default_id: engineId }]),
- });
-});
diff --git a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_search_mode.js b/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_search_mode.js
deleted file mode 100644
index 727afa3cef..0000000000
--- a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_search_mode.js
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-// Test for the following data of impression telemetry.
-// - search_mode
-
-add_setup(async function () {
- await initSearchModeTest();
- // Increase the pausing time to ensure entering search mode.
- await SpecialPowers.pushPrefEnv({
- set: [
- [
- "browser.urlbar.searchEngagementTelemetry.pauseImpressionIntervalMs",
- 1000,
- ],
- ],
- });
-});
-
-add_task(async function not_search_mode() {
- await doNotSearchModeTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([{ reason: "pause", search_mode: "" }]),
- });
-});
-
-add_task(async function search_engine() {
- await doSearchEngineTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([
- { reason: "pause", search_mode: "search_engine" },
- ]),
- });
-});
-
-add_task(async function bookmarks() {
- await doBookmarksTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([
- { reason: "pause", search_mode: "bookmarks" },
- ]),
- });
-});
-
-add_task(async function history() {
- await doHistoryTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([{ reason: "pause", search_mode: "history" }]),
- });
-});
-
-add_task(async function tabs() {
- await doTabTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([{ reason: "pause", search_mode: "tabs" }]),
- });
-});
-
-add_task(async function actions() {
- await doActionsTest({
- trigger: () => waitForPauseImpression(),
- assert: () =>
- assertImpressionTelemetry([{ reason: "pause", search_mode: "actions" }]),
- });
-});
diff --git a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_timing.js b/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_timing.js
deleted file mode 100644
index 31f64996f3..0000000000
--- a/browser/components/urlbar/tests/engagementTelemetry/browser/browser_glean_telemetry_impression_timing.js
+++ /dev/null
@@ -1,91 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-// Test for the taking timing for the impression telemetry.
-
-add_setup(async function () {
- await setup();
-});
-
-add_task(async function cancelImpressionTimerByEngagementEvent() {
- const additionalInterval = 1000;
- const originalInterval = UrlbarPrefs.get(
- "searchEngagementTelemetry.pauseImpressionIntervalMs"
- );
- await SpecialPowers.pushPrefEnv({
- set: [
- [
- "browser.urlbar.searchEngagementTelemetry.pauseImpressionIntervalMs",
- originalInterval + additionalInterval,
- ],
- ],
- });
-
- for (const trigger of [doEnter, doBlur]) {
- await doTest(async browser => {
- await openPopup("https://example.com");
- await trigger();
-
- // Check whether the impression timer was canceled.
- await new Promise(r =>
- // eslint-disable-next-line mozilla/no-arbitrary-setTimeout
- setTimeout(r, originalInterval + additionalInterval)
- );
- assertImpressionTelemetry([]);
- });
- }
-
- await SpecialPowers.popPrefEnv();
-});
-
-add_task(async function cancelInpressionTimerByType() {
- const originalInterval = UrlbarPrefs.get(
- "searchEngagementTelemetry.pauseImpressionIntervalMs"
- );
-
- await doTest(async browser => {
- await openPopup("x");
- await new Promise(r =>
- // eslint-disable-next-line mozilla/no-arbitrary-setTimeout
- setTimeout(r, originalInterval / 10)
- );
- assertImpressionTelemetry([]);
-
- EventUtils.synthesizeKey(" ");
- EventUtils.synthesizeKey("z");
- await UrlbarTestUtils.promiseSearchComplete(window);
- assertImpressionTelemetry([]);
- await waitForPauseImpression();
-
- assertImpressionTelemetry([{ n_chars: 3 }]);
- });
-});
-
-add_task(async function oneImpressionInOneSession() {
- await doTest(async browser => {
- await openPopup("x");
- await waitForPauseImpression();
-
- // Sanity check.
- assertImpressionTelemetry([{ n_chars: 1 }]);
-
- // Add a keyword to start new query.
- EventUtils.synthesizeKey(" ");
- EventUtils.synthesizeKey("z");
- await UrlbarTestUtils.promiseSearchComplete(window);
- await waitForPauseImpression();
-
- // No more taking impression telemetry.
- assertImpressionTelemetry([{ n_chars: 1 }]);
-
- // Finish the current session.
- await doEnter();
-
- // Should take pause impression since new session started.
- await openPopup("x z y");
- await waitForPauseImpression();
- assertImpressionTelemetry([{ n_chars: 1 }, { n_chars: 5 }]);
- });
-});
diff --git a/browser/components/urlbar/tests/engagementTelemetry/browser/head-groups.js b/browser/components/urlbar/tests/engagementTelemetry/browser/head-groups.js
index e86c664b46..cc73c7509f 100644
--- a/browser/components/urlbar/tests/engagementTelemetry/browser/head-groups.js
+++ b/browser/components/urlbar/tests/engagementTelemetry/browser/head-groups.js
@@ -11,7 +11,7 @@ ChromeUtils.defineESModuleGetters(this, {
});
async function doHeuristicsTest({ trigger, assert }) {
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("x");
await trigger();
@@ -24,7 +24,7 @@ async function doAdaptiveHistoryTest({ trigger, assert }) {
set: [["browser.urlbar.autoFill", false]],
});
- await doTest(async browser => {
+ await doTest(async () => {
await PlacesTestUtils.addVisits(["https://example.com/test"]);
await UrlbarUtils.addToInputHistory("https://example.com/test", "examp");
@@ -46,7 +46,7 @@ async function doSearchHistoryTest({ trigger, assert }) {
],
});
- await doTest(async browser => {
+ await doTest(async () => {
await UrlbarTestUtils.formHistory.add(["foofoo", "foobar"]);
await openPopup("foo");
@@ -64,7 +64,7 @@ async function doRecentSearchTest({ trigger, assert }) {
set: [["browser.urlbar.recentsearches.featureGate", true]],
});
- await doTest(async browser => {
+ await doTest(async () => {
await UrlbarTestUtils.formHistory.add([
{ value: "foofoo", source: Services.search.defaultEngine.name },
]);
@@ -87,7 +87,7 @@ async function doSearchSuggestTest({ trigger, assert }) {
],
});
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("foo");
await selectRowByURL("http://mochi.test:8888/?terms=foofoo");
@@ -101,7 +101,7 @@ async function doSearchSuggestTest({ trigger, assert }) {
async function doTailSearchSuggestTest({ trigger, assert }) {
const cleanup = await _useTailSuggestionsEngine();
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("hello");
await selectRowByProvider("SearchSuggestions");
@@ -127,7 +127,7 @@ async function doTopPickTest({ trigger, assert }) {
],
});
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("navigational");
await selectRowByURL("https://example.com/navigational-suggestion");
@@ -139,7 +139,7 @@ async function doTopPickTest({ trigger, assert }) {
}
async function doTopSiteTest({ trigger, assert }) {
- await doTest(async browser => {
+ await doTest(async () => {
await addTopSites("https://example.com/");
await showResultByArrowDown();
@@ -158,7 +158,7 @@ async function doClipboardTest({ trigger, assert }) {
],
});
SpecialPowers.clipboardCopyString("https://example.com/clipboard");
- await doTest(async browser => {
+ await doTest(async () => {
await showResultByArrowDown();
await selectRowByURL("https://example.com/clipboard");
@@ -173,7 +173,7 @@ async function doClipboardTest({ trigger, assert }) {
async function doRemoteTabTest({ trigger, assert }) {
const remoteTab = await loadRemoteTab("https://example.com");
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("example");
await selectRowByProvider("RemoteTabs");
@@ -188,7 +188,7 @@ async function doAddonTest({ trigger, assert }) {
const addon = loadOmniboxAddon({ keyword: "omni" });
await addon.startup();
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("omni test");
await trigger();
@@ -199,7 +199,7 @@ async function doAddonTest({ trigger, assert }) {
}
async function doGeneralBookmarkTest({ trigger, assert }) {
- await doTest(async browser => {
+ await doTest(async () => {
await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
url: "https://example.com/bookmark",
@@ -219,7 +219,7 @@ async function doGeneralHistoryTest({ trigger, assert }) {
set: [["browser.urlbar.autoFill", false]],
});
- await doTest(async browser => {
+ await doTest(async () => {
await PlacesTestUtils.addVisits("https://example.com/test");
await openPopup("example");
@@ -235,7 +235,7 @@ async function doGeneralHistoryTest({ trigger, assert }) {
async function doSuggestTest({ trigger, assert }) {
const cleanupQuickSuggest = await ensureQuickSuggestInit();
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("nonsponsored");
await selectRowByURL("https://example.com/nonsponsored");
@@ -251,7 +251,7 @@ async function doAboutPageTest({ trigger, assert }) {
set: [["browser.urlbar.maxRichResults", 3]],
});
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("about:");
await selectRowByURL("about:robots");
@@ -267,7 +267,7 @@ async function doSuggestedIndexTest({ trigger, assert }) {
set: [["browser.urlbar.unitConversion.enabled", true]],
});
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("1m to cm");
await selectRowByProvider("UnitConversion");
diff --git a/browser/components/urlbar/tests/engagementTelemetry/browser/head-interaction.js b/browser/components/urlbar/tests/engagementTelemetry/browser/head-interaction.js
index 244e27d272..58c55b416f 100644
--- a/browser/components/urlbar/tests/engagementTelemetry/browser/head-interaction.js
+++ b/browser/components/urlbar/tests/engagementTelemetry/browser/head-interaction.js
@@ -14,7 +14,7 @@ ChromeUtils.defineESModuleGetters(this, {
});
async function doTopsitesTest({ trigger, assert }) {
- await doTest(async browser => {
+ await doTest(async () => {
await addTopSites("https://example.com/");
await showResultByArrowDown();
@@ -120,7 +120,7 @@ async function doTopsitesSearchTest({ trigger, assert }) {
}
async function doTypedTest({ trigger, assert }) {
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("x");
await trigger();
@@ -129,7 +129,7 @@ async function doTypedTest({ trigger, assert }) {
}
async function doTypedWithResultsPopupTest({ trigger, assert }) {
- await doTest(async browser => {
+ await doTest(async () => {
await showResultByArrowDown();
EventUtils.synthesizeKey("x");
await UrlbarTestUtils.promiseSearchComplete(window);
@@ -140,7 +140,7 @@ async function doTypedWithResultsPopupTest({ trigger, assert }) {
}
async function doPastedTest({ trigger, assert }) {
- await doTest(async browser => {
+ await doTest(async () => {
await doPaste("www.example.com");
await trigger();
@@ -149,7 +149,7 @@ async function doPastedTest({ trigger, assert }) {
}
async function doPastedWithResultsPopupTest({ trigger, assert }) {
- await doTest(async browser => {
+ await doTest(async () => {
await showResultByArrowDown();
await doPaste("x");
@@ -189,9 +189,8 @@ async function doReturnedRestartedRefinedTest({ trigger, assert }) {
];
for (const { firstInput, secondInput, expected } of testData) {
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup(firstInput);
- await waitForPauseImpression();
await doBlur();
await UrlbarTestUtils.promisePopupOpen(window, () => {
@@ -211,9 +210,8 @@ async function doReturnedRestartedRefinedTest({ trigger, assert }) {
}
async function doPersistedSearchTermsTest({ trigger, assert }) {
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("x");
- await waitForPauseImpression();
await doEnter();
await openPopup("x");
@@ -258,9 +256,8 @@ async function doPersistedSearchTermsRestartedRefinedTest({
];
for (const { firstInput, secondInput, expected } of testData) {
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup(firstInput);
- await waitForPauseImpression();
await doEnter();
await UrlbarTestUtils.promisePopupOpen(window, () => {
@@ -314,13 +311,11 @@ async function doPersistedSearchTermsRestartedRefinedViaAbandonmentTest({
];
for (const { firstInput, secondInput, expected } of testData) {
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("any search");
- await waitForPauseImpression();
await doEnter();
await openPopup(firstInput);
- await waitForPauseImpression();
await doBlur();
await UrlbarTestUtils.promisePopupOpen(window, () => {
diff --git a/browser/components/urlbar/tests/engagementTelemetry/browser/head-n_chars_n_words.js b/browser/components/urlbar/tests/engagementTelemetry/browser/head-n_chars_n_words.js
index 6d4c61c7f0..154f3ec11c 100644
--- a/browser/components/urlbar/tests/engagementTelemetry/browser/head-n_chars_n_words.js
+++ b/browser/components/urlbar/tests/engagementTelemetry/browser/head-n_chars_n_words.js
@@ -7,7 +7,7 @@
async function doNCharsTest({ trigger, assert }) {
for (const input of ["x", "xx", "xx x", "xx x "]) {
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup(input);
await trigger();
@@ -17,7 +17,7 @@ async function doNCharsTest({ trigger, assert }) {
}
async function doNCharsWithOverMaxTextLengthCharsTest({ trigger, assert }) {
- await doTest(async browser => {
+ await doTest(async () => {
let input = "";
for (let i = 0; i < UrlbarUtils.MAX_TEXT_LENGTH * 2; i++) {
input += "x";
@@ -31,7 +31,7 @@ async function doNCharsWithOverMaxTextLengthCharsTest({ trigger, assert }) {
async function doNWordsTest({ trigger, assert }) {
for (const input of ["x", "xx", "xx x", "xx x "]) {
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup(input);
await trigger();
@@ -42,7 +42,7 @@ async function doNWordsTest({ trigger, assert }) {
}
async function doNWordsWithOverMaxTextLengthCharsTest({ trigger, assert }) {
- await doTest(async browser => {
+ await doTest(async () => {
const word = "1234 ";
let input = "";
while (input.length < UrlbarUtils.MAX_TEXT_LENGTH * 2) {
diff --git a/browser/components/urlbar/tests/engagementTelemetry/browser/head-sap.js b/browser/components/urlbar/tests/engagementTelemetry/browser/head-sap.js
index ef95873813..ee74136b22 100644
--- a/browser/components/urlbar/tests/engagementTelemetry/browser/head-sap.js
+++ b/browser/components/urlbar/tests/engagementTelemetry/browser/head-sap.js
@@ -6,7 +6,7 @@
/* import-globals-from head.js */
async function doUrlbarNewTabTest({ trigger, assert }) {
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("x");
await trigger();
@@ -15,9 +15,8 @@ async function doUrlbarNewTabTest({ trigger, assert }) {
}
async function doUrlbarTest({ trigger, assert }) {
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("x");
- await waitForPauseImpression();
await doEnter();
await openPopup("y");
diff --git a/browser/components/urlbar/tests/engagementTelemetry/browser/head-search_engine_default_id.js b/browser/components/urlbar/tests/engagementTelemetry/browser/head-search_engine_default_id.js
index c0af764e7f..5bf8cc3735 100644
--- a/browser/components/urlbar/tests/engagementTelemetry/browser/head-search_engine_default_id.js
+++ b/browser/components/urlbar/tests/engagementTelemetry/browser/head-search_engine_default_id.js
@@ -6,7 +6,7 @@
/* import-globals-from head.js */
async function doSearchEngineDefaultIdTest({ trigger, assert }) {
- await doTest(async browser => {
+ await doTest(async () => {
info("Test with current engine");
const defaultEngine = await Services.search.getDefault();
@@ -15,7 +15,7 @@ async function doSearchEngineDefaultIdTest({ trigger, assert }) {
await assert(defaultEngine.telemetryId);
});
- await doTest(async browser => {
+ await doTest(async () => {
info("Test with new engine");
const defaultEngine = await Services.search.getDefault();
const newEngineName = "NewDummyEngine";
diff --git a/browser/components/urlbar/tests/engagementTelemetry/browser/head-search_mode.js b/browser/components/urlbar/tests/engagementTelemetry/browser/head-search_mode.js
index 5c877da05f..86151e1ba3 100644
--- a/browser/components/urlbar/tests/engagementTelemetry/browser/head-search_mode.js
+++ b/browser/components/urlbar/tests/engagementTelemetry/browser/head-search_mode.js
@@ -6,7 +6,7 @@
/* import-globals-from head.js */
async function doNotSearchModeTest({ trigger, assert }) {
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("x");
await trigger();
@@ -15,7 +15,7 @@ async function doNotSearchModeTest({ trigger, assert }) {
}
async function doSearchEngineTest({ trigger, assert }) {
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("x");
await UrlbarTestUtils.enterSearchMode(window);
@@ -25,7 +25,7 @@ async function doSearchEngineTest({ trigger, assert }) {
}
async function doBookmarksTest({ trigger, assert }) {
- await doTest(async browser => {
+ await doTest(async () => {
await PlacesUtils.bookmarks.insert({
parentGuid: PlacesUtils.bookmarks.unfiledGuid,
url: "https://example.com/bookmark",
@@ -47,7 +47,7 @@ async function doHistoryTest({ trigger, assert }) {
set: [["browser.urlbar.autoFill", false]],
});
- await doTest(async browser => {
+ await doTest(async () => {
await PlacesTestUtils.addVisits("https://example.com/test");
await openPopup("example");
await UrlbarTestUtils.enterSearchMode(window, {
@@ -65,7 +65,7 @@ async function doHistoryTest({ trigger, assert }) {
async function doTabTest({ trigger, assert }) {
const tab = BrowserTestUtils.addTab(gBrowser, "https://example.com/");
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("example");
await UrlbarTestUtils.enterSearchMode(window, {
source: UrlbarUtils.RESULT_SOURCE.TABS,
@@ -80,7 +80,7 @@ async function doTabTest({ trigger, assert }) {
}
async function doActionsTest({ trigger, assert }) {
- await doTest(async browser => {
+ await doTest(async () => {
await openPopup("add");
await UrlbarTestUtils.enterSearchMode(window, {
source: UrlbarUtils.RESULT_SOURCE.ACTIONS,
diff --git a/browser/components/urlbar/tests/engagementTelemetry/browser/head.js b/browser/components/urlbar/tests/engagementTelemetry/browser/head.js
index 367387b0e8..4317a50930 100644
--- a/browser/components/urlbar/tests/engagementTelemetry/browser/head.js
+++ b/browser/components/urlbar/tests/engagementTelemetry/browser/head.js
@@ -58,10 +58,6 @@ function assertEngagementTelemetry(expectedExtraList) {
_assertGleanTelemetry("engagement", expectedExtraList);
}
-function assertImpressionTelemetry(expectedExtraList) {
- _assertGleanTelemetry("impression", expectedExtraList);
-}
-
function assertExposureTelemetry(expectedExtraList) {
_assertGleanTelemetry("exposure", expectedExtraList);
}
@@ -204,12 +200,6 @@ async function doPasteAndGo(data) {
async function doTest(testFn) {
await Services.fog.testFlushAllChildren();
Services.fog.testResetFOG();
- // Enable recording telemetry for impression, as it is disabled by default.
- Services.fog.setMetricsFeatureConfig(
- JSON.stringify({
- "urlbar.impression": true,
- })
- );
gURLBar.controller.engagementEvent.reset();
await PlacesUtils.history.clear();
@@ -223,8 +213,8 @@ async function doTest(testFn) {
try {
await BrowserTestUtils.withNewTab(gBrowser, testFn);
- } finally {
- Services.fog.setMetricsFeatureConfig("{}");
+ } catch (e) {
+ console.error(e);
}
}
@@ -423,10 +413,6 @@ async function setup() {
["browser.urlbar.quickactions.minimumSearchString", 0],
["browser.urlbar.suggest.quickactions", true],
["browser.urlbar.shortcuts.quickactions", true],
- [
- "browser.urlbar.searchEngagementTelemetry.pauseImpressionIntervalMs",
- 100,
- ],
],
});
@@ -461,13 +447,3 @@ async function showResultByArrowDown() {
});
await UrlbarTestUtils.promiseSearchComplete(window);
}
-
-async function waitForPauseImpression() {
- await new Promise(r =>
- setTimeout(
- r,
- UrlbarPrefs.get("searchEngagementTelemetry.pauseImpressionIntervalMs")
- )
- );
- await Services.fog.testFlushAllChildren();
-}