mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 817944 - Replace test-load-histograms with a function. r=vladan.
This commit is contained in:
parent
d8046d0502
commit
0a1297ce08
@ -805,6 +805,12 @@ TelemetryPing.prototype = {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
testLoadHistograms: function testLoadHistograms(file, sync) {
|
||||||
|
this._pingsLoaded = 0;
|
||||||
|
this._pingLoadsCompleted = 0;
|
||||||
|
this.loadHistograms(file, sync);
|
||||||
|
},
|
||||||
|
|
||||||
loadSavedPings: function loadSavedPings(sync) {
|
loadSavedPings: function loadSavedPings(sync) {
|
||||||
let directory = this.ensurePingDirectory();
|
let directory = this.ensurePingDirectory();
|
||||||
let entries = directory.directoryEntries
|
let entries = directory.directoryEntries
|
||||||
@ -1035,11 +1041,6 @@ TelemetryPing.prototype = {
|
|||||||
this._isIdleObserver = true;
|
this._isIdleObserver = true;
|
||||||
}).bind(this), Ci.nsIThread.DISPATCH_NORMAL);
|
}).bind(this), Ci.nsIThread.DISPATCH_NORMAL);
|
||||||
break;
|
break;
|
||||||
case "test-load-histograms":
|
|
||||||
this._pingsLoaded = 0;
|
|
||||||
this._pingLoadsCompleted = 0;
|
|
||||||
this.loadHistograms(aSubject.QueryInterface(Ci.nsIFile), aData != "async");
|
|
||||||
break;
|
|
||||||
case "idle":
|
case "idle":
|
||||||
this.sendIdlePing(false, this._server);
|
this.sendIdlePing(false, this._server);
|
||||||
break;
|
break;
|
||||||
|
@ -15,4 +15,12 @@ interface nsITelemetryPing : nsIObserver {
|
|||||||
void enableLoadSaveNotifications(); /* Used only for testing. */
|
void enableLoadSaveNotifications(); /* Used only for testing. */
|
||||||
void setAddOns(in AString aAddOns);
|
void setAddOns(in AString aAddOns);
|
||||||
void testPing(in AString aServer);
|
void testPing(in AString aServer);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load histograms from a file.
|
||||||
|
*
|
||||||
|
* @param aFile - File to load from.
|
||||||
|
* @param aSync - Use sync reads.
|
||||||
|
*/
|
||||||
|
void testLoadHistograms(in nsIFile aFile, in boolean aSync);
|
||||||
};
|
};
|
||||||
|
@ -101,7 +101,7 @@ function telemetryObserver(aSubject, aTopic, aData) {
|
|||||||
|
|
||||||
const TelemetryPing = Cc["@mozilla.org/base/telemetry-ping;1"].getService(Ci.nsITelemetryPing);
|
const TelemetryPing = Cc["@mozilla.org/base/telemetry-ping;1"].getService(Ci.nsITelemetryPing);
|
||||||
TelemetryPing.saveHistograms(histogramsFile, true);
|
TelemetryPing.saveHistograms(histogramsFile, true);
|
||||||
TelemetryPing.observe(histogramsFile, "test-load-histograms", null);
|
TelemetryPing.testLoadHistograms(histogramsFile, true);
|
||||||
telemetry_ping();
|
telemetry_ping();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -286,7 +286,7 @@ function runAsyncTestObserver(aSubject, aTopic, aData) {
|
|||||||
telemetry_ping();
|
telemetry_ping();
|
||||||
}, "telemetry-test-load-complete", false);
|
}, "telemetry-test-load-complete", false);
|
||||||
|
|
||||||
TelemetryPing.observe(histogramsFile, "test-load-histograms", "async");
|
TelemetryPing.testLoadHistograms(histogramsFile, false);
|
||||||
}, "telemetry-test-save-complete", false);
|
}, "telemetry-test-save-complete", false);
|
||||||
TelemetryPing.saveHistograms(histogramsFile, false);
|
TelemetryPing.saveHistograms(histogramsFile, false);
|
||||||
}
|
}
|
||||||
@ -315,7 +315,7 @@ function runInvalidJSONTest() {
|
|||||||
do_check_true(histogramsFile.exists());
|
do_check_true(histogramsFile.exists());
|
||||||
|
|
||||||
const TelemetryPing = Cc["@mozilla.org/base/telemetry-ping;1"].getService(Ci.nsITelemetryPing);
|
const TelemetryPing = Cc["@mozilla.org/base/telemetry-ping;1"].getService(Ci.nsITelemetryPing);
|
||||||
TelemetryPing.observe(histogramsFile, "test-load-histograms", null);
|
TelemetryPing.testLoadHistograms(histogramsFile, true);
|
||||||
do_check_false(histogramsFile.exists());
|
do_check_false(histogramsFile.exists());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,7 +327,7 @@ function runOldPingFileTest() {
|
|||||||
|
|
||||||
let mtime = histogramsFile.lastModifiedTime;
|
let mtime = histogramsFile.lastModifiedTime;
|
||||||
histogramsFile.lastModifiedTime = mtime - 8 * 24 * 60 * 60 * 1000; // 8 days.
|
histogramsFile.lastModifiedTime = mtime - 8 * 24 * 60 * 60 * 1000; // 8 days.
|
||||||
TelemetryPing.observe(histogramsFile, "test-load-histograms", null);
|
TelemetryPing.testLoadHistograms(histogramsFile, true);
|
||||||
do_check_false(histogramsFile.exists());
|
do_check_false(histogramsFile.exists());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user