Bug 1188423 - removed all references to loadHistogram, READ_SAVED_PING_SUCCESS, addPingPendingFromFile along with their tests. r=gfritzsche

This commit is contained in:
rthyberg 2015-09-18 02:46:00 +02:00
parent 79d7095e90
commit 528fbe6fd8
3 changed files with 0 additions and 96 deletions

View File

@ -5314,12 +5314,6 @@
"kind": "flag",
"description": "Whether enablePrivilege has ever been called during the current session"
},
"READ_SAVED_PING_SUCCESS": {
"alert_emails": ["perf-telemetry-alerts@mozilla.com"],
"expires_in_version": "never",
"kind": "boolean",
"description": "Successfully reading a saved ping file"
},
"TOUCH_ENABLED_DEVICE": {
"expires_in_version": "never",
"kind": "boolean",

View File

@ -374,19 +374,6 @@ this.TelemetryStorage = {
return TelemetryStorageImpl.addPendingPing(pingData);
},
/**
* Add a ping from an existing file to the saved pings directory so that it gets saved
* and sent along with other pings.
* Note: that the original ping file will not be modified.
*
* @param {String} pingPath The path to the ping file that needs to be added to the
* saved pings directory.
* @return {Promise} A promise resolved when the ping is saved to the pings directory.
*/
addPendingPingFromFile: function(pingPath) {
return TelemetryStorageImpl.addPendingPingFromFile(pingPath);
},
/**
* Remove the file for a ping
*
@ -397,16 +384,6 @@ this.TelemetryStorage = {
return TelemetryStorageImpl.cleanupPingFile(ping);
},
/**
* Load the histograms from a file.
*
* @param {string} file The file to load.
* @returns {promise}
*/
loadHistograms: function loadHistograms(file) {
return TelemetryStorageImpl.loadHistograms(file);
},
/**
* The number of pending pings on disk.
*/
@ -414,10 +391,6 @@ this.TelemetryStorage = {
return TelemetryStorageImpl.pendingPingCount;
},
testLoadHistograms: function(file) {
return TelemetryStorageImpl.testLoadHistograms(file);
},
/**
* Loads a ping file.
* @param {String} aFilePath The path of the ping file.
@ -1175,26 +1148,6 @@ var TelemetryStorageImpl = {
return file;
}),
/**
* Add a ping from an existing file to the saved pings directory so that it gets saved
* and sent along with other pings.
* Note: that the original ping file will not be modified.
*
* @param {String} pingPath The path to the ping file that needs to be added to the
* saved pings directory.
* @return {Promise} A promise resolved when the ping is saved to the pings directory.
*/
addPendingPingFromFile: function(pingPath) {
// Pings in the saved ping directory need to have the ping id or slug (old format) as
// the file name. We load the ping content, check that it is valid, and use it to save
// the ping file with the correct file name.
return this.loadPingFile(pingPath).then(ping => {
// Since we read a ping successfully, update the related histogram.
Telemetry.getHistogramById("READ_SAVED_PING_SUCCESS").add(1);
return this.addPendingPing(ping);
});
},
/**
* Add a ping to the saved pings directory so that it gets saved
* and sent along with other pings.
@ -1395,37 +1348,10 @@ var TelemetryStorageImpl = {
return list;
},
/**
* Load the histograms from a file.
*
* Once loaded, the saved pings can be accessed (destructively only)
* through |popPendingPings|.
*
* @param {string} file The file to load.
* @returns {promise}
*/
loadHistograms: Task.async(function*(file) {
let success = true;
try {
const ping = yield this.loadPingfile(file);
return ping;
} catch (ex) {
success = false;
yield OS.File.remove(file);
} finally {
const success_histogram = Telemetry.getHistogramById("READ_SAVED_PING_SUCCESS");
success_histogram.add(success);
}
}),
get pendingPingCount() {
return this._pendingPings.size;
},
testLoadHistograms: function(file) {
return this.loadHistograms(file.path);
},
/**
* Loads a ping file.
* @param {String} aFilePath The path of the ping file.

View File

@ -286,12 +286,10 @@ function checkPayload(payload, reason, successfulPings, savedPings) {
const TELEMETRY_TEST_COUNT = "TELEMETRY_TEST_COUNT";
const TELEMETRY_TEST_KEYED_FLAG = "TELEMETRY_TEST_KEYED_FLAG";
const TELEMETRY_TEST_KEYED_COUNT = "TELEMETRY_TEST_KEYED_COUNT";
const READ_SAVED_PING_SUCCESS = "READ_SAVED_PING_SUCCESS";
if (successfulPings > 0) {
Assert.ok(TELEMETRY_PING in payload.histograms);
}
Assert.ok(READ_SAVED_PING_SUCCESS in payload.histograms);
Assert.ok(TELEMETRY_TEST_FLAG in payload.histograms);
Assert.ok(TELEMETRY_TEST_COUNT in payload.histograms);
@ -346,9 +344,6 @@ function checkPayload(payload, reason, successfulPings, savedPings) {
Assert.equal(uneval(tc), uneval(expected_tc));
}
let h = payload.histograms[READ_SAVED_PING_SUCCESS];
Assert.equal(h.values[0], 1);
// The ping should include data from memory reporters. We can't check that
// this data is correct, because we can't control the values returned by the
// memory reporters. But we can at least check that the data is there.
@ -487,17 +482,6 @@ add_task(function* test_expiredHistogram() {
do_check_eq(TelemetrySession.getPayload()["histograms"]["TELEMETRY_TEST_EXPIRED"], undefined);
});
// Checks that an invalid histogram file is deleted if TelemetryStorage fails to parse it.
add_task(function* test_runInvalidJSON() {
let pingFile = getSavedPingFile("invalid-histograms.dat");
writeStringToFile(pingFile, "this.is.invalid.JSON");
do_check_true(pingFile.exists());
yield TelemetryStorage.testLoadHistograms(pingFile);
do_check_false(pingFile.exists());
});
// Sends a ping to a non existing server. If we remove this test, we won't get
// all the histograms we need in the main ping.
add_task(function* test_noServerPing() {