Bug 1149754 - Part 1: Rename TelemetryPing.jsm to TelemetryController.jsm. r=vladan

This commit is contained in:
Georg Fritzsche 2015-04-27 18:07:58 +02:00
parent ae0910b61b
commit ea26082224
24 changed files with 116 additions and 116 deletions

View File

@ -5,7 +5,7 @@
Cu.import("resource:///modules/experiments/Experiments.jsm");
Cu.import("resource://gre/modules/TelemetryPing.jsm", this);
Cu.import("resource://gre/modules/TelemetryController.jsm", this);
Cu.import("resource://gre/modules/TelemetrySession.jsm", this);
XPCOMUtils.defineLazyGetter(this, "gDatareportingService",
@ -59,7 +59,7 @@ function initialiseTelemetry() {
gDatareportingService.observe(null, "profile-after-change", null);
}
return TelemetryPing.setup().then(TelemetrySession.setup);
return TelemetryController.setup().then(TelemetrySession.setup);
}
function run_test() {

View File

@ -23,7 +23,7 @@ import android.util.Base64;
public class TestTelemetryRecorder extends FakeProfileTestCase {
private TelemetryRecorder telemetryRecorder;
private File telemetryPingDir;
private File TelemetryControllerDir;
private File cacheDir;
private static final String DEST_FILENAME = "dest-filename";
@ -34,8 +34,8 @@ public class TestTelemetryRecorder extends FakeProfileTestCase {
@Override
protected void setUp() throws Exception {
super.setUp();
telemetryPingDir = new File(fakeProfileDirectory, "telemetry-ping");
if (!telemetryPingDir.mkdir()) {
TelemetryControllerDir = new File(fakeProfileDirectory, "telemetry-ping");
if (!TelemetryControllerDir.mkdir()) {
fail("Could not create directory for telemetry pings.");
}
cacheDir = new File(fakeProfileDirectory, "fakeCacheDir");
@ -45,7 +45,7 @@ public class TestTelemetryRecorder extends FakeProfileTestCase {
}
public void testConstructorWithoutParentDir() {
File fileNotDirectory = new File(telemetryPingDir, "testFile");
File fileNotDirectory = new File(TelemetryControllerDir, "testFile");
try {
fileNotDirectory.createNewFile();
} catch (IOException e) {
@ -68,7 +68,7 @@ public class TestTelemetryRecorder extends FakeProfileTestCase {
if (destFile.exists()) {
destFile.delete();
}
telemetryRecorder = new TelemetryRecorder(telemetryPingDir, cacheDir, DEST_FILENAME);
telemetryRecorder = new TelemetryRecorder(TelemetryControllerDir, cacheDir, DEST_FILENAME);
try {
telemetryRecorder.startPingFile();
} catch (Exception e) {
@ -82,7 +82,7 @@ public class TestTelemetryRecorder extends FakeProfileTestCase {
* verify the checksum.
*/
public void testFinishedPingFile() {
telemetryRecorder = new TelemetryRecorder(telemetryPingDir, cacheDir, DEST_FILENAME);
telemetryRecorder = new TelemetryRecorder(TelemetryControllerDir, cacheDir, DEST_FILENAME);
String charset = telemetryRecorder.getCharset();
try {
telemetryRecorder.startPingFile();
@ -93,7 +93,7 @@ public class TestTelemetryRecorder extends FakeProfileTestCase {
fail("Error writing payload: " + e);
}
File destFile = new File(telemetryPingDir, DEST_FILENAME);
File destFile = new File(TelemetryControllerDir, DEST_FILENAME);
Assert.assertTrue(destFile.exists());
StringBuilder sb = new StringBuilder();

View File

@ -28,8 +28,8 @@ Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://gre/modules/TelemetryStopwatch.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryPing",
"resource://gre/modules/TelemetryPing.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryController",
"resource://gre/modules/TelemetryController.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "UpdateChannel",
"resource://gre/modules/UpdateChannel.jsm");
@ -1193,7 +1193,7 @@ this.HealthReporter = function (branch, policy, stateLeaf=null) {
this._stateLeaf = stateLeaf;
this._uploadInProgress = false;
AbstractHealthReporter.call(this, branch, policy, TelemetryPing.getSessionRecorder());
AbstractHealthReporter.call(this, branch, policy, TelemetryController.getSessionRecorder());
if (!this.serverURI) {
throw new Error("No server URI defined. Did you forget to define the pref?");

View File

@ -69,7 +69,7 @@ const TEST_STORE_FILE_NAME = "test-downloads.json";
const TEST_REFERRER_URL = "http://www.example.com/referrer.html";
const TEST_DATA_SHORT = "This test string is downloaded.";
// Generate using gzipCompressString in TelemetryPing.jsm.
// Generate using gzipCompressString in TelemetryController.jsm.
const TEST_DATA_SHORT_GZIP_ENCODED_FIRST = [
31,139,8,0,0,0,0,0,0,3,11,201,200,44,86,40,73,45,46,81,40,46,41,202,204
];

View File

@ -11,7 +11,7 @@ const Cc = Components.classes;
const Ci = Components.interfaces;
const Cu = Components.utils;
// Fired by TelemetryPing when async telemetry data should be collected.
// Fired by TelemetryController when async telemetry data should be collected.
const TOPIC_GATHER_TELEMETRY = "gather-telemetry";
// Seconds between maintenance runs.

View File

@ -23,7 +23,7 @@ Cu.import("resource://gre/modules/DeferredTask.jsm", this);
Cu.import("resource://gre/modules/Preferences.jsm");
const LOGGER_NAME = "Toolkit.Telemetry";
const LOGGER_PREFIX = "TelemetryPing::";
const LOGGER_PREFIX = "TelemetryController::";
const PREF_BRANCH = "toolkit.telemetry.";
const PREF_BRANCH_LOG = PREF_BRANCH + "log.";
@ -121,9 +121,9 @@ let Policy = {
now: () => new Date(),
}
this.EXPORTED_SYMBOLS = ["TelemetryPing"];
this.EXPORTED_SYMBOLS = ["TelemetryController"];
this.TelemetryPing = Object.freeze({
this.TelemetryController = Object.freeze({
Constants: Object.freeze({
PREF_ENABLED: PREF_ENABLED,
PREF_LOG_LEVEL: PREF_LOG_LEVEL,
@ -304,7 +304,7 @@ this.TelemetryPing = Object.freeze({
},
/**
* The AsyncShutdown.Barrier to synchronize with TelemetryPing shutdown.
* The AsyncShutdown.Barrier to synchronize with TelemetryController shutdown.
*/
get shutdown() {
return Impl._shutdownBarrier.client;
@ -319,9 +319,9 @@ this.TelemetryPing = Object.freeze({
},
/**
* Allows waiting for TelemetryPings delayed initialization to complete.
* The returned promise is guaranteed to resolve before TelemetryPing is shutting down.
* @return {Promise} Resolved when delayed TelemetryPing initialization completed.
* Allows waiting for TelemetryControllers delayed initialization to complete.
* The returned promise is guaranteed to resolve before TelemetryController is shutting down.
* @return {Promise} Resolved when delayed TelemetryController initialization completed.
*/
promiseInitialized: function() {
return Impl.promiseInitialized();
@ -330,7 +330,7 @@ this.TelemetryPing = Object.freeze({
let Impl = {
_initialized: false,
_initStarted: false, // Whether we started setting up TelemetryPing.
_initStarted: false, // Whether we started setting up TelemetryController.
_log: null,
_prevValues: {},
// The previous build ID, if this is the first run with a new build.
@ -344,11 +344,11 @@ let Impl = {
// The session recorder, shared with FHR and the Data Reporting Service.
_sessionRecorder: null,
// This is a public barrier Telemetry clients can use to add blockers to the shutdown
// of TelemetryPing.
// of TelemetryController.
// After this barrier, clients can not submit Telemetry pings anymore.
_shutdownBarrier: new AsyncShutdown.Barrier("TelemetryPing: Waiting for clients."),
_shutdownBarrier: new AsyncShutdown.Barrier("TelemetryController: Waiting for clients."),
// This is a private barrier blocked by pending async ping activity (sending & saving).
_connectionsBarrier: new AsyncShutdown.Barrier("TelemetryPing: Waiting for pending ping activity"),
_connectionsBarrier: new AsyncShutdown.Barrier("TelemetryController: Waiting for pending ping activity"),
// This is true when running in the test infrastructure.
_testMode: false,
@ -837,7 +837,7 @@ let Impl = {
/**
* Initializes telemetry within a timer. If there is no PREF_SERVER set, don't turn on telemetry.
*
* This delayed initialization means TelemetryPing init can be in the following states:
* This delayed initialization means TelemetryController init can be in the following states:
* 1) setupTelemetry was never called
* or it was called and
* 2) _delayedInitTask was scheduled, but didn't run yet.
@ -895,7 +895,7 @@ let Impl = {
this._initialized = true;
yield TelemetryStorage.loadSavedPings();
// If we have any TelemetryPings lying around, we'll be aggressive
// If we have any TelemetryControllers lying around, we'll be aggressive
// and try to send them all off ASAP.
if (TelemetryStorage.pingsOverdue > 0) {
this._log.trace("setupChromeProcess - Sending " + TelemetryStorage.pingsOverdue +
@ -919,7 +919,7 @@ let Impl = {
}
}.bind(this), this._testMode ? TELEMETRY_TEST_DELAY : TELEMETRY_DELAY);
AsyncShutdown.sendTelemetry.addBlocker("TelemetryPing: shutting down",
AsyncShutdown.sendTelemetry.addBlocker("TelemetryController: shutting down",
() => this.shutdown(),
() => this._getState());
@ -1042,9 +1042,9 @@ let Impl = {
},
/**
* Allows waiting for TelemetryPings delayed initialization to complete.
* This will complete before TelemetryPing is shutting down.
* @return {Promise} Resolved when delayed TelemetryPing initialization completed.
* Allows waiting for TelemetryControllers delayed initialization to complete.
* This will complete before TelemetryController is shutting down.
* @return {Promise} Resolved when delayed TelemetryController initialization completed.
*/
promiseInitialized: function() {
return this._delayedInitTaskDeferred.promise;

View File

@ -134,8 +134,8 @@ XPCOMUtils.defineLazyModuleGetter(this, "AddonManagerPrivate",
"resource://gre/modules/AddonManager.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "AsyncShutdown",
"resource://gre/modules/AsyncShutdown.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryPing",
"resource://gre/modules/TelemetryPing.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryController",
"resource://gre/modules/TelemetryController.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryStorage",
"resource://gre/modules/TelemetryStorage.jsm");
XPCOMUtils.defineLazyModuleGetter(this, "TelemetryLog",
@ -967,7 +967,7 @@ let Impl = {
}
ret.activeTicks = -1;
let sr = TelemetryPing.getSessionRecorder();
let sr = TelemetryController.getSessionRecorder();
if (sr) {
let activeTicks = sr.activeTicks;
if (isSubsession) {
@ -1213,9 +1213,9 @@ let Impl = {
// to measure "explicit" too, but it could cause hangs, and the data was
// always really noisy anyway. See bug 859657.
//
// test_TelemetryPing.js relies on some of these histograms being
// test_TelemetryController.js relies on some of these histograms being
// here. If you remove any of the following histograms from here, you'll
// have to modify test_TelemetryPing.js:
// have to modify test_TelemetryController.js:
//
// * MEMORY_JS_GC_HEAP, and
// * MEMORY_JS_COMPARTMENTS_SYSTEM.
@ -1443,7 +1443,7 @@ let Impl = {
addClientId: true,
addEnvironment: true,
};
return TelemetryPing.send(getPingType(payload), payload, options);
return TelemetryController.send(getPingType(payload), payload, options);
},
attachObservers: function attachObservers() {
@ -1508,7 +1508,7 @@ let Impl = {
return Promise.resolve();
}
TelemetryPing.shutdown.addBlocker("TelemetrySession: shutting down",
TelemetryController.shutdown.addBlocker("TelemetrySession: shutting down",
() => this.shutdownChromeProcess(),
() => this._getState());
@ -1674,7 +1674,7 @@ let Impl = {
let shutdownPayload = this.getSessionPayload(REASON_SHUTDOWN, false);
// Make sure we try to save the pending pings, even though we failed saving the shutdown
// ping.
return TelemetryPing.addPendingPing(getPingType(shutdownPayload), shutdownPayload, options)
return TelemetryController.addPendingPing(getPingType(shutdownPayload), shutdownPayload, options)
.then(() => this.savePendingPingsClassic(),
() => this.savePendingPingsClassic());
#else
@ -1683,7 +1683,7 @@ let Impl = {
},
/**
* Save the "saved-session" ping and make TelemetryPing save all the pending pings to disk.
* Save the "saved-session" ping and make TelemetryController save all the pending pings to disk.
*/
savePendingPingsClassic: function savePendingPingsClassic() {
this._log.trace("savePendingPingsClassic");
@ -1693,7 +1693,7 @@ let Impl = {
addClientId: true,
addEnvironment: true,
};
return TelemetryPing.savePendingPings(getPingType(payload), payload, options);
return TelemetryController.savePendingPings(getPingType(payload), payload, options);
},
testSaveHistograms: function testSaveHistograms(file) {
@ -1705,7 +1705,7 @@ let Impl = {
addEnvironment: true,
overwrite: true,
};
return TelemetryPing.savePing(getPingType(payload), payload, file.path, options);
return TelemetryController.savePing(getPingType(payload), payload, file.path, options);
},
/**
@ -1825,7 +1825,7 @@ let Impl = {
}).bind(this), Ci.nsIThread.DISPATCH_NORMAL);
// TODO: This is just a fallback for now. Remove this when we have ping send
// scheduling properly factored out and driven independently of this module.
TelemetryPing.sendPersistedPings();
TelemetryController.sendPersistedPings();
break;
#ifdef MOZ_WIDGET_ANDROID
@ -1853,7 +1853,7 @@ let Impl = {
addEnvironment: true,
overwrite: true,
};
TelemetryPing.addPendingPing(getPingType(payload), payload, options);
TelemetryController.addPendingPing(getPingType(payload), payload, options);
}
break;
#endif
@ -1932,7 +1932,7 @@ let Impl = {
addEnvironment: true,
};
let promise = TelemetryPing.send(getPingType(payload), payload, options);
let promise = TelemetryController.send(getPingType(payload), payload, options);
#if !defined(MOZ_WIDGET_GONK) && !defined(MOZ_WIDGET_ANDROID)
// If required, also save the payload as an aborted session.
if (saveAsAborted) {
@ -2011,7 +2011,7 @@ let Impl = {
addEnvironment: true,
overrideEnvironment: oldEnvironment,
};
TelemetryPing.send(getPingType(payload), payload, options);
TelemetryController.send(getPingType(payload), payload, options);
},
_isClassicReason: function(reason) {
@ -2054,7 +2054,7 @@ let Impl = {
},
/**
* Check if there's any aborted session ping available. If so, tell TelemetryPing about
* Check if there's any aborted session ping available. If so, tell TelemetryController about
* it.
*/
_checkAbortedSessionPing: Task.async(function* () {
@ -2071,7 +2071,7 @@ let Impl = {
if (abortedExists) {
this._log.trace("_checkAbortedSessionPing - aborted session found: " + FILE_PATH);
yield this._abortedSessionSerializer.enqueueTask(
() => TelemetryPing.addPendingPingFromFile(FILE_PATH, true));
() => TelemetryController.addPendingPingFromFile(FILE_PATH, true));
}
}),
@ -2102,6 +2102,6 @@ let Impl = {
overwrite: true,
};
return this._abortedSessionSerializer.enqueueTask(() =>
TelemetryPing.savePing(getPingType(payload), payload, FILE_PATH, options));
TelemetryController.savePing(getPingType(payload), payload, FILE_PATH, options));
},
};

View File

@ -7,14 +7,14 @@
const {classes: Cc, interfaces: Ci, utils: Cu} = Components;
Cu.import("resource://gre/modules/TelemetryPing.jsm", this);
+Cu.import("resource://gre/modules/TelemetryController.jsm", this);
Cu.import("resource://gre/modules/TelemetrySession.jsm", this);
Cu.import("resource://gre/modules/TelemetryEnvironment.jsm", this);
Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
/**
* TelemetryStartup is needed to forward the "profile-after-change" notification
* to TelemetryPing.jsm.
* to TelemetryController.jsm.
*/
function TelemetryStartup() {
}
@ -23,7 +23,7 @@ TelemetryStartup.prototype.classID = Components.ID("{117b219f-92fe-4bd2-a21b-95a
TelemetryStartup.prototype.QueryInterface = XPCOMUtils.generateQI([Components.interfaces.nsIObserver]);
TelemetryStartup.prototype.observe = function(aSubject, aTopic, aData) {
if (aTopic == "profile-after-change" || aTopic == "app-startup") {
TelemetryPing.observe(null, aTopic, null);
TelemetryController.observe(null, aTopic, null);
TelemetrySession.observe(null, aTopic, null);
}
if (aTopic == "profile-after-change") {

View File

@ -169,7 +169,7 @@ this.UITelemetry = {
},
/**
* Called by TelemetryPing to populate the simple measurement
* Called by TelemetryController to populate the simple measurement
* blob. This function will iterate over all functions added
* via addSimpleMeasureFunction and return an object with the
* results of those functions.

View File

@ -14,7 +14,7 @@ It contains some basic information shared between different ping types, the :doc
Submission
==========
Pings are submitted via a common API on ``TelemetryPing``. It allows callers to choose a custom retention period that determines how long pings are kept on disk if submission wasn't successful.
Pings are submitted via a common API on ``TelemetryController``. It allows callers to choose a custom retention period that determines how long pings are kept on disk if submission wasn't successful.
If a ping failed to submit (e.g. because of missing internet connection), Telemetry will retry to submit it until its retention period is up.
*Note:* the :doc:`main pings <main-ping>` are kept locally even after successful submission to enable the HealthReport and SelfSupport features. They will be deleted after their retention period of 180 days.
@ -37,7 +37,7 @@ Ping types
Archiving
=========
When archiving is enabled through the relative preference, pings submitted to ``TelemetryPing`` are also stored locally in the user profile directory, in `<profile-dir>/datareporting/archived`.
When archiving is enabled through the relative preference, pings submitted to ``TelemetryController`` are also stored locally in the user profile directory, in `<profile-dir>/datareporting/archived`.
To allow for cheaper lookup of archived pings, storage follows a specific naming scheme for both the directory and the ping file name: `<YYYY-MM>/<timestamp>.<UUID>.<type>.json`.

View File

@ -13,7 +13,7 @@ import json
from collections import OrderedDict
# Keep this in sync with TelemetryPing.
# Keep this in sync with TelemetryController.
startup_histogram_re = re.compile("SQLITE|HTTP|SPDY|CACHE|DNS")
def main(argv):

View File

@ -39,8 +39,8 @@ EXTRA_JS_MODULES += [
]
EXTRA_PP_JS_MODULES += [
'TelemetryController.jsm',
'TelemetryEnvironment.jsm',
'TelemetryPing.jsm',
'TelemetrySession.jsm',
]

View File

@ -3,7 +3,7 @@
const { classes: Cc, utils: Cu, interfaces: Ci, results: Cr } = Components;
Cu.import("resource://gre/modules/TelemetryPing.jsm", this);
Cu.import("resource://gre/modules/TelemetryController.jsm", this);
Cu.import("resource://gre/modules/Services.jsm", this);
const gIsWindows = ("@mozilla.org/windows-registry-key;1" in Cc);
@ -143,7 +143,7 @@ function fakeSchedulerTimer(set, clear) {
function fakeNow(...args) {
const date = new Date(...args);
let ping = Cu.import("resource://gre/modules/TelemetryPing.jsm");
let ping = Cu.import("resource://gre/modules/TelemetryController.jsm");
ping.Policy.now = () => date;
let session = Cu.import("resource://gre/modules/TelemetrySession.jsm");
session.Policy.now = () => date;
@ -170,7 +170,7 @@ function promiseRejects(promise) {
// Set logging preferences for all the tests.
Services.prefs.setCharPref("toolkit.telemetry.log.level", "Trace");
TelemetryPing.initLogging();
TelemetryController.initLogging();
// Telemetry archiving should be on.
Services.prefs.setBoolPref("toolkit.telemetry.archive.enabled", true);

View File

@ -6,7 +6,7 @@
"use strict";
Cu.import("resource://gre/modules/TelemetryPing.jsm", this);
Cu.import("resource://gre/modules/TelemetryController.jsm", this);
Cu.import("resource://gre/modules/TelemetryArchive.jsm", this);
Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
Cu.import("resource://gre/modules/osfile.jsm", this);
@ -24,7 +24,7 @@ function run_test() {
}
add_task(function* test_archivedPings() {
yield TelemetryPing.setup();
yield TelemetryController.setup();
const PINGS = [
{
@ -44,7 +44,7 @@ add_task(function* test_archivedPings() {
for (let data of PINGS) {
fakeNow(data.dateCreated);
data.id = yield TelemetryPing.send(data.type, data.payload);
data.id = yield TelemetryController.send(data.type, data.payload);
let list = yield TelemetryArchive.promiseArchivedPingList();
expectedPingList.push({
@ -70,7 +70,7 @@ add_task(function* test_archivedPings() {
yield checkLoadingPings();
// Check that we find the archived pings again by scanning after a restart.
yield TelemetryPing.setup();
yield TelemetryController.setup();
let pingList = yield TelemetryArchive.promiseArchivedPingList();
Assert.deepEqual(expectedPingList, pingList,

View File

@ -12,7 +12,7 @@ Cu.import("resource://testing-common/httpd.js", this);
Cu.import("resource://gre/modules/ClientID.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
Cu.import("resource://gre/modules/TelemetryPing.jsm", this);
Cu.import("resource://gre/modules/TelemetryController.jsm", this);
Cu.import("resource://gre/modules/TelemetryStorage.jsm", this);
Cu.import("resource://gre/modules/TelemetryArchive.jsm", this);
Cu.import("resource://gre/modules/Task.jsm", this);
@ -42,9 +42,9 @@ let gClientID = null;
function sendPing(aSendClientId, aSendEnvironment) {
if (gServerStarted) {
TelemetryPing.setServer("http://localhost:" + gHttpServer.identity.primaryPort);
TelemetryController.setServer("http://localhost:" + gHttpServer.identity.primaryPort);
} else {
TelemetryPing.setServer("http://doesnotexist");
TelemetryController.setServer("http://doesnotexist");
}
let options = {
@ -52,7 +52,7 @@ function sendPing(aSendClientId, aSendEnvironment) {
addEnvironment: aSendEnvironment,
retentionDays: TEST_PING_RETENTION,
};
return TelemetryPing.send(TEST_PING_TYPE, {}, options);
return TelemetryController.send(TEST_PING_TYPE, {}, options);
}
function wrapWithExceptionHandler(f) {
@ -137,14 +137,14 @@ function run_test() {
}
add_task(function* asyncSetup() {
yield TelemetryPing.setup();
yield TelemetryController.setup();
gClientID = yield ClientID.getClientID();
// We should have cached the client id now. Lets confirm that by
// checking the client id before the async ping setup is finished.
let promisePingSetup = TelemetryPing.reset();
do_check_eq(TelemetryPing.clientID, gClientID);
let promisePingSetup = TelemetryController.reset();
do_check_eq(TelemetryController.clientID, gClientID);
yield promisePingSetup;
});
@ -238,7 +238,7 @@ add_task(function* test_archivePings() {
// Check that the ping was archived, even with upload disabled.
let ping = yield TelemetryArchive.promiseArchivedPingById(pingId);
Assert.equal(ping.id, pingId, "TelemetryPing must archive pings if FHR is enabled.");
Assert.equal(ping.id, pingId, "TelemetryController must archive pings if FHR is enabled.");
// Check that pings don't get archived if not allowed to.
now = new Date(2010, 10, 18, 12, 0, 0);
@ -247,7 +247,7 @@ add_task(function* test_archivePings() {
pingId = yield sendPing(true, true);
let promise = TelemetryArchive.promiseArchivedPingById(pingId);
Assert.ok((yield promiseRejects(promise)),
"TelemetryPing must not archive pings if the archive pref is disabled.");
"TelemetryController must not archive pings if the archive pref is disabled.");
// Enable archiving and the upload so that pings get sent and archived again.
Preferences.set(PREF_FHR_UPLOAD_ENABLED, true);
@ -262,7 +262,7 @@ add_task(function* test_archivePings() {
// Check that we archive pings when successfully sending them.
yield gRequestIterator.next();
ping = yield TelemetryArchive.promiseArchivedPingById(pingId);
Assert.equal(ping.id, pingId, "TelemetryPing must archive pings if FHR is enabled.");
Assert.equal(ping.id, pingId, "TelemetryController must archive pings if FHR is enabled.");
});
add_task(function* stopServer(){

View File

@ -16,7 +16,7 @@
"use strict";
Cu.import("resource://gre/modules/Services.jsm", this);
Cu.import("resource://gre/modules/TelemetryPing.jsm", this);
Cu.import("resource://gre/modules/TelemetryController.jsm", this);
Cu.import("resource://gre/modules/TelemetrySession.jsm", this);
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
@ -26,7 +26,7 @@ XPCOMUtils.defineLazyGetter(this, "gDatareportingService",
.wrappedJSObject);
// Force the Telemetry enabled preference so that TelemetrySession.reset() doesn't exit early.
Services.prefs.setBoolPref(TelemetryPing.Constants.PREF_ENABLED, true);
Services.prefs.setBoolPref(TelemetryController.Constants.PREF_ENABLED, true);
// Set up our dummy AppInfo object so we can control the appBuildID.
Cu.import("resource://testing-common/AppInfo.jsm", this);

View File

@ -1,13 +1,13 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/ */
// Test that TelemetryPing sends close to shutdown don't lead
// Test that TelemetryController sends close to shutdown don't lead
// to AsyncShutdown timeouts.
"use strict";
Cu.import("resource://gre/modules/Services.jsm", this);
Cu.import("resource://gre/modules/TelemetryPing.jsm", this);
Cu.import("resource://gre/modules/TelemetryController.jsm", this);
Cu.import("resource://gre/modules/Timer.jsm", this);
Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
Cu.import("resource://gre/modules/AsyncShutdown.jsm", this);
@ -58,11 +58,11 @@ add_task(function* test_sendTimeout() {
httpServer.registerPrefixHandler("/", contentHandler);
httpServer.start(-1);
yield TelemetryPing.setup();
TelemetryPing.setServer("http://localhost:" + httpServer.identity.primaryPort);
TelemetryPing.send("test-ping-type", {});
yield TelemetryController.setup();
TelemetryController.setServer("http://localhost:" + httpServer.identity.primaryPort);
TelemetryController.send("test-ping-type", {});
// Trigger the AsyncShutdown phase TelemetryPing hangs off.
// Trigger the AsyncShutdown phase TelemetryController hangs off.
AsyncShutdown.profileBeforeChange._trigger();
AsyncShutdown.sendTelemetry._trigger();

View File

@ -8,7 +8,7 @@ Cu.import("resource://gre/modules/PromiseUtils.jsm", this);
Cu.import("resource://gre/modules/Services.jsm", this);
Cu.import("resource://gre/modules/Task.jsm", this);
Cu.import("resource://gre/modules/TelemetryStorage.jsm", this);
Cu.import("resource://gre/modules/TelemetryPing.jsm", this);
Cu.import("resource://gre/modules/TelemetryController.jsm", this);
Cu.import("resource://gre/modules/TelemetrySession.jsm", this);
const PREF_ENABLED = "toolkit.telemetry.enabled";
@ -42,8 +42,8 @@ add_task(function* testSendPendingOnIdleDaily() {
yield TelemetryStorage.savePing(PENDING_PING, true);
// Telemetry will not send this ping at startup, because it's not overdue.
yield TelemetryPing.setup();
TelemetryPing.setServer("http://localhost:" + gHttpServer.identity.primaryPort);
yield TelemetryController.setup();
TelemetryController.setServer("http://localhost:" + gHttpServer.identity.primaryPort);
let pendingPromise = new Promise(resolve =>
gHttpServer.registerPrefixHandler("/submit/telemetry/", request => resolve(request)));

View File

@ -17,7 +17,7 @@ Cu.import("resource://gre/modules/Services.jsm", this);
Cu.import("resource://testing-common/httpd.js", this);
Cu.import("resource://gre/modules/Promise.jsm", this);
Cu.import("resource://gre/modules/TelemetryStorage.jsm", this);
Cu.import("resource://gre/modules/TelemetryPing.jsm", this);
Cu.import("resource://gre/modules/TelemetryController.jsm", this);
Cu.import("resource://gre/modules/Task.jsm", this);
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
let {OS: {File, Path, Constants}} = Cu.import("resource://gre/modules/osfile.jsm", {});
@ -68,7 +68,7 @@ let createSavedPings = Task.async(function* (aPingInfos) {
let num = aPingInfos[type].num;
let age = now - aPingInfos[type].age;
for (let i = 0; i < num; ++i) {
let pingId = yield TelemetryPing.addPendingPing("test-ping", {}, { overwrite: true });
let pingId = yield TelemetryController.addPendingPing("test-ping", {}, { overwrite: true });
if (aPingInfos[type].age) {
// savePing writes to the file synchronously, so we're good to
// modify the lastModifedTime now.
@ -171,11 +171,11 @@ function resetTelemetry() {
}
/**
* Creates and returns a TelemetryPing instance in "testing"
* Creates and returns a TelemetryController instance in "testing"
* mode.
*/
function startTelemetry() {
return TelemetryPing.setup();
return TelemetryController.setup();
}
function run_test() {
@ -189,18 +189,18 @@ function run_test() {
gDatareportingService.observe(null, "app-startup", null);
gDatareportingService.observe(null, "profile-after-change", null);
Services.prefs.setBoolPref(TelemetryPing.Constants.PREF_ENABLED, true);
Services.prefs.setCharPref(TelemetryPing.Constants.PREF_SERVER,
Services.prefs.setBoolPref(TelemetryController.Constants.PREF_ENABLED, true);
Services.prefs.setCharPref(TelemetryController.Constants.PREF_SERVER,
"http://localhost:" + gHttpServer.identity.primaryPort);
run_next_test();
}
/**
* Setup the tests by making sure the ping storage directory is available, otherwise
* |TelemetryPing.testSaveDirectoryToFile| could fail.
* |TelemetryController.testSaveDirectoryToFile| could fail.
*/
add_task(function* setupEnvironment() {
yield TelemetryPing.setup();
yield TelemetryController.setup();
let directory = TelemetryStorage.pingDirectoryPath;
yield File.makeDir(directory, { ignoreExisting: true, unixMode: OS.Constants.S_IRWXU });

View File

@ -14,7 +14,7 @@ Cu.import("resource://gre/modules/ClientID.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/LightweightThemeManager.jsm", this);
Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
Cu.import("resource://gre/modules/TelemetryPing.jsm", this);
Cu.import("resource://gre/modules/TelemetryController.jsm", this);
Cu.import("resource://gre/modules/TelemetrySession.jsm", this);
Cu.import("resource://gre/modules/TelemetryStorage.jsm", this);
Cu.import("resource://gre/modules/TelemetryEnvironment.jsm", this);
@ -97,10 +97,10 @@ function truncateDateToDays(date) {
function sendPing() {
TelemetrySession.gatherStartup();
if (gServerStarted) {
TelemetryPing.setServer("http://localhost:" + gHttpServer.identity.primaryPort);
TelemetryController.setServer("http://localhost:" + gHttpServer.identity.primaryPort);
return TelemetrySession.testPing();
} else {
TelemetryPing.setServer("http://doesnotexist");
TelemetryController.setServer("http://doesnotexist");
return TelemetrySession.testPing();
}
}
@ -366,7 +366,7 @@ function checkPayload(payload, reason, successfulPings) {
// memory reporters. But we can at least check that the data is there.
//
// It's important to check for the presence of reporters with a mix of units,
// because TelemetryPing has separate logic for each one. But we can't
// because TelemetryController has separate logic for each one. But we can't
// currently check UNITS_COUNT_CUMULATIVE or UNITS_PERCENTAGE because
// Telemetry doesn't touch a memory reporter with these units that's
// available on all platforms.
@ -483,7 +483,7 @@ function run_test() {
add_task(function* asyncSetup() {
yield TelemetrySession.setup();
yield TelemetryPing.setup();
yield TelemetryController.setup();
// Load the client ID from the client ID provider to check for pings sanity.
gClientID = yield ClientID.getClientID();
});
@ -795,7 +795,7 @@ add_task(function* test_checkSubsessionData() {
}
// Keep track of the active ticks count if the session recorder is available.
let sessionRecorder = TelemetryPing.getSessionRecorder();
let sessionRecorder = TelemetryController.getSessionRecorder();
let activeTicksAtSubsessionStart = sessionRecorder.activeTicks;
let expectedActiveTicks = activeTicksAtSubsessionStart;
@ -855,7 +855,7 @@ add_task(function* test_dailyCollection() {
// Init and check timer.
yield TelemetrySession.setup();
TelemetryPing.setServer("http://localhost:" + gHttpServer.identity.primaryPort);
TelemetryController.setServer("http://localhost:" + gHttpServer.identity.primaryPort);
// Set histograms to expected state.
const COUNT_ID = "TELEMETRY_TEST_COUNT";
@ -1066,7 +1066,7 @@ add_task(function* test_environmentChange() {
// Setup.
yield TelemetrySession.setup();
TelemetryPing.setServer("http://localhost:" + gHttpServer.identity.primaryPort);
TelemetryController.setServer("http://localhost:" + gHttpServer.identity.primaryPort);
TelemetryEnvironment._watchPreferences(PREFS_TO_WATCH);
// Set histograms to expected state.
@ -1317,10 +1317,10 @@ add_task(function* test_abortedSession() {
"The aborted session ping must exist in the saved pings directory.");
// Trick: make the aborted ping file overdue so that it gets sent immediately when
// resetting TelemetryPing.
// resetting TelemetryController.
const OVERDUE_PING_FILE_AGE = TelemetryStorage.OVERDUE_PING_FILE_AGE + 60 * 1000;
yield OS.File.setDates(PENDING_PING_FILE, null, Date.now() - OVERDUE_PING_FILE_AGE);
yield TelemetryPing.reset();
yield TelemetryController.reset();
// Wait for the aborted-session ping.
let request = yield gRequestIterator.next();

View File

@ -28,15 +28,15 @@ skip-if = android_version == "18"
[test_TelemetryLateWrites.js]
[test_TelemetryLockCount.js]
[test_TelemetryLog.js]
[test_TelemetryPing.js]
[test_TelemetryController.js]
# Bug 676989: test fails consistently on Android
# fail-if = os == "android"
# Bug 1144395: crash on Android 4.3
skip-if = android_version == "18"
[test_TelemetryPing_idle.js]
[test_TelemetryPingShutdown.js]
[test_TelemetryController_idle.js]
[test_TelemetryControllerShutdown.js]
[test_TelemetryStopwatch.js]
[test_TelemetryPingBuildID.js]
[test_TelemetryControllerBuildID.js]
# Bug 1144395: crash on Android 4.3
skip-if = android_version == "18"
[test_TelemetrySendOldPings.js]

View File

@ -10,7 +10,7 @@ const Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/TelemetryTimestamps.jsm");
Cu.import("resource://gre/modules/TelemetryPing.jsm");
Cu.import("resource://gre/modules/TelemetryController.jsm");
Cu.import("resource://gre/modules/TelemetrySession.jsm");
Cu.import("resource://gre/modules/TelemetryLog.jsm");
@ -131,7 +131,7 @@ let GeneralData = {
let row = document.createElement("tr");
this.appendColumn(row, "td", "Client ID\t");
this.appendColumn(row, "td", TelemetryPing.clientID + "\t");
this.appendColumn(row, "td", TelemetryController.clientID + "\t");
table.appendChild(row);
let dataDiv = document.getElementById("general-data");

View File

@ -10,7 +10,7 @@ const Cu = Components.utils;
* This module's purpose is to collect timestamps for important
* application-specific events.
*
* The TelemetryPing component attaches the timestamps stored by this module to
* The TelemetryController component attaches the timestamps stored by this module to
* the telemetry submission, substracting the process lifetime so that the times
* are relative to process startup. The overall goal is to produce a basic
* timeline of the startup process.
@ -44,7 +44,7 @@ this.TelemetryTimestamps = {
/**
* Returns a JS object containing all of the timeStamps as properties (can be
* easily serialized to JSON). Used by TelemetryPing to retrieve the data
* easily serialized to JSON). Used by TelemetryController to retrieve the data
* to attach to the telemetry submission.
*/
get: function TT_get() {

View File

@ -5,7 +5,7 @@ const Cu = Components.utils;
const Cc = Components.classes;
const Ci = Components.interfaces;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/TelemetryPing.jsm", this);
Cu.import("resource://gre/modules/TelemetryController.jsm", this);
Cu.import("resource://gre/modules/TelemetrySession.jsm", this);
Cu.import('resource://gre/modules/XPCOMUtils.jsm');
@ -32,7 +32,7 @@ function loadAddonManager() {
startupManager();
}
function getSimpleMeasurementsFromTelemetryPing() {
function getSimpleMeasurementsFromTelemetryController() {
return TelemetrySession.getPayload().simpleMeasurements;
}
@ -44,7 +44,7 @@ function initialiseTelemetry() {
gDatareportingService.observe(null, "profile-after-change", null);
}
return TelemetryPing.setup().then(TelemetrySession.setup);
return TelemetryController.setup().then(TelemetrySession.setup);
}
function run_test() {
@ -71,7 +71,7 @@ add_task(function* actualTest() {
do_check_true(TelemetryTimestamps.get().foo >= now); // foo has a reasonable value
// Add timestamp with value
// Use a value far in the future since TelemetryPing substracts the time of
// Use a value far in the future since TelemetryController substracts the time of
// process initialization.
const YEAR_4000_IN_MS = 64060588800000;
TelemetryTimestamps.add("bar", YEAR_4000_IN_MS);
@ -91,7 +91,7 @@ add_task(function* actualTest() {
do_check_null(TelemetryTimestamps.get().baz); // no baz was added
// Test that the data gets added to the telemetry ping properly
let simpleMeasurements = getSimpleMeasurementsFromTelemetryPing();
let simpleMeasurements = getSimpleMeasurementsFromTelemetryController();
do_check_true(simpleMeasurements != null); // got simple measurements from ping data
do_check_true(simpleMeasurements.foo > 1); // foo was included
do_check_true(simpleMeasurements.bar > 1); // bar was included