Bug 1167456 - Add test coverage. r=gfritzsche
authorAlessio Placitelli <alessio.placitelli@gmail.com>
Mon, 08 Jun 2015 10:01:00 +0200
changeset 248060 d251ac45a5e25f01583fe8fc6dd51d486e1e75db
parent 248059 7deb2a4309b9b3170a3e075c14f1cb9ae1240898
child 248061 05586e36413f73e998dd172f8d82a0faf1017027
push id60888
push userkwierso@gmail.com
push dateThu, 11 Jun 2015 01:38:38 +0000
treeherdermozilla-inbound@39e638ed06bf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgfritzsche
bugs1167456
milestone41.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 1167456 - Add test coverage. r=gfritzsche
toolkit/components/telemetry/tests/unit/test_TelemetryController.js
--- a/toolkit/components/telemetry/tests/unit/test_TelemetryController.js
+++ b/toolkit/components/telemetry/tests/unit/test_TelemetryController.js
@@ -330,16 +330,33 @@ add_task(function* test_midnightPingSend
   ping = decodeRequestPayload(request);
   checkPingFormat(ping, TEST_PING_TYPE, true, true);
 
   // Clean-up.
   fakeMidnightPingFuzzingDelay(0);
   fakePingSendTimer(() => {}, () => {});
 });
 
+add_task(function* test_changePingAfterSubmission() {
+  // Submit a ping with a custom payload.
+  let payload = { canary: "test" };
+  let pingPromise = TelemetryController.submitExternalPing(TEST_PING_TYPE, payload, options);
+
+  // Change the payload with a predefined value.
+  payload.canary = "changed";
+
+  // Wait for the ping to be archived.
+  const pingId = yield pingPromise;
+
+  // Make sure our changes didn't affect the submitted payload.
+  let archivedCopy = yield TelemetryArchive.promiseArchivedPingById(pingId);
+  Assert.equal(archivedCopy.payload.canary, "test",
+               "The payload must not be changed after being submitted.");
+});
+
 add_task(function* stopServer(){
   gHttpServer.stop(do_test_finished);
 });
 
 // An iterable sequence of http requests
 function Request() {
   let defers = [];
   let current = 0;