Bug 1154856 - Fix TelemetrySession test issues. r=vladan

This commit is contained in:
Georg Fritzsche 2015-04-20 11:54:00 +02:00
parent 18f2d0124a
commit d922320c54
3 changed files with 11 additions and 7 deletions

View File

@ -604,13 +604,16 @@ let Impl = {
", aOptions " + JSON.stringify(aOptions));
let pingData = this.assemblePing(aType, aPayload, aOptions);
let archivePromise = this._archivePing(pingData)
.catch(e => this._log.error("addPendingPing - Failed to archive ping " + pingData.id, e));
let savePromise = TelemetryFile.savePing(pingData, aOptions.overwrite);
let archivePromise = this._archivePing(pingData).catch(e => {
this._log.error("addPendingPing - Failed to archive ping " + pingData.id, e);
});
// Wait for both the archiving and ping persistence to complete.
let promises = [
savePromise,
archivePromise,
TelemetryFile.savePing(pingData, aOptions.overwrite),
];
return Promise.all(promises).then(() => pingData.id);
},
@ -1076,7 +1079,8 @@ let Impl = {
const creationDate = new Date(aPingData.creationDate);
const filePath = getArchivedPingPath(aPingData.id, creationDate, aPingData.type);
yield OS.File.makeDir(OS.Path.dirname(filePath), { ignoreExisting: true });
yield OS.File.makeDir(OS.Path.dirname(filePath), { ignoreExisting: true,
from: OS.Constants.Path.profileDir });
yield TelemetryFile.savePingToFile(aPingData, filePath, true);
}),

View File

@ -1703,9 +1703,8 @@ let Impl = {
addClientId: true,
addEnvironment: true,
overwrite: true,
filePath: file.path,
};
return TelemetryPing.addPendingPing(getPingType(payload), payload, options);
return TelemetryPing.savePing(getPingType(payload), payload, file.path, options);
},
/**
@ -2071,7 +2070,7 @@ let Impl = {
if (abortedExists) {
this._log.trace("_checkAbortedSessionPing - aborted session found: " + FILE_PATH);
yield this._abortedSessionSerializer.enqueueTask(
() => TelemetryPing.addPendingPing(FILE_PATH, true));
() => TelemetryPing.addPendingPingFromFile(FILE_PATH, true));
}
}),

View File

@ -1582,6 +1582,7 @@ add_task(function* test_schedulerUserIdle() {
// We should not miss midnight when going to idle.
now.setHours(23);
now.setMinutes(50);
fakeNow(now);
fakeIdleNotification("idle");
Assert.equal(schedulerTimeout, 10 * 60 * 1000);