From 086c044dc34dfc0f74fbe41f4ecb402b2cd34884 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:13:33 +0200 Subject: Merging upstream version 125.0.1. Signed-off-by: Daniel Baumann --- .../newtab/test/xpcshell/test_TelemetryFeed.js | 32 ++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'browser/components/newtab/test/xpcshell/test_TelemetryFeed.js') diff --git a/browser/components/newtab/test/xpcshell/test_TelemetryFeed.js b/browser/components/newtab/test/xpcshell/test_TelemetryFeed.js index b54d6094ad..59d82f5583 100644 --- a/browser/components/newtab/test/xpcshell/test_TelemetryFeed.js +++ b/browser/components/newtab/test/xpcshell/test_TelemetryFeed.js @@ -2860,6 +2860,38 @@ add_task(async function test_handleDiscoveryStreamUserEvent_popular_click() { sandbox.restore(); }); +add_task(async function test_handleDiscoveryStreamUserEvent_tooltip_click() { + info( + "TelemetryFeed.handleDiscoveryStreamUserEvent instruments a " + + "tooltip click" + ); + + let sandbox = sinon.createSandbox(); + let instance = new TelemetryFeed(); + Services.fog.testResetFOG(); + const feature = "SPONSORED_CONTENT_INFO"; + let action = ac.DiscoveryStreamUserEvent({ + event: "CLICK", + source: "FEATURE_HIGHLIGHT", + value: { + feature, + }, + }); + + const SESSION_ID = "decafc0ffee"; + sandbox.stub(instance.sessions, "get").returns({ session_id: SESSION_ID }); + + instance.handleDiscoveryStreamUserEvent(action); + let tooltipClicks = Glean.newtab.tooltipClick.testGetValue(); + Assert.equal(tooltipClicks.length, 1, "Recorded 1 click"); + Assert.deepEqual(tooltipClicks[0].extra, { + newtab_visit_id: SESSION_ID, + feature, + }); + + sandbox.restore(); +}); + add_task( async function test_handleDiscoveryStreamUserEvent_organic_top_stories_click() { info( -- cgit v1.2.3