mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1771517 - Update default search engine telemetry when changing separatePrivateDefault preferences. r=Standard8
Differential Revision: https://phabricator.services.mozilla.com/D154410
This commit is contained in:
parent
4ebfb64753
commit
a5b61e18d6
@ -2796,9 +2796,9 @@ export class SearchService {
|
||||
this.defaultPrivateEngine,
|
||||
lazy.SearchUtils.MODIFIED_TYPE.DEFAULT_PRIVATE
|
||||
);
|
||||
// Also update the telemetry data.
|
||||
this.#recordTelemetryData();
|
||||
}
|
||||
// Update the telemetry data.
|
||||
this.#recordTelemetryData();
|
||||
}
|
||||
|
||||
#getEngineInfo(engine) {
|
||||
|
@ -428,3 +428,151 @@ add_task(async function test_defaultPrivateEngine_ui_turned_off() {
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
add_task(async function test_defaultPrivateEngine_same_engine_toggle_pref() {
|
||||
Services.prefs.setBoolPref(
|
||||
SearchUtils.BROWSER_SEARCH_PREF + "separatePrivateDefault",
|
||||
true
|
||||
);
|
||||
Services.prefs.setBoolPref(
|
||||
SearchUtils.BROWSER_SEARCH_PREF + "separatePrivateDefault.ui.enabled",
|
||||
true
|
||||
);
|
||||
|
||||
// Set the normal and private engines to be the same
|
||||
Services.search.defaultEngine = engine2;
|
||||
Services.search.defaultPrivateEngine = engine2;
|
||||
|
||||
await assertGleanDefaultEngine({
|
||||
normal: {
|
||||
engineId: "engine-chromeicon",
|
||||
},
|
||||
private: {
|
||||
engineId: "engine-chromeicon",
|
||||
},
|
||||
});
|
||||
|
||||
// Disable pref
|
||||
Services.prefs.setBoolPref(
|
||||
SearchUtils.BROWSER_SEARCH_PREF + "separatePrivateDefault",
|
||||
false
|
||||
);
|
||||
Assert.equal(
|
||||
Services.search.defaultPrivateEngine,
|
||||
engine2,
|
||||
"Should not change the default private engine"
|
||||
);
|
||||
Assert.equal(
|
||||
Services.search.defaultEngine,
|
||||
engine2,
|
||||
"Should not change the default engine"
|
||||
);
|
||||
|
||||
await assertGleanDefaultEngine({
|
||||
normal: {
|
||||
engineId: "engine-chromeicon",
|
||||
},
|
||||
private: {
|
||||
engineId: "",
|
||||
},
|
||||
});
|
||||
|
||||
// Re-enable pref
|
||||
Services.prefs.setBoolPref(
|
||||
SearchUtils.BROWSER_SEARCH_PREF + "separatePrivateDefault",
|
||||
true
|
||||
);
|
||||
Assert.equal(
|
||||
Services.search.defaultPrivateEngine,
|
||||
engine2,
|
||||
"Should not change the default private engine"
|
||||
);
|
||||
Assert.equal(
|
||||
Services.search.defaultEngine,
|
||||
engine2,
|
||||
"Should not change the default engine"
|
||||
);
|
||||
|
||||
await assertGleanDefaultEngine({
|
||||
normal: {
|
||||
engineId: "engine-chromeicon",
|
||||
},
|
||||
private: {
|
||||
engineId: "engine-chromeicon",
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
add_task(async function test_defaultPrivateEngine_same_engine_toggle_ui_pref() {
|
||||
Services.prefs.setBoolPref(
|
||||
SearchUtils.BROWSER_SEARCH_PREF + "separatePrivateDefault",
|
||||
true
|
||||
);
|
||||
Services.prefs.setBoolPref(
|
||||
SearchUtils.BROWSER_SEARCH_PREF + "separatePrivateDefault.ui.enabled",
|
||||
true
|
||||
);
|
||||
|
||||
// Set the normal and private engines to be the same
|
||||
Services.search.defaultEngine = engine2;
|
||||
Services.search.defaultPrivateEngine = engine2;
|
||||
|
||||
await assertGleanDefaultEngine({
|
||||
normal: {
|
||||
engineId: "engine-chromeicon",
|
||||
},
|
||||
private: {
|
||||
engineId: "engine-chromeicon",
|
||||
},
|
||||
});
|
||||
|
||||
// Disable UI pref
|
||||
Services.prefs.setBoolPref(
|
||||
SearchUtils.BROWSER_SEARCH_PREF + "separatePrivateDefault.ui.enabled",
|
||||
false
|
||||
);
|
||||
Assert.equal(
|
||||
Services.search.defaultPrivateEngine,
|
||||
engine2,
|
||||
"Should not change the default private engine"
|
||||
);
|
||||
Assert.equal(
|
||||
Services.search.defaultEngine,
|
||||
engine2,
|
||||
"Should not change the default engine"
|
||||
);
|
||||
|
||||
await assertGleanDefaultEngine({
|
||||
normal: {
|
||||
engineId: "engine-chromeicon",
|
||||
},
|
||||
private: {
|
||||
engineId: "",
|
||||
},
|
||||
});
|
||||
|
||||
// Re-enable UI pref
|
||||
Services.prefs.setBoolPref(
|
||||
SearchUtils.BROWSER_SEARCH_PREF + "separatePrivateDefault.ui.enabled",
|
||||
true
|
||||
);
|
||||
Assert.equal(
|
||||
Services.search.defaultPrivateEngine,
|
||||
engine2,
|
||||
"Should not change the default private engine"
|
||||
);
|
||||
Assert.equal(
|
||||
Services.search.defaultEngine,
|
||||
engine2,
|
||||
"Should not change the default engine"
|
||||
);
|
||||
|
||||
await assertGleanDefaultEngine({
|
||||
normal: {
|
||||
engineId: "engine-chromeicon",
|
||||
},
|
||||
private: {
|
||||
engineId: "engine-chromeicon",
|
||||
},
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user