Bug 1595058 - add a new ping type for pre-trailhead r=Mardak
authorNan Jiang <njiang028@gmail.com>
Tue, 12 Nov 2019 23:18:40 +0000
changeset 501661 452480b6db9cbf3b3125274898337425f1286b8c
parent 501660 4ebefd304d2f40a91c9d595e750d5ec8372bfc6a
child 501662 40b9a55b447d71a80645db1f043f61047f018663
push id114172
push userdluca@mozilla.com
push dateTue, 19 Nov 2019 11:31:10 +0000
treeherdermozilla-inbound@b5c5ba07d3db [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersMardak
bugs1595058, 1594125
milestone72.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1595058 - add a new ping type for pre-trailhead r=Mardak The pre-trailhead triplets, added in bug 1594125 through the remote whats-new-panel provider, serve as another onboarding like messages for AS Router. Differential Revision: https://phabricator.services.mozilla.com/D52755
browser/components/newtab/lib/TelemetryFeed.jsm
browser/components/newtab/test/unit/lib/TelemetryFeed.test.js
--- a/browser/components/newtab/lib/TelemetryFeed.jsm
+++ b/browser/components/newtab/lib/TelemetryFeed.jsm
@@ -574,16 +574,18 @@ this.TelemetryFeed = class TelemetryFeed
     }
     switch (event.action) {
       case "cfr_user_event":
         event = await this.applyCFRPolicy(event);
         break;
       case "snippets_user_event":
         event = await this.applySnippetsPolicy(event);
         break;
+      // Bug 1594125 added a new onboarding-like provider called `whats-new-panel`.
+      case "whats-new-panel_user_event":
       case "onboarding_user_event":
         event = await this.applyOnboardingPolicy(event);
         break;
       case "asrouter_undesired_event":
         event = this.applyUndesiredEventPolicy(event);
         break;
       default:
         event = { ping: event };
--- a/browser/components/newtab/test/unit/lib/TelemetryFeed.test.js
+++ b/browser/components/newtab/test/unit/lib/TelemetryFeed.test.js
@@ -923,16 +923,28 @@ describe("TelemetryFeed", () => {
         message_id: "onboarding_message_01",
       };
       sandbox.stub(instance, "applyOnboardingPolicy");
       const action = ac.ASRouterUserEvent(data);
       await instance.createASRouterEvent(action);
 
       assert.calledOnce(instance.applyOnboardingPolicy);
     });
+    it("should call applyOnboardingPolicy if action equals to whats-new-panel_user_event", async () => {
+      const data = {
+        action: "whats-new-panel_user_event",
+        event: "CLICK_BUTTON",
+        message_id: "whats-new-panel_message_01",
+      };
+      sandbox.stub(instance, "applyOnboardingPolicy");
+      const action = ac.ASRouterUserEvent(data);
+      await instance.createASRouterEvent(action);
+
+      assert.calledOnce(instance.applyOnboardingPolicy);
+    });
     it("should call applyUndesiredEventPolicy if action equals to asrouter_undesired_event", async () => {
       const data = {
         action: "asrouter_undesired_event",
         event: "UNDESIRED_EVENT",
       };
       sandbox.stub(instance, "applyUndesiredEventPolicy");
       const action = ac.ASRouterUserEvent(data);
       await instance.createASRouterEvent(action);