Bug 1675877 - Record for fog validation whether profile is on a ssd r=janerik

Differential Revision: https://phabricator.services.mozilla.com/D101368
This commit is contained in:
Chris H-C 2021-01-12 20:45:09 +00:00
Родитель 5f3ac9bc5b
Коммит 078aa47127
3 изменённых файлов: 55 добавлений и 0 удалений

Просмотреть файл

@ -88,3 +88,22 @@ fog_validation:
expires: "89"
send_in_pings:
- fog-validation
profile_disk_is_ssd:
type: boolean
description:
True iff the type of the disk the current Firefox profile is stored on is an SSD.
(Windows only).
bugs:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1675877
data_reviews:
- https://bugzilla.mozilla.org/show_bug.cgi?id=1675877#c7
data_sensitivity:
- technical
lifetime: application
notification_emails:
- chutten@mozilla.com
- glean-team@mozilla.com
expires: "89"
send_in_pings:
- fog-validation

Просмотреть файл

@ -17,6 +17,9 @@ const { ObjectUtils } = ChromeUtils.import(
const { AppConstants } = ChromeUtils.import(
"resource://gre/modules/AppConstants.jsm"
);
if (AppConstants.MOZ_GLEAN) {
Cu.importGlobalProperties(["Glean"]);
}
const Utils = TelemetryUtils;
@ -1091,6 +1094,11 @@ EnvironmentCache.prototype = {
if (AppConstants.platform == "win") {
this._hddData = await Services.sysinfo.diskInfo;
if (AppConstants.MOZ_GLEAN) {
Glean.fogValidation.profileDiskIsSsd.set(
this._hddData.profile.type == "SSD"
);
}
let osData = await Services.sysinfo.osInfo;
if (!this._initTask) {

Просмотреть файл

@ -22,6 +22,9 @@ const { OS } = ChromeUtils.import("resource://gre/modules/osfile.jsm");
const { SearchTestUtils } = ChromeUtils.import(
"resource://testing-common/SearchTestUtils.jsm"
);
if (AppConstants.MOZ_GLEAN) {
Cu.importGlobalProperties(["Glean"]);
}
// AttributionCode is only needed for Firefox
ChromeUtils.defineModuleGetter(
@ -177,6 +180,10 @@ var SysInfo = {
return this._genuine.QueryInterface(Ci.nsIPropertyBag).getProperty(name);
},
getPropertyAsACString(name) {
return this.get(name);
},
getPropertyAsUint32(name) {
return this.get(name);
},
@ -1049,6 +1056,12 @@ add_task(async function setup() {
spoofGfxAdapter();
do_get_profile();
if (AppConstants.MOZ_GLEAN) {
// We need to ensure FOG is initialized, otherwise we will panic trying to get test values.
let FOG = Cc["@mozilla.org/toolkit/glean;1"].createInstance(Ci.nsIFOG);
FOG.initializeFOG();
}
// The system add-on must be installed before AddonManager is started.
const distroDir = FileUtils.getDir("ProfD", ["sysfeatures", "app0"], true);
do_get_file("system.xpi").copyTo(
@ -2447,6 +2460,21 @@ if (gIsWindows) {
checkString(data.system.hdd[k].revision);
checkString(data.system.hdd[k].type);
}
if (AppConstants.MOZ_GLEAN) {
if (data.system.hdd.profile.type == "SSD") {
Assert.equal(
true,
Glean.fogValidation.profileDiskIsSsd.testGetValue(),
"SSDness should be recorded in Glean"
);
} else {
Assert.equal(
false,
Glean.fogValidation.profileDiskIsSsd.testGetValue(),
"nonSSDness should be recorded in Glean"
);
}
}
});
add_task(async function test_environmentProcessInfo() {