зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1833671 - Add Telemetry for Tabs from Other Devices r=kcochrane,fxview-reviewers,sclements
Differential Revision: https://phabricator.services.mozilla.com/D188670
This commit is contained in:
Родитель
e9fa17f339
Коммит
31120cda00
|
@ -54,6 +54,10 @@ function openTabInWindow(window, url) {
|
||||||
switchToTabHavingURI(url, true, {});
|
switchToTabHavingURI(url, true, {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isFirefoxViewNext(window) {
|
||||||
|
return window.location.pathname === "firefoxview-next";
|
||||||
|
}
|
||||||
|
|
||||||
export const TabsSetupFlowManager = new (class {
|
export const TabsSetupFlowManager = new (class {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.QueryInterface = ChromeUtils.generateQI(["nsIObserver"]);
|
this.QueryInterface = ChromeUtils.generateQI(["nsIObserver"]);
|
||||||
|
@ -617,7 +621,10 @@ export const TabsSetupFlowManager = new (class {
|
||||||
);
|
);
|
||||||
this.didFxaTabOpen = true;
|
this.didFxaTabOpen = true;
|
||||||
openTabInWindow(window, url, true);
|
openTabInWindow(window, url, true);
|
||||||
Services.telemetry.recordEvent("firefoxview", "fxa_continue", "sync", null);
|
const category = isFirefoxViewNext(window)
|
||||||
|
? "firefoxview_next"
|
||||||
|
: "firefoxview";
|
||||||
|
Services.telemetry.recordEvent(category, "fxa_continue", "sync", null);
|
||||||
}
|
}
|
||||||
|
|
||||||
async openFxAPairDevice(window) {
|
async openFxAPairDevice(window) {
|
||||||
|
@ -626,7 +633,10 @@ export const TabsSetupFlowManager = new (class {
|
||||||
});
|
});
|
||||||
this.didFxaTabOpen = true;
|
this.didFxaTabOpen = true;
|
||||||
openTabInWindow(window, url, true);
|
openTabInWindow(window, url, true);
|
||||||
Services.telemetry.recordEvent("firefoxview", "fxa_mobile", "sync", null, {
|
const category = isFirefoxViewNext(window)
|
||||||
|
? "firefoxview_next"
|
||||||
|
: "firefoxview";
|
||||||
|
Services.telemetry.recordEvent(category, "fxa_mobile", "sync", null, {
|
||||||
has_devices: this.secondaryDeviceConnected.toString(),
|
has_devices: this.secondaryDeviceConnected.toString(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -255,6 +255,7 @@ class SyncedTabsInView extends ViewPage {
|
||||||
where = "tab";
|
where = "tab";
|
||||||
}
|
}
|
||||||
currentWindow.openTrustedLinkIn(event.originalTarget.url, where);
|
currentWindow.openTrustedLinkIn(event.originalTarget.url, where);
|
||||||
|
Services.telemetry.recordEvent("firefoxview_next", "synced_tabs", "tabs");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,29 @@ add_task(async function test_unconfigured_initial_state() {
|
||||||
emptyState.getAttribute("headerlabel").includes("syncedtabs-signin"),
|
emptyState.getAttribute("headerlabel").includes("syncedtabs-signin"),
|
||||||
"Signin message is shown"
|
"Signin message is shown"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Test telemetry for signing into Firefox Accounts.
|
||||||
|
await clearAllParentTelemetryEvents();
|
||||||
|
EventUtils.synthesizeMouseAtCenter(
|
||||||
|
emptyState.querySelector(`button[data-action="sign-in"]`),
|
||||||
|
{},
|
||||||
|
content
|
||||||
|
);
|
||||||
|
await TestUtils.waitForCondition(
|
||||||
|
() =>
|
||||||
|
Services.telemetry.snapshotEvents(
|
||||||
|
Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS
|
||||||
|
).parent?.length >= 1,
|
||||||
|
"Waiting for fxa_continue firefoxview_next telemetry event.",
|
||||||
|
200,
|
||||||
|
100
|
||||||
|
);
|
||||||
|
TelemetryTestUtils.assertEvents(
|
||||||
|
[["firefoxview_next", "fxa_continue", "sync"]],
|
||||||
|
{ category: "firefoxview_next" },
|
||||||
|
{ clear: true, process: "parent" }
|
||||||
|
);
|
||||||
|
await BrowserTestUtils.removeTab(browser.ownerGlobal.gBrowser.selectedTab);
|
||||||
});
|
});
|
||||||
await tearDown(sandbox);
|
await tearDown(sandbox);
|
||||||
});
|
});
|
||||||
|
@ -73,6 +96,29 @@ add_task(async function test_signed_in() {
|
||||||
emptyState.getAttribute("headerlabel").includes("syncedtabs-adddevice"),
|
emptyState.getAttribute("headerlabel").includes("syncedtabs-adddevice"),
|
||||||
"Add device message is shown"
|
"Add device message is shown"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Test telemetry for adding a device.
|
||||||
|
await clearAllParentTelemetryEvents();
|
||||||
|
EventUtils.synthesizeMouseAtCenter(
|
||||||
|
emptyState.querySelector(`button[data-action="add-device"]`),
|
||||||
|
{},
|
||||||
|
content
|
||||||
|
);
|
||||||
|
await TestUtils.waitForCondition(
|
||||||
|
() =>
|
||||||
|
Services.telemetry.snapshotEvents(
|
||||||
|
Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS
|
||||||
|
).parent?.length >= 1,
|
||||||
|
"Waiting for fxa_mobile firefoxview_next telemetry event.",
|
||||||
|
200,
|
||||||
|
100
|
||||||
|
);
|
||||||
|
TelemetryTestUtils.assertEvents(
|
||||||
|
[["firefoxview_next", "fxa_mobile", "sync"]],
|
||||||
|
{ category: "firefoxview_next" },
|
||||||
|
{ clear: true, process: "parent" }
|
||||||
|
);
|
||||||
|
await BrowserTestUtils.removeTab(browser.ownerGlobal.gBrowser.selectedTab);
|
||||||
});
|
});
|
||||||
await tearDown(sandbox);
|
await tearDown(sandbox);
|
||||||
});
|
});
|
||||||
|
@ -264,6 +310,24 @@ add_task(async function test_tabs() {
|
||||||
is(tabRow2.length, 2, "Correct number of rows are dispayed.");
|
is(tabRow2.length, 2, "Correct number of rows are dispayed.");
|
||||||
ok(tabRow1[0].shadowRoot.textContent.includes, "The Guardian");
|
ok(tabRow1[0].shadowRoot.textContent.includes, "The Guardian");
|
||||||
ok(tabRow1[1].shadowRoot.textContent.includes, "The Times");
|
ok(tabRow1[1].shadowRoot.textContent.includes, "The Times");
|
||||||
|
|
||||||
|
// Test telemetry for opening a tab.
|
||||||
|
await clearAllParentTelemetryEvents();
|
||||||
|
EventUtils.synthesizeMouseAtCenter(tabRow1[0], {}, browser.contentWindow);
|
||||||
|
await TestUtils.waitForCondition(
|
||||||
|
() =>
|
||||||
|
Services.telemetry.snapshotEvents(
|
||||||
|
Ci.nsITelemetry.DATASET_PRERELEASE_CHANNELS
|
||||||
|
).parent?.length >= 1,
|
||||||
|
"Waiting for synced_tabs firefoxview_next telemetry event.",
|
||||||
|
200,
|
||||||
|
100
|
||||||
|
);
|
||||||
|
TelemetryTestUtils.assertEvents(
|
||||||
|
[["firefoxview_next", "synced_tabs", "tabs"]],
|
||||||
|
{ category: "firefoxview_next" },
|
||||||
|
{ clear: true, process: "parent" }
|
||||||
|
);
|
||||||
});
|
});
|
||||||
await tearDown(sandbox);
|
await tearDown(sandbox);
|
||||||
});
|
});
|
||||||
|
|
|
@ -4073,6 +4073,50 @@ firefoxview_next:
|
||||||
- 1852036
|
- 1852036
|
||||||
expiry_version: "never"
|
expiry_version: "never"
|
||||||
release_channel_collection: opt-out
|
release_channel_collection: opt-out
|
||||||
|
fxa_continue:
|
||||||
|
objects: ["sync"]
|
||||||
|
description: >
|
||||||
|
Recorded when button to sign in or sign up is clicked
|
||||||
|
notification_emails:
|
||||||
|
- firefoxview@mozilla.com
|
||||||
|
products:
|
||||||
|
- "firefox"
|
||||||
|
record_in_processes:
|
||||||
|
- main
|
||||||
|
bug_numbers:
|
||||||
|
- 1833671
|
||||||
|
expiry_version: "never"
|
||||||
|
release_channel_collection: opt-out
|
||||||
|
fxa_mobile:
|
||||||
|
objects: ["sync"]
|
||||||
|
description: >
|
||||||
|
Recorded when the 'Try Firefox for mobile' button is clicked
|
||||||
|
extra_keys:
|
||||||
|
has_devices: True if user has other devices signed into sync
|
||||||
|
notification_emails:
|
||||||
|
- firefoxview@mozilla.com
|
||||||
|
products:
|
||||||
|
- "firefox"
|
||||||
|
record_in_processes:
|
||||||
|
- main
|
||||||
|
bug_numbers:
|
||||||
|
- 1833671
|
||||||
|
expiry_version: "never"
|
||||||
|
release_channel_collection: opt-out
|
||||||
|
synced_tabs:
|
||||||
|
objects: ["tabs"]
|
||||||
|
description: >
|
||||||
|
Recorded when a synced tab is clicked
|
||||||
|
notification_emails:
|
||||||
|
- firefoxview@mozilla.com
|
||||||
|
products:
|
||||||
|
- "firefox"
|
||||||
|
record_in_processes:
|
||||||
|
- main
|
||||||
|
bug_numbers:
|
||||||
|
- 1833671
|
||||||
|
expiry_version: "never"
|
||||||
|
release_channel_collection: opt-out
|
||||||
|
|
||||||
search:
|
search:
|
||||||
engine:
|
engine:
|
||||||
|
|
Загрузка…
Ссылка в новой задаче