Commit 4ed79bef authored by Trent Begin's avatar Trent Begin Committed by Commit Bot

cros_healthd: Add TimezoneInfo to cros_healthd_probe.mojom

Add TimezoneInfo to mojom file to keep it in sync with Chrome OS.

Bug: 1030361
Test: browser_tests --gtest_filter=DeviceStatus* && chromeos_unittests
Change-Id: Ide7cf1bdd7dcb1b17369125048bb4742298a14bf
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2013218
Commit-Queue: Trent Begin <tbegin@chromium.org>
Reviewed-by: default avatarJesse Schettler <jschettler@chromium.org>
Reviewed-by: default avatarSteven Bennetts <stevenjb@chromium.org>
Reviewed-by: default avatarJorge Lucangeli Obes <jorgelo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#734563}
parent c05425f5
......@@ -380,6 +380,7 @@ void GetFakeCrosHealthdData(
const chromeos::cros_healthd::mojom::NonRemovableBlockDeviceInfo&
storage_info,
const chromeos::cros_healthd::mojom::CpuInfo& cpu_info,
const chromeos::cros_healthd::mojom::TimezoneInfo& timezone_info,
const em::CPUTempInfo& cpu_sample,
const em::BatterySample& battery_sample,
policy::DeviceStatusCollector::CrosHealthdDataReceiver receiver) {
......@@ -393,7 +394,7 @@ void GetFakeCrosHealthdData(
cpu_vector.push_back(cpu_info.Clone());
chromeos::cros_healthd::mojom::TelemetryInfo fake_info(
battery_info.Clone(), std::move(block_device_info),
cached_vpd_info.Clone(), std::move(cpu_vector));
cached_vpd_info.Clone(), std::move(cpu_vector), timezone_info.Clone());
auto sample = std::make_unique<policy::SampledData>();
sample->cpu_samples[cpu_sample.cpu_label()] = cpu_sample;
......@@ -2471,6 +2472,10 @@ TEST_F(DeviceStatusCollectorTest, TestCrosHealthdInfo) {
constexpr int kFakeCpuTemp = 91832;
constexpr int kFakeCpuTimestamp = 912;
// Timezone test values.
constexpr char kPosixTimezone[] = "MST7MDT,M3.2.0,M11.1.0";
constexpr char kTimezoneRegion[] = "America/Denver";
chromeos::cros_healthd::mojom::BatteryInfo battery_info(
kFakeCycleCount, kFakeVoltageNow, kFakeBatteryVendor, kFakeBatterySerial,
kFakeChargeFullDesign, kFakeChargeFull, kFakeVoltageMinDesign,
......@@ -2482,6 +2487,8 @@ TEST_F(DeviceStatusCollectorTest, TestCrosHealthdInfo) {
kFakeStorageName, kFakeStorageSerial);
chromeos::cros_healthd::mojom::CpuInfo cpu_info(
kFakeModelName, kFakeMojoArchitecture, kFakeMaxClockSpeed);
chromeos::cros_healthd::mojom::TimezoneInfo timezone_info(kPosixTimezone,
kTimezoneRegion);
// Create a fake sample to test with.
em::CPUTempInfo fake_cpu_temp_sample;
......@@ -2498,7 +2505,7 @@ TEST_F(DeviceStatusCollectorTest, TestCrosHealthdInfo) {
auto options = CreateEmptyDeviceStatusCollectorOptions();
options->cros_healthd_data_fetcher = base::BindRepeating(
&GetFakeCrosHealthdData, battery_info, cached_vpd_info, storage_info,
cpu_info, fake_cpu_temp_sample, fake_battery_sample);
cpu_info, timezone_info, fake_cpu_temp_sample, fake_battery_sample);
RestartStatusCollector(std::move(options));
// If kReportDeviceCpuInfo, kReportDevicePowerStatus, and
......
......@@ -107,11 +107,17 @@ base::Optional<std::vector<mojom::CpuInfoPtr>> MakeCpuInfo() {
return cpu_info;
}
mojom::TimezoneInfoPtr MakeTimezoneInfo() {
return mojom::TimezoneInfo::New("MST7MDT,M3.2.0,M11.1.0" /* posix */,
"America/Denver" /* region */);
}
mojom::TelemetryInfoPtr MakeTelemetryInfo() {
return mojom::TelemetryInfo::New(
MakeBatteryInfo() /* battery_info */,
MakeNonRemovableBlockDeviceInfo() /* block_device_info */,
MakeCachedVpdInfo() /* vpd_info */, MakeCpuInfo() /* cpu_info */
MakeCachedVpdInfo() /* vpd_info */, MakeCpuInfo() /* cpu_info */,
MakeTimezoneInfo() /* timezone_info */
);
}
......
......@@ -24,6 +24,7 @@ enum ProbeCategoryEnum {
kNonRemovableBlockDevices,
kCachedVpdData,
kCpu,
kTimezone,
};
// Information related to the main battery.
......@@ -84,10 +85,18 @@ struct CpuInfo {
string model_name;
// The CPU architecture.
CpuArchitectureEnum architecture;
// The max CPU clock speed in khz.
// The max CPU clock speed in kHz.
uint32 max_clock_speed_khz;
};
// Timezone information.
struct TimezoneInfo {
// The timezone of the device in POSIX standard.
string posix;
// The timezone region of the device.
string region;
};
// A collection of all the device's telemetry information that cros_healthd is
// capable of reporting. Note that every field in TelemetryInfo is nullable, and
// the response for a particular ProbeTelemetryInfo request will only contain
......@@ -107,4 +116,7 @@ struct TelemetryInfo {
// Information about each of the device's CPUs. Only present when kCpu was
// included in the categories input to ProbeTelemetryInfo.
array<CpuInfo>? cpu_info;
// Information about the device's timezone. Only present when kTimezone was
// included in the categories input to ProbeTelemetryInfo.
TimezoneInfo? timezone_info;
};
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment