Bug 875245 - Mochitest for NetworkStats failure. r=gene

This commit is contained in:
Albert Crespell 2013-05-23 11:36:31 +02:00
parent 50e1cb681f
commit e03114c235
2 changed files with 8 additions and 11 deletions

View File

@ -269,8 +269,8 @@ NetworkStatsDB.prototype = {
this.fillResultSamples(start, end, data);
txn.result.connectionType = aOptions.connectionType;
txn.result.start = new Date(aOptions.start);
txn.result.end = new Date(aOptions.end);
txn.result.start = aOptions.start;
txn.result.end = aOptions.end;
txn.result.data = data;
}.bind(this);
}.bind(this), aResultCb);
@ -315,8 +315,8 @@ NetworkStatsDB.prototype = {
this.fillResultSamples(start, end, data);
txn.result.connectionType = aOptions.connectionType;
txn.result.start = new Date(aOptions.start);
txn.result.end = new Date(aOptions.end);
txn.result.start = aOptions.start;
txn.result.end = aOptions.end;
txn.result.data = data;
}.bind(this);
}.bind(this), aResultCb);

View File

@ -51,9 +51,8 @@ function test() {
}
function checkDataDates(data, start, end, sampleRate){
var offset = new Date().getTimezoneOffset() * 60 * 1000;
start = Math.floor((start.getTime() - offset) / sampleRate) * sampleRate + offset;
end = Math.floor((end.getTime() - offset) / sampleRate) * sampleRate + offset;
start = Math.floor(start.getTime() / sampleRate) * sampleRate;
end = Math.floor(end.getTime() / sampleRate) * sampleRate;
var counter = 0;
var date = start;
@ -150,8 +149,7 @@ var steps = [
// Get samplerate in millis
var sampleRate = netStats.sampleRate * 1000;
// Get date with samplerate's precision
var offset = new Date().getTimezoneOffset() * 60 * 1000;
var endDate = new Date(Math.floor((new Date().getTime() - offset) / sampleRate) * sampleRate + offset);
var endDate = new Date(Math.floor(new Date().getTime() / sampleRate) * sampleRate);
var startDate = new Date(endDate.getTime() - (sampleRate * diff));
// Calculate the number of samples that should be returned based on the
// the samplerate and including final and initial samples.
@ -181,8 +179,7 @@ var steps = [
// Get samplerate in millis
var sampleRate = netStats.sampleRate * 1000;
// Get date with samplerate's precision
var offset = new Date().getTimezoneOffset() * 60 * 1000;
var endDate = new Date(Math.floor((new Date().getTime() - offset) / sampleRate) * sampleRate + offset);
var endDate = new Date(Math.floor(new Date().getTime() / sampleRate) * sampleRate);
var startDate = new Date(endDate.getTime() - (sampleRate * diff));
// Calculate the number of samples that should be returned based on the
// the samplerate and including final and initial samples.