Bug 1361661 - Part 5 - Fix browser_UsageTelemetry_*.js tests. r=dexter

This commit is contained in:
Georg Fritzsche 2017-05-23 13:49:01 +07:00
Родитель 7ead039c6b
Коммит cada1f8fab
5 изменённых файлов: 12 добавлений и 12 удалений

Просмотреть файл

@ -81,7 +81,7 @@ add_task(async function test_context_menu() {
// Also check events.
let events = Services.telemetry.snapshotBuiltinEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, false);
events = (events.default || []).filter(e => e[1] == "navigation" && e[2] == "search");
events = (events.parent || []).filter(e => e[1] == "navigation" && e[2] == "search");
checkEvents(events, [["navigation", "search", "contextmenu", null, {engine: "other-MozSearch"}]]);
contextMenu.hidePopup();
@ -117,7 +117,7 @@ add_task(async function test_about_newtab() {
// Also check events.
let events = Services.telemetry.snapshotBuiltinEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, false);
events = (events.default || []).filter(e => e[1] == "navigation" && e[2] == "search");
events = (events.parent || []).filter(e => e[1] == "navigation" && e[2] == "search");
checkEvents(events, [["navigation", "search", "about_newtab", "enter", {engine: "other-MozSearch"}]]);
await BrowserTestUtils.removeTab(tab);

Просмотреть файл

@ -81,7 +81,7 @@ add_task(async function test_abouthome_simpleQuery() {
// Also check events.
let events = Services.telemetry.snapshotBuiltinEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, false);
events = (events.default || []).filter(e => e[1] == "navigation" && e[2] == "search");
events = (events.parent || []).filter(e => e[1] == "navigation" && e[2] == "search");
checkEvents(events, [["navigation", "search", "about_home", "enter", {engine: "other-MozSearch"}]]);
await BrowserTestUtils.removeTab(tab);

Просмотреть файл

@ -129,7 +129,7 @@ add_task(async function test_plainQuery() {
// Also check events.
let events = Services.telemetry.snapshotBuiltinEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, false);
events = (events.default || []).filter(e => e[1] == "navigation" && e[2] == "search");
events = (events.parent || []).filter(e => e[1] == "navigation" && e[2] == "search");
checkEvents(events, [["navigation", "search", "searchbar", "enter", {engine: "other-MozSearch"}]]);
// Check the histograms as well.
@ -173,7 +173,7 @@ add_task(async function test_oneOff_enter() {
// Also check events.
let events = Services.telemetry.snapshotBuiltinEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, false);
events = (events.default || []).filter(e => e[1] == "navigation" && e[2] == "search");
events = (events.parent || []).filter(e => e[1] == "navigation" && e[2] == "search");
checkEvents(events, [["navigation", "search", "searchbar", "oneoff", {engine: "other-MozSearch2"}]]);
// Check the histograms as well.
@ -298,7 +298,7 @@ add_task(async function test_suggestion_click() {
// Also check events.
let events = Services.telemetry.snapshotBuiltinEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, false);
events = (events.default || []).filter(e => e[1] == "navigation" && e[2] == "search");
events = (events.parent || []).filter(e => e[1] == "navigation" && e[2] == "search");
checkEvents(events, [["navigation", "search", "searchbar", "suggestion", {engine: searchEngineId}]]);
// Check the histograms as well.

Просмотреть файл

@ -138,7 +138,7 @@ add_task(async function test_simpleQuery() {
// Also check events.
let events = Services.telemetry.snapshotBuiltinEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, false);
events = (events.default || []).filter(e => e[1] == "navigation" && e[2] == "search");
events = (events.parent || []).filter(e => e[1] == "navigation" && e[2] == "search");
checkEvents(events, [["navigation", "search", "urlbar", "enter", {engine: "other-MozSearch"}]]);
// Check the histograms as well.
@ -197,7 +197,7 @@ add_task(async function test_searchAlias() {
// Also check events.
let events = Services.telemetry.snapshotBuiltinEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, false);
events = (events.default || []).filter(e => e[1] == "navigation" && e[2] == "search");
events = (events.parent || []).filter(e => e[1] == "navigation" && e[2] == "search");
checkEvents(events, [["navigation", "search", "urlbar", "alias", {engine: "other-MozSearch"}]]);
// Check the histograms as well.
@ -261,7 +261,7 @@ add_task(async function test_oneOff_enter() {
// Also check events.
let events = Services.telemetry.snapshotBuiltinEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, false);
events = (events.default || []).filter(e => e[1] == "navigation" && e[2] == "search");
events = (events.parent || []).filter(e => e[1] == "navigation" && e[2] == "search");
checkEvents(events, [["navigation", "search", "urlbar", "oneoff", {engine: "other-MozSearch"}]]);
// Check the histograms as well.
@ -408,7 +408,7 @@ add_task(async function test_suggestion_click() {
// Also check events.
let events = Services.telemetry.snapshotBuiltinEvents(Ci.nsITelemetry.DATASET_RELEASE_CHANNEL_OPTIN, false);
events = (events.default || []).filter(e => e[1] == "navigation" && e[2] == "search");
events = (events.parent || []).filter(e => e[1] == "navigation" && e[2] == "search");
checkEvents(events, [["navigation", "search", "urlbar", "suggestion", {engine: searchEngineId}]]);
// Check the histograms as well.

Просмотреть файл

@ -100,8 +100,8 @@ function checkKeyedHistogram(h, key, expectedValue) {
*/
function getParentProcessScalars(aChannel, aKeyed = false, aClear = false) {
const scalars = aKeyed ?
Services.telemetry.snapshotKeyedScalars(aChannel, aClear)["default"] :
Services.telemetry.snapshotScalars(aChannel, aClear)["default"];
Services.telemetry.snapshotKeyedScalars(aChannel, aClear)["parent"] :
Services.telemetry.snapshotScalars(aChannel, aClear)["parent"];
return scalars || {};
}