Bug 1294680 - instrument the 'Settings page' button, r=past.

This commit is contained in:
Florian Quèze 2016-08-12 16:16:41 +02:00
parent dcc99335f3
commit d99b80b960
3 changed files with 25 additions and 3 deletions

View File

@ -12,7 +12,8 @@ const TELEMETRY_RESULT_ENUM = {
RESTORED_DEFAULT: 0,
KEPT_CURRENT: 1,
CHANGED_ENGINE: 2,
CLOSED_PAGE: 3
CLOSED_PAGE: 3,
OPENED_SETTINGS: 4
};
window.onload = function() {
@ -24,6 +25,8 @@ window.onload = function() {
document.getElementById("searchResetChangeEngine").focus();
window.addEventListener("unload", recordPageClosed);
document.getElementById("linkSettingsPage")
.addEventListener("click", openingSettings);
};
function doSearch() {
@ -54,6 +57,11 @@ function doSearch() {
win.openUILinkIn(submission.uri.spec, "current", false, submission.postData);
}
function openingSettings() {
record(TELEMETRY_RESULT_ENUM.OPENED_SETTINGS);
window.removeEventListener("unload", recordPageClosed);
}
function record(result) {
Services.telemetry.getHistogramById("SEARCH_RESET_RESULT").add(result);
}

View File

@ -6,7 +6,8 @@ const TELEMETRY_RESULT_ENUM = {
RESTORED_DEFAULT: 0,
KEPT_CURRENT: 1,
CHANGED_ENGINE: 2,
CLOSED_PAGE: 3
CLOSED_PAGE: 3,
OPENED_SETTINGS: 4
};
const kSearchStr = "a search";
@ -100,6 +101,19 @@ var gTests = [
}
},
{
desc: "Click the settings link.",
run: function* () {
let loadPromise = BrowserTestUtils.browserLoaded(gBrowser.selectedBrowser,
false,
"about:preferences#search")
gBrowser.contentDocument.getElementById("linkSettingsPage").click();
yield loadPromise;
checkTelemetryRecords(TELEMETRY_RESULT_ENUM.OPENED_SETTINGS);
}
},
{
desc: "Load another page without clicking any of the buttons.",
run: function* () {

View File

@ -5373,7 +5373,7 @@
"kind": "enumerated",
"n_values": 5,
"releaseChannelCollection": "opt-out",
"description": "Result of showing the search reset prompt to the user. 0=restored original default, 1=kept current engine, 2=changed engine, 3=closed the page"
"description": "Result of showing the search reset prompt to the user. 0=restored original default, 1=kept current engine, 2=changed engine, 3=closed the page, 4=opened search settings"
},
"SEARCH_SERVICE_INIT_MS": {
"expires_in_version": "never",