Bug 1136134 - Remove the telemetry environment profile section on Android. r=gfritzsche

This commit is contained in:
Alessio Placitelli 2015-02-25 23:54:34 +01:00
parent 87772ffa70
commit b47a1652ab
3 changed files with 18 additions and 3 deletions

View File

@ -506,7 +506,6 @@ this.TelemetryEnvironment = {
if (resetDate) {
profileData.resetDate = truncateToDays(resetDate);
}
return profileData;
}),
@ -991,7 +990,9 @@ this.TelemetryEnvironment = {
let sections = {
"build" : () => this._getBuild(),
"settings": () => this._getSettings(),
#ifndef MOZ_WIDGET_ANDROID
"profile": () => this._getProfile(),
#endif
"partner": () => this._getPartner(),
"system": () => this._getSystem(),
"addons": () => this._getAddons(),

View File

@ -40,7 +40,7 @@ Structure::
// only record they are present with value being set to null.
},
},
profile: {
profile: { // This section is not available on Android.
creationDate: <integer>, // integer days since UNIX epoch, e.g. 16446
resetDate: <integer>, // integer days since UNIX epoch, e.g. 16446 - optional
},

View File

@ -7,7 +7,6 @@ Cu.import("resource://gre/modules/AddonManager.jsm");
Cu.import("resource://gre/modules/TelemetryEnvironment.jsm", this);
Cu.import("resource://gre/modules/Preferences.jsm", this);
Cu.import("resource://gre/modules/PromiseUtils.jsm", this);
Cu.import("resource://gre/modules/services/healthreport/profile.jsm", this);
Cu.import("resource://gre/modules/XPCOMUtils.jsm", this);
Cu.import("resource://testing-common/AddonManagerTesting.jsm");
Cu.import("resource://testing-common/httpd.js");
@ -16,6 +15,10 @@ Cu.import("resource://testing-common/httpd.js");
XPCOMUtils.defineLazyModuleGetter(this, "LightweightThemeManager",
"resource://gre/modules/LightweightThemeManager.jsm");
// Lazy load |ProfileTimesAccessor| as it is not available on Android.
XPCOMUtils.defineLazyModuleGetter(this, "ProfileTimesAccessor",
"resource://gre/modules/services/healthreport/profile.jsm");
// The webserver hosting the addons.
let gHttpServer = null;
// The URL of the webserver root.
@ -161,6 +164,11 @@ function spoofGfxAdapter() {
}
function spoofProfileReset() {
if (gIsAndroid) {
// ProfileTimesAccessor is not available on Android.
return true;
}
let profileAccessor = new ProfileTimesAccessor();
return profileAccessor.writeTimes({
@ -291,6 +299,12 @@ function checkSettingsSection(data) {
}
function checkProfileSection(data) {
if (gIsAndroid) {
Assert.ok(!("profile" in data),
"There must be no profile section in Environment on Android.");
return;
}
Assert.ok("profile" in data, "There must be a profile section in Environment.");
Assert.equal(data.profile.creationDate, truncateToDays(PROFILE_CREATION_DATE_MS));
Assert.equal(data.profile.resetDate, truncateToDays(PROFILE_RESET_DATE_MS));