forked from mirrors/gecko-dev
MozReview-Commit-ID: KMgNw5QsMIX --HG-- extra : rebase_source : b3f3e2dbd568e88c0e8461fb4bfadbbdd9baaa99
22 lines
800 B
JavaScript
22 lines
800 B
JavaScript
ChromeUtils.import("resource:///modules/PingCentre.jsm");
|
|
|
|
const TOPIC_SHIELD_INIT_COMPLETE = "shield-init-complete";
|
|
const SEND_PING_MOCK = sinon.stub(PingCentre.prototype, "sendPing");
|
|
|
|
let gBrowserGlue = Cc["@mozilla.org/browser/browserglue;1"]
|
|
.getService(Ci.nsIObserver);
|
|
|
|
add_task(async function() {
|
|
// Simulate ping centre sendPing() trigger.
|
|
gBrowserGlue.observe(null, TOPIC_SHIELD_INIT_COMPLETE, null);
|
|
|
|
const SEND_PING_CALL_ARGS = {
|
|
event: "AS_ENABLED",
|
|
value: true
|
|
};
|
|
const SEND_PING_FILTER = { filter: "activity-stream" };
|
|
|
|
Assert.ok(SEND_PING_MOCK.called, "gBrowserGlue.pingCentre.sendPing() is called");
|
|
Assert.ok(SEND_PING_MOCK.calledWithExactly(SEND_PING_CALL_ARGS, SEND_PING_FILTER),
|
|
"sendPing() is called with the correct param");
|
|
});
|