diff --git a/chrome/browser/ash/telemetry_extension/fake_probe_service.cc b/chrome/browser/ash/telemetry_extension/fake_probe_service.cc index c12535d740b383..d511243456b3a4 100644 --- a/chrome/browser/ash/telemetry_extension/fake_probe_service.cc +++ b/chrome/browser/ash/telemetry_extension/fake_probe_service.cc @@ -22,9 +22,9 @@ void FakeProbeService::Factory::SetCreateInstanceResponse( fake_service_ = std::move(fake_service); } -std::unique_ptr +std::unique_ptr FakeProbeService::Factory::CreateInstance( - mojo::PendingReceiver receiver) { + mojo::PendingReceiver receiver) { fake_service_->BindPendingReceiver(std::move(receiver)); return std::move(fake_service_); } @@ -39,7 +39,7 @@ FakeProbeService::~FakeProbeService() { } void FakeProbeService::ProbeTelemetryInfo( - const std::vector& categories, + const std::vector& categories, ProbeTelemetryInfoCallback callback) { actual_requested_categories_.clear(); actual_requested_categories_.insert(actual_requested_categories_.end(), @@ -55,22 +55,23 @@ void FakeProbeService::GetOemData(GetOemDataCallback callback) { } void FakeProbeService::SetExpectedLastRequestedCategories( - std::vector + std::vector expected_requested_categories) { expected_requested_categories_ = std::move(expected_requested_categories); } void FakeProbeService::SetProbeTelemetryInfoResponse( - health::mojom::TelemetryInfoPtr response_info) { + crosapi::mojom::ProbeTelemetryInfoPtr response_info) { telem_info_ = std::move(response_info); } -void FakeProbeService::SetOemDataResponse(health::mojom::OemDataPtr oem_data) { +void FakeProbeService::SetOemDataResponse( + crosapi::mojom::ProbeOemDataPtr oem_data) { oem_data_ = std::move(oem_data); } void FakeProbeService::BindPendingReceiver( - mojo::PendingReceiver receiver) { + mojo::PendingReceiver receiver) { receiver_.Bind(std::move(receiver)); } diff --git a/chrome/browser/ash/telemetry_extension/fake_probe_service.h b/chrome/browser/ash/telemetry_extension/fake_probe_service.h index 638585d719e4af..67a2c83a1a294e 100644 --- a/chrome/browser/ash/telemetry_extension/fake_probe_service.h +++ b/chrome/browser/ash/telemetry_extension/fake_probe_service.h @@ -15,7 +15,7 @@ namespace ash { -class FakeProbeService : public health::mojom::ProbeService { +class FakeProbeService : public crosapi::mojom::ProbeService { public: class Factory : public ash::ProbeService::Factory { public: @@ -27,16 +27,17 @@ class FakeProbeService : public health::mojom::ProbeService { protected: // ProbeService::Factory: - std::unique_ptr CreateInstance( - mojo::PendingReceiver receiver) override; + std::unique_ptr CreateInstance( + mojo::PendingReceiver receiver) override; private: - health::mojom::TelemetryInfoPtr telem_info_{ - health::mojom::TelemetryInfo::New()}; + crosapi::mojom::ProbeTelemetryInfoPtr telem_info_{ + crosapi::mojom::ProbeTelemetryInfo::New()}; - health::mojom::OemDataPtr oem_data_{health::mojom::OemData::New()}; + crosapi::mojom::ProbeOemDataPtr oem_data_{ + crosapi::mojom::ProbeOemData::New()}; - std::vector requested_categories_; + std::vector requested_categories_; private: std::unique_ptr fake_service_; @@ -47,43 +48,44 @@ class FakeProbeService : public health::mojom::ProbeService { FakeProbeService& operator=(const FakeProbeService&) = delete; ~FakeProbeService() override; - // health::mojom::ProbeService overrides. + // crosapi::mojom::ProbeService overrides. void ProbeTelemetryInfo( - const std::vector& categories, + const std::vector& categories, ProbeTelemetryInfoCallback callback) override; void GetOemData(GetOemDataCallback callback) override; // Sets the return value for |ProbeTelemetryInfo|. void SetProbeTelemetryInfoResponse( - health::mojom::TelemetryInfoPtr response_info); + crosapi::mojom::ProbeTelemetryInfoPtr response_info); // Sets the return value for |GetOemData|. - void SetOemDataResponse(health::mojom::OemDataPtr oem_data); + void SetOemDataResponse(crosapi::mojom::ProbeOemDataPtr oem_data); // Set expectation about the parameter that is passed to |ProbeTelemetryInfo|. void SetExpectedLastRequestedCategories( - std::vector + std::vector expected_requested_categories); private: void BindPendingReceiver( - mojo::PendingReceiver receiver); + mojo::PendingReceiver receiver); - mojo::Receiver receiver_; + mojo::Receiver receiver_; // Response for a call to |ProbeTelemetryInfo|. - health::mojom::TelemetryInfoPtr telem_info_{ - health::mojom::TelemetryInfo::New()}; + crosapi::mojom::ProbeTelemetryInfoPtr telem_info_{ + crosapi::mojom::ProbeTelemetryInfo::New()}; // Response for a call to |GetOemData|. - health::mojom::OemDataPtr oem_data_{health::mojom::OemData::New()}; + crosapi::mojom::ProbeOemDataPtr oem_data_{ + crosapi::mojom::ProbeOemData::New()}; // Expectation about the parameter that is passed to |ProbeTelemetryInfo|. - std::vector actual_requested_categories_; + std::vector actual_requested_categories_; // Actual passed parameter. - std::vector expected_requested_categories_; + std::vector expected_requested_categories_; }; } // namespace ash diff --git a/chrome/browser/ash/telemetry_extension/probe_service.cc b/chrome/browser/ash/telemetry_extension/probe_service.cc index dac9ab996eb663..71d0e278364b7c 100644 --- a/chrome/browser/ash/telemetry_extension/probe_service.cc +++ b/chrome/browser/ash/telemetry_extension/probe_service.cc @@ -25,8 +25,8 @@ constexpr char kOemDataLogName[] = "oemdata"; ProbeService::Factory* ProbeService::Factory::test_factory_ = nullptr; // static -std::unique_ptr ProbeService::Factory::Create( - mojo::PendingReceiver receiver) { +std::unique_ptr ProbeService::Factory::Create( + mojo::PendingReceiver receiver) { if (test_factory_) { return test_factory_->CreateInstance(std::move(receiver)); } @@ -42,18 +42,18 @@ void ProbeService::Factory::SetForTesting(ProbeService::Factory* test_factory) { ProbeService::Factory::~Factory() = default; ProbeService::ProbeService( - mojo::PendingReceiver receiver) + mojo::PendingReceiver receiver) : receiver_(this, std::move(receiver)) {} ProbeService::~ProbeService() = default; void ProbeService::ProbeTelemetryInfo( - const std::vector& categories, + const std::vector& categories, ProbeTelemetryInfoCallback callback) { GetService()->ProbeTelemetryInfo( converters::ConvertCategoryVector(categories), base::BindOnce( - [](health::mojom::ProbeService::ProbeTelemetryInfoCallback callback, + [](crosapi::mojom::ProbeService::ProbeTelemetryInfoCallback callback, cros_healthd::mojom::TelemetryInfoPtr ptr) { std::move(callback).Run( converters::ConvertProbePtr(std::move(ptr))); @@ -68,7 +68,7 @@ void ProbeService::GetOemData(GetOemDataCallback callback) { [](GetOemDataCallback callback, absl::optional oem_data) { std::move(callback).Run( - health::mojom::OemData::New(std::move(oem_data))); + crosapi::mojom::ProbeOemData::New(std::move(oem_data))); }, std::move(callback))); } diff --git a/chrome/browser/ash/telemetry_extension/probe_service.h b/chrome/browser/ash/telemetry_extension/probe_service.h index 2d0eca4ae399b5..edd3ec80b54a5f 100644 --- a/chrome/browser/ash/telemetry_extension/probe_service.h +++ b/chrome/browser/ash/telemetry_extension/probe_service.h @@ -21,19 +21,19 @@ namespace cros_healthd { namespace mojom = ::chromeos::cros_healthd::mojom; } // namespace cros_healthd -class ProbeService : public health::mojom::ProbeService { +class ProbeService : public crosapi::mojom::ProbeService { public: class Factory { public: - static std::unique_ptr Create( - mojo::PendingReceiver receiver); + static std::unique_ptr Create( + mojo::PendingReceiver receiver); static void SetForTesting(Factory* test_factory); virtual ~Factory(); protected: - virtual std::unique_ptr CreateInstance( - mojo::PendingReceiver receiver) = 0; + virtual std::unique_ptr CreateInstance( + mojo::PendingReceiver receiver) = 0; private: static Factory* test_factory_; @@ -45,11 +45,11 @@ class ProbeService : public health::mojom::ProbeService { private: explicit ProbeService( - mojo::PendingReceiver receiver); + mojo::PendingReceiver receiver); - // health::mojom::ProbeService override + // crosapi::mojom::ProbeService override void ProbeTelemetryInfo( - const std::vector& categories, + const std::vector& categories, ProbeTelemetryInfoCallback callback) override; void GetOemData(GetOemDataCallback callback) override; @@ -66,7 +66,7 @@ class ProbeService : public health::mojom::ProbeService { // interface pipe before destroying pending response callbacks owned by // |service_|. It is an error to drop response callbacks which still // correspond to an open interface pipe. - mojo::Receiver receiver_; + mojo::Receiver receiver_; }; } // namespace ash diff --git a/chrome/browser/ash/telemetry_extension/probe_service_converters.cc b/chrome/browser/ash/telemetry_extension/probe_service_converters.cc index 9e8aec7b38f0b8..918d9b6e04c279 100644 --- a/chrome/browser/ash/telemetry_extension/probe_service_converters.cc +++ b/chrome/browser/ash/telemetry_extension/probe_service_converters.cc @@ -10,6 +10,7 @@ #include "base/notreached.h" #include "base/strings/string_number_conversions.h" #include "chromeos/ash/services/cros_healthd/public/mojom/cros_healthd_probe.mojom.h" +#include "chromeos/crosapi/mojom/nullable_primitives.mojom.h" #include "chromeos/crosapi/mojom/probe_service.mojom.h" namespace ash { @@ -20,31 +21,31 @@ namespace { namespace cros_healthd = ::ash::cros_healthd; cros_healthd::mojom::ProbeCategoryEnum Convert( - health::mojom::ProbeCategoryEnum input) { + crosapi::mojom::ProbeCategoryEnum input) { switch (input) { - case health::mojom::ProbeCategoryEnum::kUnknown: + case crosapi::mojom::ProbeCategoryEnum::kUnknown: return cros_healthd::mojom::ProbeCategoryEnum::kUnknown; - case health::mojom::ProbeCategoryEnum::kBattery: + case crosapi::mojom::ProbeCategoryEnum::kBattery: return cros_healthd::mojom::ProbeCategoryEnum::kBattery; - case health::mojom::ProbeCategoryEnum::kNonRemovableBlockDevices: + case crosapi::mojom::ProbeCategoryEnum::kNonRemovableBlockDevices: return cros_healthd::mojom::ProbeCategoryEnum::kNonRemovableBlockDevices; - case health::mojom::ProbeCategoryEnum::kCachedVpdData: + case crosapi::mojom::ProbeCategoryEnum::kCachedVpdData: return cros_healthd::mojom::ProbeCategoryEnum::kSystem; - case health::mojom::ProbeCategoryEnum::kCpu: + case crosapi::mojom::ProbeCategoryEnum::kCpu: return cros_healthd::mojom::ProbeCategoryEnum::kCpu; - case health::mojom::ProbeCategoryEnum::kTimezone: + case crosapi::mojom::ProbeCategoryEnum::kTimezone: return cros_healthd::mojom::ProbeCategoryEnum::kTimezone; - case health::mojom::ProbeCategoryEnum::kMemory: + case crosapi::mojom::ProbeCategoryEnum::kMemory: return cros_healthd::mojom::ProbeCategoryEnum::kMemory; - case health::mojom::ProbeCategoryEnum::kBacklight: + case crosapi::mojom::ProbeCategoryEnum::kBacklight: return cros_healthd::mojom::ProbeCategoryEnum::kBacklight; - case health::mojom::ProbeCategoryEnum::kFan: + case crosapi::mojom::ProbeCategoryEnum::kFan: return cros_healthd::mojom::ProbeCategoryEnum::kFan; - case health::mojom::ProbeCategoryEnum::kStatefulPartition: + case crosapi::mojom::ProbeCategoryEnum::kStatefulPartition: return cros_healthd::mojom::ProbeCategoryEnum::kStatefulPartition; - case health::mojom::ProbeCategoryEnum::kBluetooth: + case crosapi::mojom::ProbeCategoryEnum::kBluetooth: return cros_healthd::mojom::ProbeCategoryEnum::kBluetooth; - case health::mojom::ProbeCategoryEnum::kSystem: + case crosapi::mojom::ProbeCategoryEnum::kSystem: return cros_healthd::mojom::ProbeCategoryEnum::kSystem; } NOTREACHED(); @@ -54,20 +55,20 @@ cros_healthd::mojom::ProbeCategoryEnum Convert( namespace unchecked { -health::mojom::ProbeErrorPtr UncheckedConvertPtr( +crosapi::mojom::ProbeErrorPtr UncheckedConvertPtr( cros_healthd::mojom::ProbeErrorPtr input) { - return health::mojom::ProbeError::New(Convert(input->type), - std::move(input->msg)); + return crosapi::mojom::ProbeError::New(Convert(input->type), + std::move(input->msg)); } -health::mojom::UInt64ValuePtr UncheckedConvertPtr( +crosapi::mojom::UInt64ValuePtr UncheckedConvertPtr( cros_healthd::mojom::NullableUint64Ptr input) { - return health::mojom::UInt64Value::New(input->value); + return crosapi::mojom::UInt64Value::New(input->value); } -health::mojom::BatteryInfoPtr UncheckedConvertPtr( +crosapi::mojom::ProbeBatteryInfoPtr UncheckedConvertPtr( cros_healthd::mojom::BatteryInfoPtr input) { - return health::mojom::BatteryInfo::New( + return crosapi::mojom::ProbeBatteryInfo::New( Convert(input->cycle_count), Convert(input->voltage_now), std::move(input->vendor), std::move(input->serial_number), Convert(input->charge_full_design), Convert(input->charge_full), @@ -78,21 +79,21 @@ health::mojom::BatteryInfoPtr UncheckedConvertPtr( ConvertProbePtr(std::move(input->temperature))); } -health::mojom::BatteryResultPtr UncheckedConvertPtr( +crosapi::mojom::ProbeBatteryResultPtr UncheckedConvertPtr( cros_healthd::mojom::BatteryResultPtr input) { switch (input->which()) { case cros_healthd::mojom::BatteryResult::Tag::kBatteryInfo: - return health::mojom::BatteryResult::NewBatteryInfo( + return crosapi::mojom::ProbeBatteryResult::NewBatteryInfo( ConvertProbePtr(std::move(input->get_battery_info()))); case cros_healthd::mojom::BatteryResult::Tag::kError: - return health::mojom::BatteryResult::NewError( + return crosapi::mojom::ProbeBatteryResult::NewError( ConvertProbePtr(std::move(input->get_error()))); } } -health::mojom::NonRemovableBlockDeviceInfoPtr UncheckedConvertPtr( +crosapi::mojom::ProbeNonRemovableBlockDeviceInfoPtr UncheckedConvertPtr( cros_healthd::mojom::NonRemovableBlockDeviceInfoPtr input) { - return health::mojom::NonRemovableBlockDeviceInfo::New( + return crosapi::mojom::ProbeNonRemovableBlockDeviceInfo::New( std::move(input->path), Convert(input->size), std::move(input->type), Convert(static_cast(input->manufacturer_id)), std::move(input->name), base::NumberToString(input->serial), @@ -104,30 +105,32 @@ health::mojom::NonRemovableBlockDeviceInfoPtr UncheckedConvertPtr( ConvertProbePtr(std::move(input->discard_time_seconds_since_last_boot))); } -health::mojom::NonRemovableBlockDeviceResultPtr UncheckedConvertPtr( +crosapi::mojom::ProbeNonRemovableBlockDeviceResultPtr UncheckedConvertPtr( cros_healthd::mojom::NonRemovableBlockDeviceResultPtr input) { switch (input->which()) { case cros_healthd::mojom::NonRemovableBlockDeviceResult::Tag:: kBlockDeviceInfo: - return health::mojom::NonRemovableBlockDeviceResult::NewBlockDeviceInfo( - ConvertPtrVector( - std::move(input->get_block_device_info()))); + return crosapi::mojom::ProbeNonRemovableBlockDeviceResult:: + NewBlockDeviceInfo( + ConvertPtrVector< + crosapi::mojom::ProbeNonRemovableBlockDeviceInfoPtr>( + std::move(input->get_block_device_info()))); case cros_healthd::mojom::NonRemovableBlockDeviceResult::Tag::kError: - return health::mojom::NonRemovableBlockDeviceResult::NewError( + return crosapi::mojom::ProbeNonRemovableBlockDeviceResult::NewError( ConvertProbePtr(std::move(input->get_error()))); } } -health::mojom::CachedVpdInfoPtr UncheckedConvertPtr( +crosapi::mojom::ProbeCachedVpdInfoPtr UncheckedConvertPtr( cros_healthd::mojom::VpdInfoPtr input) { - return health::mojom::CachedVpdInfo::New( + return crosapi::mojom::ProbeCachedVpdInfo::New( std::move(input->activate_date), std::move(input->sku_number), std::move(input->serial_number), std::move(input->model_name)); } -health::mojom::CpuCStateInfoPtr UncheckedConvertPtr( +crosapi::mojom::ProbeCpuCStateInfoPtr UncheckedConvertPtr( cros_healthd::mojom::CpuCStateInfoPtr input) { - return health::mojom::CpuCStateInfo::New( + return crosapi::mojom::ProbeCpuCStateInfo::New( std::move(input->name), Convert(input->time_in_state_since_last_boot_us)); } @@ -141,12 +144,12 @@ uint64_t UserHz() { } // namespace -health::mojom::LogicalCpuInfoPtr UncheckedConvertPtr( +crosapi::mojom::ProbeLogicalCpuInfoPtr UncheckedConvertPtr( cros_healthd::mojom::LogicalCpuInfoPtr input) { return UncheckedConvertPtr(std::move(input), UserHz()); } -health::mojom::LogicalCpuInfoPtr UncheckedConvertPtr( +crosapi::mojom::ProbeLogicalCpuInfoPtr UncheckedConvertPtr( cros_healthd::mojom::LogicalCpuInfoPtr input, uint64_t user_hz) { constexpr uint64_t kMillisecondsInSecond = 1000; @@ -154,202 +157,205 @@ health::mojom::LogicalCpuInfoPtr UncheckedConvertPtr( DCHECK(user_hz != 0); - return health::mojom::LogicalCpuInfo::New( + return crosapi::mojom::ProbeLogicalCpuInfo::New( Convert(input->max_clock_speed_khz), Convert(input->scaling_max_frequency_khz), Convert(input->scaling_current_frequency_khz), Convert(idle_time_user_hz * kMillisecondsInSecond / user_hz), - ConvertPtrVector( + ConvertPtrVector( std::move(input->c_states))); } -health::mojom::PhysicalCpuInfoPtr UncheckedConvertPtr( +crosapi::mojom::ProbePhysicalCpuInfoPtr UncheckedConvertPtr( cros_healthd::mojom::PhysicalCpuInfoPtr input) { - return health::mojom::PhysicalCpuInfo::New( + return crosapi::mojom::ProbePhysicalCpuInfo::New( std::move(input->model_name), - ConvertPtrVector( + ConvertPtrVector( std::move(input->logical_cpus))); } -health::mojom::CpuInfoPtr UncheckedConvertPtr( +crosapi::mojom::ProbeCpuInfoPtr UncheckedConvertPtr( cros_healthd::mojom::CpuInfoPtr input) { - return health::mojom::CpuInfo::New( + return crosapi::mojom::ProbeCpuInfo::New( Convert(input->num_total_threads), Convert(input->architecture), - ConvertPtrVector( + ConvertPtrVector( std::move(input->physical_cpus))); } -health::mojom::CpuResultPtr UncheckedConvertPtr( +crosapi::mojom::ProbeCpuResultPtr UncheckedConvertPtr( cros_healthd::mojom::CpuResultPtr input) { switch (input->which()) { case cros_healthd::mojom::CpuResult::Tag::kCpuInfo: - return health::mojom::CpuResult::NewCpuInfo( + return crosapi::mojom::ProbeCpuResult::NewCpuInfo( ConvertProbePtr(std::move(input->get_cpu_info()))); case cros_healthd::mojom::CpuResult::Tag::kError: - return health::mojom::CpuResult::NewError( + return crosapi::mojom::ProbeCpuResult::NewError( ConvertProbePtr(std::move(input->get_error()))); } } -health::mojom::TimezoneInfoPtr UncheckedConvertPtr( +crosapi::mojom::ProbeTimezoneInfoPtr UncheckedConvertPtr( cros_healthd::mojom::TimezoneInfoPtr input) { - return health::mojom::TimezoneInfo::New(input->posix, input->region); + return crosapi::mojom::ProbeTimezoneInfo::New(input->posix, input->region); } -health::mojom::TimezoneResultPtr UncheckedConvertPtr( +crosapi::mojom::ProbeTimezoneResultPtr UncheckedConvertPtr( cros_healthd::mojom::TimezoneResultPtr input) { switch (input->which()) { case cros_healthd::mojom::TimezoneResult::Tag::kTimezoneInfo: - return health::mojom::TimezoneResult::NewTimezoneInfo( + return crosapi::mojom::ProbeTimezoneResult::NewTimezoneInfo( ConvertProbePtr(std::move(input->get_timezone_info()))); case cros_healthd::mojom::TimezoneResult::Tag::kError: - return health::mojom::TimezoneResult::NewError( + return crosapi::mojom::ProbeTimezoneResult::NewError( ConvertProbePtr(std::move(input->get_error()))); } } -health::mojom::MemoryInfoPtr UncheckedConvertPtr( +crosapi::mojom::ProbeMemoryInfoPtr UncheckedConvertPtr( cros_healthd::mojom::MemoryInfoPtr input) { - return health::mojom::MemoryInfo::New( + return crosapi::mojom::ProbeMemoryInfo::New( Convert(input->total_memory_kib), Convert(input->free_memory_kib), Convert(input->available_memory_kib), Convert(static_cast(input->page_faults_since_last_boot))); } -health::mojom::MemoryResultPtr UncheckedConvertPtr( +crosapi::mojom::ProbeMemoryResultPtr UncheckedConvertPtr( cros_healthd::mojom::MemoryResultPtr input) { switch (input->which()) { case cros_healthd::mojom::MemoryResult::Tag::kMemoryInfo: - return health::mojom::MemoryResult::NewMemoryInfo( + return crosapi::mojom::ProbeMemoryResult::NewMemoryInfo( ConvertProbePtr(std::move(input->get_memory_info()))); case cros_healthd::mojom::MemoryResult::Tag::kError: - return health::mojom::MemoryResult::NewError( + return crosapi::mojom::ProbeMemoryResult::NewError( ConvertProbePtr(std::move(input->get_error()))); } } -health::mojom::BacklightInfoPtr UncheckedConvertPtr( +crosapi::mojom::ProbeBacklightInfoPtr UncheckedConvertPtr( cros_healthd::mojom::BacklightInfoPtr input) { - return health::mojom::BacklightInfo::New(std::move(input->path), - Convert(input->max_brightness), - Convert(input->brightness)); + return crosapi::mojom::ProbeBacklightInfo::New(std::move(input->path), + Convert(input->max_brightness), + Convert(input->brightness)); } -health::mojom::BacklightResultPtr UncheckedConvertPtr( +crosapi::mojom::ProbeBacklightResultPtr UncheckedConvertPtr( cros_healthd::mojom::BacklightResultPtr input) { switch (input->which()) { case cros_healthd::mojom::BacklightResult::Tag::kBacklightInfo: - return health::mojom::BacklightResult::NewBacklightInfo( - ConvertPtrVector( + return crosapi::mojom::ProbeBacklightResult::NewBacklightInfo( + ConvertPtrVector( std::move(input->get_backlight_info()))); case cros_healthd::mojom::BacklightResult::Tag::kError: - return health::mojom::BacklightResult::NewError( + return crosapi::mojom::ProbeBacklightResult::NewError( ConvertProbePtr(std::move(input->get_error()))); } } -health::mojom::FanInfoPtr UncheckedConvertPtr( +crosapi::mojom::ProbeFanInfoPtr UncheckedConvertPtr( cros_healthd::mojom::FanInfoPtr input) { - return health::mojom::FanInfo::New(Convert(input->speed_rpm)); + return crosapi::mojom::ProbeFanInfo::New(Convert(input->speed_rpm)); } -health::mojom::FanResultPtr UncheckedConvertPtr( +crosapi::mojom::ProbeFanResultPtr UncheckedConvertPtr( cros_healthd::mojom::FanResultPtr input) { switch (input->which()) { case cros_healthd::mojom::FanResult::Tag::kFanInfo: - return health::mojom::FanResult::NewFanInfo( - ConvertPtrVector( + return crosapi::mojom::ProbeFanResult::NewFanInfo( + ConvertPtrVector( std::move(input->get_fan_info()))); case cros_healthd::mojom::FanResult::Tag::kError: - return health::mojom::FanResult::NewError( + return crosapi::mojom::ProbeFanResult::NewError( ConvertProbePtr(std::move(input->get_error()))); } } -health::mojom::StatefulPartitionInfoPtr UncheckedConvertPtr( +crosapi::mojom::ProbeStatefulPartitionInfoPtr UncheckedConvertPtr( cros_healthd::mojom::StatefulPartitionInfoPtr input) { constexpr uint64_t k100MiB = 100 * 1024 * 1024; - return health::mojom::StatefulPartitionInfo::New( + return crosapi::mojom::ProbeStatefulPartitionInfo::New( Convert(input->available_space / k100MiB * k100MiB), Convert(input->total_space)); } -health::mojom::StatefulPartitionResultPtr UncheckedConvertPtr( +crosapi::mojom::ProbeStatefulPartitionResultPtr UncheckedConvertPtr( cros_healthd::mojom::StatefulPartitionResultPtr input) { switch (input->which()) { case cros_healthd::mojom::StatefulPartitionResult::Tag::kPartitionInfo: - return health::mojom::StatefulPartitionResult::NewPartitionInfo( + return crosapi::mojom::ProbeStatefulPartitionResult::NewPartitionInfo( ConvertProbePtr(std::move(input->get_partition_info()))); case cros_healthd::mojom::StatefulPartitionResult::Tag::kError: - return health::mojom::StatefulPartitionResult::NewError( + return crosapi::mojom::ProbeStatefulPartitionResult::NewError( ConvertProbePtr(std::move(input->get_error()))); } } -health::mojom::BluetoothAdapterInfoPtr UncheckedConvertPtr( +crosapi::mojom::ProbeBluetoothAdapterInfoPtr UncheckedConvertPtr( cros_healthd::mojom::BluetoothAdapterInfoPtr input) { - return health::mojom::BluetoothAdapterInfo::New( + return crosapi::mojom::ProbeBluetoothAdapterInfo::New( std::move(input->name), std::move(input->address), Convert(input->powered), Convert(input->num_connected_devices)); } -health::mojom::BluetoothResultPtr UncheckedConvertPtr( +crosapi::mojom::ProbeBluetoothResultPtr UncheckedConvertPtr( cros_healthd::mojom::BluetoothResultPtr input) { switch (input->which()) { case cros_healthd::mojom::BluetoothResult::Tag::kBluetoothAdapterInfo: - return health::mojom::BluetoothResult::NewBluetoothAdapterInfo( - ConvertPtrVector( + return crosapi::mojom::ProbeBluetoothResult::NewBluetoothAdapterInfo( + ConvertPtrVector( std::move(input->get_bluetooth_adapter_info()))); case cros_healthd::mojom::BluetoothResult::Tag::kError: - return health::mojom::BluetoothResult::NewError( + return crosapi::mojom::ProbeBluetoothResult::NewError( ConvertProbePtr(std::move(input->get_error()))); } } -health::mojom::SystemInfoPtr UncheckedConvertPtr( +crosapi::mojom::ProbeSystemInfoPtr UncheckedConvertPtr( cros_healthd::mojom::OsInfoPtr input) { - return health::mojom::SystemInfo::New(health::mojom::OsInfo::New( + return crosapi::mojom::ProbeSystemInfo::New(crosapi::mojom::ProbeOsInfo::New( std::move(input->oem_name), ConvertProbePtr(std::move(input->os_version)))); } -health::mojom::OsVersionPtr UncheckedConvertPtr( +crosapi::mojom::ProbeOsVersionPtr UncheckedConvertPtr( cros_healthd::mojom::OsVersionPtr input) { - return health::mojom::OsVersion::New( + return crosapi::mojom::ProbeOsVersion::New( std::move(input->release_milestone), std::move(input->build_number), std::move(input->patch_number), std::move(input->release_channel)); } -std::pair +std::pair UncheckedConvertPairPtr(cros_healthd::mojom::SystemInfoPtr input) { return std::make_pair(ConvertProbePtr(std::move(input->vpd_info)), ConvertProbePtr(std::move(input->os_info))); } -std::pair +std::pair UncheckedConvertPairPtr(cros_healthd::mojom::SystemResultPtr input) { switch (input->which()) { case cros_healthd::mojom::SystemResult::Tag::kSystemInfo: { auto output = ConvertProbePairPtr(std::move(input->get_system_info())); - return std::make_pair( - health::mojom::CachedVpdResult::NewVpdInfo(std::move(output.first)), - health::mojom::SystemResult::NewSystemInfo(std::move(output.second))); + return std::make_pair(crosapi::mojom::ProbeCachedVpdResult::NewVpdInfo( + std::move(output.first)), + crosapi::mojom::ProbeSystemResult::NewSystemInfo( + std::move(output.second))); } case cros_healthd::mojom::SystemResult::Tag::kError: { auto system_error = ConvertProbePtr(std::move(input->get_error())); return std::make_pair( - health::mojom::CachedVpdResult::NewError(system_error.Clone()), - health::mojom::SystemResult::NewError(system_error.Clone())); + crosapi::mojom::ProbeCachedVpdResult::NewError(system_error.Clone()), + crosapi::mojom::ProbeSystemResult::NewError(system_error.Clone())); } } } -health::mojom::TelemetryInfoPtr UncheckedConvertPtr( +crosapi::mojom::ProbeTelemetryInfoPtr UncheckedConvertPtr( cros_healthd::mojom::TelemetryInfoPtr input) { auto system_result_output = ConvertProbePairPtr(std::move(input->system_result)); - return health::mojom::TelemetryInfo::New( + return crosapi::mojom::ProbeTelemetryInfo::New( ConvertProbePtr(std::move(input->battery_result)), ConvertProbePtr(std::move(input->block_device_result)), std::move(system_result_output.first), @@ -365,59 +371,59 @@ health::mojom::TelemetryInfoPtr UncheckedConvertPtr( } // namespace unchecked -health::mojom::ErrorType Convert(cros_healthd::mojom::ErrorType input) { +crosapi::mojom::ProbeErrorType Convert(cros_healthd::mojom::ErrorType input) { switch (input) { case cros_healthd::mojom::ErrorType::kUnknown: - return health::mojom::ErrorType::kUnknown; + return crosapi::mojom::ProbeErrorType::kUnknown; case cros_healthd::mojom::ErrorType::kFileReadError: - return health::mojom::ErrorType::kFileReadError; + return crosapi::mojom::ProbeErrorType::kFileReadError; case cros_healthd::mojom::ErrorType::kParseError: - return health::mojom::ErrorType::kParseError; + return crosapi::mojom::ProbeErrorType::kParseError; case cros_healthd::mojom::ErrorType::kSystemUtilityError: - return health::mojom::ErrorType::kSystemUtilityError; + return crosapi::mojom::ProbeErrorType::kSystemUtilityError; case cros_healthd::mojom::ErrorType::kServiceUnavailable: - return health::mojom::ErrorType::kServiceUnavailable; + return crosapi::mojom::ProbeErrorType::kServiceUnavailable; } NOTREACHED(); } -health::mojom::CpuArchitectureEnum Convert( +crosapi::mojom::ProbeCpuArchitectureEnum Convert( cros_healthd::mojom::CpuArchitectureEnum input) { switch (input) { case cros_healthd::mojom::CpuArchitectureEnum::kUnknown: - return health::mojom::CpuArchitectureEnum::kUnknown; + return crosapi::mojom::ProbeCpuArchitectureEnum::kUnknown; case cros_healthd::mojom::CpuArchitectureEnum::kX86_64: - return health::mojom::CpuArchitectureEnum::kX86_64; + return crosapi::mojom::ProbeCpuArchitectureEnum::kX86_64; case cros_healthd::mojom::CpuArchitectureEnum::kAArch64: - return health::mojom::CpuArchitectureEnum::kAArch64; + return crosapi::mojom::ProbeCpuArchitectureEnum::kAArch64; case cros_healthd::mojom::CpuArchitectureEnum::kArmv7l: - return health::mojom::CpuArchitectureEnum::kArmv7l; + return crosapi::mojom::ProbeCpuArchitectureEnum::kArmv7l; } NOTREACHED(); } -health::mojom::BoolValuePtr Convert(bool input) { - return health::mojom::BoolValue::New(input); +crosapi::mojom::BoolValuePtr Convert(bool input) { + return crosapi::mojom::BoolValue::New(input); } -health::mojom::DoubleValuePtr Convert(double input) { - return health::mojom::DoubleValue::New(input); +crosapi::mojom::DoubleValuePtr Convert(double input) { + return crosapi::mojom::DoubleValue::New(input); } -health::mojom::Int64ValuePtr Convert(int64_t input) { - return health::mojom::Int64Value::New(input); +crosapi::mojom::Int64ValuePtr Convert(int64_t input) { + return crosapi::mojom::Int64Value::New(input); } -health::mojom::UInt32ValuePtr Convert(uint32_t input) { - return health::mojom::UInt32Value::New(input); +crosapi::mojom::UInt32ValuePtr Convert(uint32_t input) { + return crosapi::mojom::UInt32Value::New(input); } -health::mojom::UInt64ValuePtr Convert(uint64_t input) { - return health::mojom::UInt64Value::New(input); +crosapi::mojom::UInt64ValuePtr Convert(uint64_t input) { + return crosapi::mojom::UInt64Value::New(input); } std::vector ConvertCategoryVector( - const std::vector& input) { + const std::vector& input) { std::vector output; for (const auto element : input) { output.push_back(Convert(element)); diff --git a/chrome/browser/ash/telemetry_extension/probe_service_converters.h b/chrome/browser/ash/telemetry_extension/probe_service_converters.h index 52cdd3ddd5fa0f..e8c16d83f876a2 100644 --- a/chrome/browser/ash/telemetry_extension/probe_service_converters.h +++ b/chrome/browser/ash/telemetry_extension/probe_service_converters.h @@ -11,6 +11,7 @@ #include "base/check.h" #include "chromeos/ash/services/cros_healthd/public/mojom/cros_healthd_probe.mojom-forward.h" #include "chromeos/ash/services/cros_healthd/public/mojom/nullable_primitives.mojom-forward.h" +#include "chromeos/crosapi/mojom/nullable_primitives.mojom-forward.h" #include "chromeos/crosapi/mojom/probe_service.mojom-forward.h" namespace ash { @@ -31,113 +32,115 @@ namespace unchecked { // nullptr, they should be called only via ConvertPtr wrapper that checks // whether input pointer is nullptr. -health::mojom::ProbeErrorPtr UncheckedConvertPtr( +crosapi::mojom::ProbeErrorPtr UncheckedConvertPtr( cros_healthd::mojom::ProbeErrorPtr input); -health::mojom::UInt64ValuePtr UncheckedConvertPtr( +crosapi::mojom::UInt64ValuePtr UncheckedConvertPtr( cros_healthd::mojom::NullableUint64Ptr input); -health::mojom::BatteryInfoPtr UncheckedConvertPtr( +crosapi::mojom::ProbeBatteryInfoPtr UncheckedConvertPtr( cros_healthd::mojom::BatteryInfoPtr input); -health::mojom::BatteryResultPtr UncheckedConvertPtr( +crosapi::mojom::ProbeBatteryResultPtr UncheckedConvertPtr( cros_healthd::mojom::BatteryResultPtr input); -health::mojom::NonRemovableBlockDeviceInfoPtr UncheckedConvertPtr( +crosapi::mojom::ProbeNonRemovableBlockDeviceInfoPtr UncheckedConvertPtr( cros_healthd::mojom::NonRemovableBlockDeviceInfoPtr input); -health::mojom::NonRemovableBlockDeviceResultPtr UncheckedConvertPtr( +crosapi::mojom::ProbeNonRemovableBlockDeviceResultPtr UncheckedConvertPtr( cros_healthd::mojom::NonRemovableBlockDeviceResultPtr input); -health::mojom::CachedVpdInfoPtr UncheckedConvertPtr( +crosapi::mojom::ProbeCachedVpdInfoPtr UncheckedConvertPtr( cros_healthd::mojom::VpdInfoPtr input); -health::mojom::CpuCStateInfoPtr UncheckedConvertPtr( +crosapi::mojom::ProbeCpuCStateInfoPtr UncheckedConvertPtr( cros_healthd::mojom::CpuCStateInfoPtr input); -health::mojom::LogicalCpuInfoPtr UncheckedConvertPtr( +crosapi::mojom::ProbeLogicalCpuInfoPtr UncheckedConvertPtr( cros_healthd::mojom::LogicalCpuInfoPtr input); -health::mojom::LogicalCpuInfoPtr UncheckedConvertPtr( +crosapi::mojom::ProbeLogicalCpuInfoPtr UncheckedConvertPtr( cros_healthd::mojom::LogicalCpuInfoPtr input, uint64_t user_hz); -health::mojom::PhysicalCpuInfoPtr UncheckedConvertPtr( +crosapi::mojom::ProbePhysicalCpuInfoPtr UncheckedConvertPtr( cros_healthd::mojom::PhysicalCpuInfoPtr input); -health::mojom::CpuInfoPtr UncheckedConvertPtr( +crosapi::mojom::ProbeCpuInfoPtr UncheckedConvertPtr( cros_healthd::mojom::CpuInfoPtr input); -health::mojom::CpuResultPtr UncheckedConvertPtr( +crosapi::mojom::ProbeCpuResultPtr UncheckedConvertPtr( cros_healthd::mojom::CpuResultPtr input); -health::mojom::TimezoneInfoPtr UncheckedConvertPtr( +crosapi::mojom::ProbeTimezoneInfoPtr UncheckedConvertPtr( cros_healthd::mojom::TimezoneInfoPtr input); -health::mojom::TimezoneResultPtr UncheckedConvertPtr( +crosapi::mojom::ProbeTimezoneResultPtr UncheckedConvertPtr( cros_healthd::mojom::TimezoneResultPtr input); -health::mojom::MemoryInfoPtr UncheckedConvertPtr( +crosapi::mojom::ProbeMemoryInfoPtr UncheckedConvertPtr( cros_healthd::mojom::MemoryInfoPtr input); -health::mojom::MemoryResultPtr UncheckedConvertPtr( +crosapi::mojom::ProbeMemoryResultPtr UncheckedConvertPtr( cros_healthd::mojom::MemoryResultPtr input); -health::mojom::BacklightInfoPtr UncheckedConvertPtr( +crosapi::mojom::ProbeBacklightInfoPtr UncheckedConvertPtr( cros_healthd::mojom::BacklightInfoPtr input); -health::mojom::BacklightResultPtr UncheckedConvertPtr( +crosapi::mojom::ProbeBacklightResultPtr UncheckedConvertPtr( cros_healthd::mojom::BacklightResultPtr input); -health::mojom::FanInfoPtr UncheckedConvertPtr( +crosapi::mojom::ProbeFanInfoPtr UncheckedConvertPtr( cros_healthd::mojom::FanInfoPtr input); -health::mojom::FanResultPtr UncheckedConvertPtr( +crosapi::mojom::ProbeFanResultPtr UncheckedConvertPtr( cros_healthd::mojom::FanResultPtr input); -health::mojom::StatefulPartitionInfoPtr UncheckedConvertPtr( +crosapi::mojom::ProbeStatefulPartitionInfoPtr UncheckedConvertPtr( cros_healthd::mojom::StatefulPartitionInfoPtr input); -health::mojom::StatefulPartitionResultPtr UncheckedConvertPtr( +crosapi::mojom::ProbeStatefulPartitionResultPtr UncheckedConvertPtr( cros_healthd::mojom::StatefulPartitionResultPtr input); -health::mojom::BluetoothAdapterInfoPtr UncheckedConvertPtr( +crosapi::mojom::ProbeBluetoothAdapterInfoPtr UncheckedConvertPtr( cros_healthd::mojom::BluetoothAdapterInfoPtr input); -health::mojom::BluetoothResultPtr UncheckedConvertPtr( +crosapi::mojom::ProbeBluetoothResultPtr UncheckedConvertPtr( cros_healthd::mojom::BluetoothResultPtr input); -health::mojom::SystemInfoPtr UncheckedConvertPtr( +crosapi::mojom::ProbeSystemInfoPtr UncheckedConvertPtr( cros_healthd::mojom::OsInfoPtr input); -health::mojom::OsVersionPtr UncheckedConvertPtr( +crosapi::mojom::ProbeOsVersionPtr UncheckedConvertPtr( cros_healthd::mojom::OsVersionPtr); -std::pair +std::pair UncheckedConvertPairPtr(cros_healthd::mojom::SystemInfoPtr input); -std::pair +std::pair UncheckedConvertPairPtr(cros_healthd::mojom::SystemResultPtr input); -health::mojom::TelemetryInfoPtr UncheckedConvertPtr( +crosapi::mojom::ProbeTelemetryInfoPtr UncheckedConvertPtr( cros_healthd::mojom::TelemetryInfoPtr input); } // namespace unchecked -health::mojom::ErrorType Convert(cros_healthd::mojom::ErrorType type); +crosapi::mojom::ProbeErrorType Convert(cros_healthd::mojom::ErrorType type); -health::mojom::CpuArchitectureEnum Convert( +crosapi::mojom::ProbeCpuArchitectureEnum Convert( cros_healthd::mojom::CpuArchitectureEnum input); -health::mojom::BoolValuePtr Convert(bool input); +crosapi::mojom::BoolValuePtr Convert(bool input); -health::mojom::DoubleValuePtr Convert(double input); +crosapi::mojom::DoubleValuePtr Convert(double input); -health::mojom::Int64ValuePtr Convert(int64_t input); +crosapi::mojom::Int64ValuePtr Convert(int64_t input); -health::mojom::UInt32ValuePtr Convert(uint32_t input); +crosapi::mojom::UInt32ValuePtr Convert(uint32_t input); -health::mojom::UInt64ValuePtr Convert(uint64_t input); +crosapi::mojom::UInt64ValuePtr Convert(uint64_t input); template std::vector ConvertPtrVector(std::vector input) { @@ -163,7 +166,7 @@ auto ConvertProbePairPtr(InputT input) { } std::vector ConvertCategoryVector( - const std::vector& input); + const std::vector& input); } // namespace converters } // namespace ash diff --git a/chrome/browser/ash/telemetry_extension/probe_service_converters_unittest.cc b/chrome/browser/ash/telemetry_extension/probe_service_converters_unittest.cc index 36a2c594081c39..340e5865c37fb7 100644 --- a/chrome/browser/ash/telemetry_extension/probe_service_converters_unittest.cc +++ b/chrome/browser/ash/telemetry_extension/probe_service_converters_unittest.cc @@ -28,8 +28,8 @@ namespace cros_healthd = ::ash::cros_healthd; // Note: in some tests we intentionally use New() with no arguments for // cros_healthd::mojom types, because there can be some fields that we don't // test yet. -// Also, we intentionally use New() with arguments for health::mojom types to -// let the compiler detect untested data members. +// Also, we intentionally use New() with arguments for crosapi::mojom +// types to let the compiler detect untested data members. // Tests that |ConvertProbePtr| function returns nullptr if input is nullptr. // ConvertProbePtr is a template, so we can test this function with any valid @@ -39,19 +39,19 @@ TEST(ProbeServiceConverters, ConvertProbePtrTakesNullPtr) { } TEST(ProbeServiceConverters, ConvertCategoryVector) { - const std::vector kInput{ - health::mojom::ProbeCategoryEnum::kUnknown, - health::mojom::ProbeCategoryEnum::kBattery, - health::mojom::ProbeCategoryEnum::kNonRemovableBlockDevices, - health::mojom::ProbeCategoryEnum::kCachedVpdData, - health::mojom::ProbeCategoryEnum::kCpu, - health::mojom::ProbeCategoryEnum::kTimezone, - health::mojom::ProbeCategoryEnum::kMemory, - health::mojom::ProbeCategoryEnum::kBacklight, - health::mojom::ProbeCategoryEnum::kFan, - health::mojom::ProbeCategoryEnum::kStatefulPartition, - health::mojom::ProbeCategoryEnum::kBluetooth, - health::mojom::ProbeCategoryEnum::kSystem}; + const std::vector kInput{ + crosapi::mojom::ProbeCategoryEnum::kUnknown, + crosapi::mojom::ProbeCategoryEnum::kBattery, + crosapi::mojom::ProbeCategoryEnum::kNonRemovableBlockDevices, + crosapi::mojom::ProbeCategoryEnum::kCachedVpdData, + crosapi::mojom::ProbeCategoryEnum::kCpu, + crosapi::mojom::ProbeCategoryEnum::kTimezone, + crosapi::mojom::ProbeCategoryEnum::kMemory, + crosapi::mojom::ProbeCategoryEnum::kBacklight, + crosapi::mojom::ProbeCategoryEnum::kFan, + crosapi::mojom::ProbeCategoryEnum::kStatefulPartition, + crosapi::mojom::ProbeCategoryEnum::kBluetooth, + crosapi::mojom::ProbeCategoryEnum::kSystem}; EXPECT_THAT( ConvertCategoryVector(kInput), ElementsAre( @@ -71,53 +71,53 @@ TEST(ProbeServiceConverters, ConvertCategoryVector) { TEST(ProbeServiceConverters, ErrorType) { EXPECT_EQ(Convert(cros_healthd::mojom::ErrorType::kUnknown), - health::mojom::ErrorType::kUnknown); + crosapi::mojom::ProbeErrorType::kUnknown); EXPECT_EQ(Convert(cros_healthd::mojom::ErrorType::kFileReadError), - health::mojom::ErrorType::kFileReadError); + crosapi::mojom::ProbeErrorType::kFileReadError); EXPECT_EQ(Convert(cros_healthd::mojom::ErrorType::kParseError), - health::mojom::ErrorType::kParseError); + crosapi::mojom::ProbeErrorType::kParseError); EXPECT_EQ(Convert(cros_healthd::mojom::ErrorType::kSystemUtilityError), - health::mojom::ErrorType::kSystemUtilityError); + crosapi::mojom::ProbeErrorType::kSystemUtilityError); EXPECT_EQ(Convert(cros_healthd::mojom::ErrorType::kServiceUnavailable), - health::mojom::ErrorType::kServiceUnavailable); + crosapi::mojom::ProbeErrorType::kServiceUnavailable); } TEST(ProbeServiceConverters, ProbeErrorPtr) { constexpr char kMsg[] = "file not found"; EXPECT_EQ(ConvertProbePtr(cros_healthd::mojom::ProbeError::New( cros_healthd::mojom::ErrorType::kFileReadError, kMsg)), - health::mojom::ProbeError::New( - health::mojom::ErrorType::kFileReadError, kMsg)); + crosapi::mojom::ProbeError::New( + crosapi::mojom::ProbeErrorType::kFileReadError, kMsg)); } TEST(ProbeServiceConverters, BoolValue) { - EXPECT_EQ(Convert(false), health::mojom::BoolValue::New(false)); - EXPECT_EQ(Convert(true), health::mojom::BoolValue::New(true)); + EXPECT_EQ(Convert(false), crosapi::mojom::BoolValue::New(false)); + EXPECT_EQ(Convert(true), crosapi::mojom::BoolValue::New(true)); } TEST(ProbeServiceConverters, DoubleValue) { constexpr double kValue = 100500111111.500100; - EXPECT_EQ(Convert(kValue), health::mojom::DoubleValue::New(kValue)); + EXPECT_EQ(Convert(kValue), crosapi::mojom::DoubleValue::New(kValue)); } TEST(ProbeServiceConverters, Int64Value) { constexpr int64_t kValue = -(1LL << 62) + 1000; - EXPECT_EQ(Convert(kValue), health::mojom::Int64Value::New(kValue)); + EXPECT_EQ(Convert(kValue), crosapi::mojom::Int64Value::New(kValue)); } TEST(ProbeServiceConverters, UInt64Value) { constexpr uint64_t kValue = (1ULL << 63) + 1000000000; - EXPECT_EQ(Convert(kValue), health::mojom::UInt64Value::New(kValue)); + EXPECT_EQ(Convert(kValue), crosapi::mojom::UInt64Value::New(kValue)); } TEST(ProbeServiceConverters, UInt64ValuePtr) { constexpr uint64_t kValue = (1ULL << 63) + 3000000000; EXPECT_EQ(ConvertProbePtr(cros_healthd::mojom::NullableUint64::New(kValue)), - health::mojom::UInt64Value::New(kValue)); + crosapi::mojom::UInt64Value::New(kValue)); } TEST(ProbeServiceConverters, BatteryInfoPtr) { @@ -156,15 +156,15 @@ TEST(ProbeServiceConverters, BatteryInfoPtr) { EXPECT_EQ( ConvertProbePtr(std::move(input)), - health::mojom::BatteryInfo::New( - health::mojom::Int64Value::New(kCycleCount), - health::mojom::DoubleValue::New(kVoltageNow), kVendor, kSerialNumber, - health::mojom::DoubleValue::New(kChargeFullDesign), - health::mojom::DoubleValue::New(kChargeFull), - health::mojom::DoubleValue::New(kVoltageMinDesign), kModelName, - health::mojom::DoubleValue::New(kChargeNow), - health::mojom::DoubleValue::New(kCurrentNow), kTechnology, kStatus, - kManufactureDate, health::mojom::UInt64Value::New(kTemperature))); + crosapi::mojom::ProbeBatteryInfo::New( + crosapi::mojom::Int64Value::New(kCycleCount), + crosapi::mojom::DoubleValue::New(kVoltageNow), kVendor, kSerialNumber, + crosapi::mojom::DoubleValue::New(kChargeFullDesign), + crosapi::mojom::DoubleValue::New(kChargeFull), + crosapi::mojom::DoubleValue::New(kVoltageMinDesign), kModelName, + crosapi::mojom::DoubleValue::New(kChargeNow), + crosapi::mojom::DoubleValue::New(kCurrentNow), kTechnology, kStatus, + kManufactureDate, crosapi::mojom::UInt64Value::New(kTemperature))); } TEST(ProbeServiceConverters, BatteryResultPtrInfo) { @@ -216,16 +216,16 @@ TEST(ProbeServiceConverters, NonRemovableBlockDeviceInfoPtr) { EXPECT_EQ( ConvertProbePtr(std::move(input)), - health::mojom::NonRemovableBlockDeviceInfo::New( - kPath, health::mojom::UInt64Value::New(kSize), kType, - health::mojom::UInt32Value::New(kManufacturerId), kName, + crosapi::mojom::ProbeNonRemovableBlockDeviceInfo::New( + kPath, crosapi::mojom::UInt64Value::New(kSize), kType, + crosapi::mojom::UInt32Value::New(kManufacturerId), kName, kSerialString, - health::mojom::UInt64Value::New(kBytesReadSinceLastBoot), - health::mojom::UInt64Value::New(kBytesWrittenSinceLastBoot), - health::mojom::UInt64Value::New(kReadTimeSecondsSinceLastBoot), - health::mojom::UInt64Value::New(kWriteTimeSecondsSinceLastBoot), - health::mojom::UInt64Value::New(kIoTimeSecondsSinceLastBoot), - health::mojom::UInt64Value::New(kDiscardTimeSecondsSinceLastBoot))); + crosapi::mojom::UInt64Value::New(kBytesReadSinceLastBoot), + crosapi::mojom::UInt64Value::New(kBytesWrittenSinceLastBoot), + crosapi::mojom::UInt64Value::New(kReadTimeSecondsSinceLastBoot), + crosapi::mojom::UInt64Value::New(kWriteTimeSecondsSinceLastBoot), + crosapi::mojom::UInt64Value::New(kIoTimeSecondsSinceLastBoot), + crosapi::mojom::UInt64Value::New(kDiscardTimeSecondsSinceLastBoot))); } TEST(ProbeServiceConverters, NonRemovableBlockDeviceResultPtrInfo) { @@ -255,7 +255,7 @@ TEST(ProbeServiceConverters, NonRemovableBlockDeviceResultPtrInfo) { } TEST(ProbeServiceConverters, NonRemovableBlockDeviceResultPtrError) { - const health::mojom::NonRemovableBlockDeviceResultPtr output = + const crosapi::mojom::ProbeNonRemovableBlockDeviceResultPtr output = ConvertProbePtr( cros_healthd::mojom::NonRemovableBlockDeviceResult::NewError( nullptr)); @@ -276,8 +276,8 @@ TEST(ProbeServiceConverters, CachedVpdInfoPtr) { input->model_name = kModelName; EXPECT_EQ(ConvertProbePtr(std::move(input)), - health::mojom::CachedVpdInfo::New(kFirstPowerDate, kSkuNumber, - kSerialNumber, kModelName)); + crosapi::mojom::ProbeCachedVpdInfo::New(kFirstPowerDate, kSkuNumber, + kSerialNumber, kModelName)); } TEST(ProbeServiceConverters, CpuCStateInfoPtr) { @@ -290,10 +290,10 @@ TEST(ProbeServiceConverters, CpuCStateInfoPtr) { input->time_in_state_since_last_boot_us = kTimeInStateSinceLastBootUs; } - EXPECT_EQ( - ConvertProbePtr(std::move(input)), - health::mojom::CpuCStateInfo::New( - kName, health::mojom::UInt64Value::New(kTimeInStateSinceLastBootUs))); + EXPECT_EQ(ConvertProbePtr(std::move(input)), + crosapi::mojom::ProbeCpuCStateInfo::New( + kName, + crosapi::mojom::UInt64Value::New(kTimeInStateSinceLastBootUs))); } TEST(ProbeServiceConverters, LogicalCpuInfoPtr) { @@ -321,16 +321,16 @@ TEST(ProbeServiceConverters, LogicalCpuInfoPtr) { input->c_states.push_back(std::move(c_state)); } - std::vector expected_c_states; - expected_c_states.push_back(health::mojom::CpuCStateInfo::New( - kCpuCStateName, health::mojom::UInt64Value::New(kCpuCStateTime))); + std::vector expected_c_states; + expected_c_states.push_back(crosapi::mojom::ProbeCpuCStateInfo::New( + kCpuCStateName, crosapi::mojom::UInt64Value::New(kCpuCStateTime))); EXPECT_EQ(ConvertProbePtr(std::move(input)), - health::mojom::LogicalCpuInfo::New( - health::mojom::UInt32Value::New(kMaxClockSpeedKhz), - health::mojom::UInt32Value::New(kScalingMaxFrequencyKhz), - health::mojom::UInt32Value::New(kScalingCurrentFrequencyKhz), - health::mojom::UInt64Value::New(kIdleTime), + crosapi::mojom::ProbeLogicalCpuInfo::New( + crosapi::mojom::UInt32Value::New(kMaxClockSpeedKhz), + crosapi::mojom::UInt32Value::New(kScalingMaxFrequencyKhz), + crosapi::mojom::UInt32Value::New(kScalingCurrentFrequencyKhz), + crosapi::mojom::UInt64Value::New(kIdleTime), std::move(expected_c_states))); } @@ -344,7 +344,8 @@ TEST(ProbeServiceConverters, LogicalCpuInfoPtrNonZeroIdleTime) { const auto output = unchecked::UncheckedConvertPtr(std::move(input), kUserHz); ASSERT_TRUE(output); - EXPECT_EQ(output->idle_time_ms, health::mojom::UInt64Value::New(kIdleTimeMs)); + EXPECT_EQ(output->idle_time_ms, + crosapi::mojom::UInt64Value::New(kIdleTimeMs)); } TEST(ProbeServiceConverters, PhysicalCpuInfoPtr) { @@ -370,28 +371,28 @@ TEST(ProbeServiceConverters, PhysicalCpuInfoPtr) { input->logical_cpus.push_back(std::move(logical_info)); } - std::vector expected_infos; - expected_infos.push_back(health::mojom::LogicalCpuInfo::New( - health::mojom::UInt32Value::New(kMaxClockSpeedKhz), - health::mojom::UInt32Value::New(kScalingMaxFrequencyKhz), - health::mojom::UInt32Value::New(kScalingCurrentFrequencyKhz), - health::mojom::UInt64Value::New(kIdleTime), - std::vector{})); + std::vector expected_infos; + expected_infos.push_back(crosapi::mojom::ProbeLogicalCpuInfo::New( + crosapi::mojom::UInt32Value::New(kMaxClockSpeedKhz), + crosapi::mojom::UInt32Value::New(kScalingMaxFrequencyKhz), + crosapi::mojom::UInt32Value::New(kScalingCurrentFrequencyKhz), + crosapi::mojom::UInt64Value::New(kIdleTime), + std::vector{})); EXPECT_EQ(ConvertProbePtr(std::move(input)), - health::mojom::PhysicalCpuInfo::New(kModelName, - std::move(expected_infos))); + crosapi::mojom::ProbePhysicalCpuInfo::New( + kModelName, std::move(expected_infos))); } TEST(ProbeServiceConverters, CpuArchitectureEnum) { EXPECT_EQ(Convert(cros_healthd::mojom::CpuArchitectureEnum::kUnknown), - health::mojom::CpuArchitectureEnum::kUnknown); + crosapi::mojom::ProbeCpuArchitectureEnum::kUnknown); EXPECT_EQ(Convert(cros_healthd::mojom::CpuArchitectureEnum::kX86_64), - health::mojom::CpuArchitectureEnum::kX86_64); + crosapi::mojom::ProbeCpuArchitectureEnum::kX86_64); EXPECT_EQ(Convert(cros_healthd::mojom::CpuArchitectureEnum::kAArch64), - health::mojom::CpuArchitectureEnum::kAArch64); + crosapi::mojom::ProbeCpuArchitectureEnum::kAArch64); EXPECT_EQ(Convert(cros_healthd::mojom::CpuArchitectureEnum::kArmv7l), - health::mojom::CpuArchitectureEnum::kArmv7l); + crosapi::mojom::ProbeCpuArchitectureEnum::kArmv7l); } TEST(ProbeServiceConverters, CpuInfoPtr) { @@ -408,14 +409,14 @@ TEST(ProbeServiceConverters, CpuInfoPtr) { input->physical_cpus.push_back(std::move(physical_info)); } - std::vector expected_infos; - expected_infos.push_back(health::mojom::PhysicalCpuInfo::New( - kModelName, std::vector{})); + std::vector expected_infos; + expected_infos.push_back(crosapi::mojom::ProbePhysicalCpuInfo::New( + kModelName, std::vector{})); EXPECT_EQ(ConvertProbePtr(std::move(input)), - health::mojom::CpuInfo::New( - health::mojom::UInt32Value::New(kNumTotalThreads), - health::mojom::CpuArchitectureEnum::kArmv7l, + crosapi::mojom::ProbeCpuInfo::New( + crosapi::mojom::UInt32Value::New(kNumTotalThreads), + crosapi::mojom::ProbeCpuArchitectureEnum::kArmv7l, std::move(expected_infos))); } @@ -442,7 +443,7 @@ TEST(ProbeServiceConverters, TimezoneInfoPtr) { input->region = kRegion; EXPECT_EQ(ConvertProbePtr(std::move(input)), - health::mojom::TimezoneInfo::New(kPosix, kRegion)); + crosapi::mojom::ProbeTimezoneInfo::New(kPosix, kRegion)); } TEST(ProbeServiceConverters, TimezoneResultPtrInfo) { @@ -472,22 +473,22 @@ TEST(ProbeServiceConverters, MemoryInfoPtr) { input->page_faults_since_last_boot = kPageFaultsSinceLastBoot; EXPECT_EQ(ConvertProbePtr(std::move(input)), - health::mojom::MemoryInfo::New( - health::mojom::UInt32Value::New(kTotalMemoryKib), - health::mojom::UInt32Value::New(kFreeMemoryKib), - health::mojom::UInt32Value::New(kAvailableMemoryKib), - health::mojom::UInt64Value::New(kPageFaultsSinceLastBoot))); + crosapi::mojom::ProbeMemoryInfo::New( + crosapi::mojom::UInt32Value::New(kTotalMemoryKib), + crosapi::mojom::UInt32Value::New(kFreeMemoryKib), + crosapi::mojom::UInt32Value::New(kAvailableMemoryKib), + crosapi::mojom::UInt64Value::New(kPageFaultsSinceLastBoot))); } TEST(ProbeServiceConverters, MemoryResultPtrInfo) { - const health::mojom::MemoryResultPtr output = ConvertProbePtr( + const crosapi::mojom::ProbeMemoryResultPtr output = ConvertProbePtr( cros_healthd::mojom::MemoryResult::NewMemoryInfo(nullptr)); ASSERT_TRUE(output); EXPECT_TRUE(output->is_memory_info()); } TEST(ProbeServiceConverters, MemoryResultPtrError) { - const health::mojom::MemoryResultPtr output = + const crosapi::mojom::ProbeMemoryResultPtr output = ConvertProbePtr(cros_healthd::mojom::MemoryResult::NewError(nullptr)); ASSERT_TRUE(output); EXPECT_TRUE(output->is_error()); @@ -504,9 +505,9 @@ TEST(ProbeServiceConverters, BacklightInfoPtr) { input->brightness = kBrightness; EXPECT_EQ(ConvertProbePtr(std::move(input)), - health::mojom::BacklightInfo::New( - kPath, health::mojom::UInt32Value::New(kMaxBrightness), - health::mojom::UInt32Value::New(kBrightness))); + crosapi::mojom::ProbeBacklightInfo::New( + kPath, crosapi::mojom::UInt32Value::New(kMaxBrightness), + crosapi::mojom::UInt32Value::New(kBrightness))); } TEST(ProbeServiceConverters, BacklightResultPtrInfo) { @@ -549,7 +550,7 @@ TEST(ProbeServiceConverters, FanInfoPtr) { const auto output = ConvertProbePtr(std::move(input)); ASSERT_TRUE(output); - EXPECT_EQ(output->speed_rpm, health::mojom::UInt32Value::New(kSpeedRpm)); + EXPECT_EQ(output->speed_rpm, crosapi::mojom::UInt32Value::New(kSpeedRpm)); } TEST(ProbeServiceConverters, FanResultPtrInfo) { @@ -566,12 +567,13 @@ TEST(ProbeServiceConverters, FanResultPtrInfo) { input = cros_healthd::mojom::FanResult::NewFanInfo(std::move(fan_infos)); } - std::vector expected_fans; - expected_fans.push_back( - health::mojom::FanInfo::New(health::mojom::UInt32Value::New(kSpeedRpm))); + std::vector expected_fans; + expected_fans.push_back(crosapi::mojom::ProbeFanInfo::New( + crosapi::mojom::UInt32Value::New(kSpeedRpm))); - EXPECT_EQ(ConvertProbePtr(std::move(input)), - health::mojom::FanResult::NewFanInfo(std::move(expected_fans))); + EXPECT_EQ( + ConvertProbePtr(std::move(input)), + crosapi::mojom::ProbeFanResult::NewFanInfo(std::move(expected_fans))); } TEST(ProbeServiceConverters, FanResultPtrError) { @@ -592,9 +594,9 @@ TEST(ProbeServiceConverters, StatefulPartitionInfoPtr) { input->total_space = kTotalSpace; EXPECT_EQ(ConvertProbePtr(std::move(input)), - health::mojom::StatefulPartitionInfo::New( - health::mojom::UInt64Value::New(kRoundedAvailableSpace), - health::mojom::UInt64Value::New(kTotalSpace))); + crosapi::mojom::ProbeStatefulPartitionInfo::New( + crosapi::mojom::UInt64Value::New(kRoundedAvailableSpace), + crosapi::mojom::UInt64Value::New(kTotalSpace))); } TEST(ProbeServiceConverters, StatefulPartitionResultPtrInfo) { @@ -626,9 +628,9 @@ TEST(ProbeServiceConverters, BluetoothAdapterInfoPtr) { } EXPECT_EQ(ConvertProbePtr(std::move(input)), - health::mojom::BluetoothAdapterInfo::New( - kName, kAddress, health::mojom::BoolValue::New(kPowered), - health::mojom::UInt32Value::New(kNumConnectedDevices))); + crosapi::mojom::ProbeBluetoothAdapterInfo::New( + kName, kAddress, crosapi::mojom::BoolValue::New(kPowered), + crosapi::mojom::UInt32Value::New(kNumConnectedDevices))); } TEST(ProbeServiceConverters, BluetoothResultPtrInfo) { @@ -677,10 +679,11 @@ TEST(ProbeServiceConverters, SystemInfoPtr) { input->oem_name = kOemName; input->os_version = std::move(os_version); - EXPECT_EQ(ConvertProbePtr(std::move(input)), - health::mojom::SystemInfo::New(health::mojom::OsInfo::New( - kOemName, - health::mojom::OsVersion::New(kReleaseMilestone, kBuildNumber, + EXPECT_EQ( + ConvertProbePtr(std::move(input)), + crosapi::mojom::ProbeSystemInfo::New(crosapi::mojom::ProbeOsInfo::New( + kOemName, + crosapi::mojom::ProbeOsVersion::New(kReleaseMilestone, kBuildNumber, kPatchNumber, kReleaseChannel)))); } @@ -694,8 +697,8 @@ TEST(ProbeServiceConverters, OsVersionPtr) { kReleaseMilestone, kBuildNumber, kPatchNumber, kReleaseChannel); EXPECT_EQ(ConvertProbePtr(std::move(input)), - health::mojom::OsVersion::New(kReleaseMilestone, kBuildNumber, - kPatchNumber, kReleaseChannel)); + crosapi::mojom::ProbeOsVersion::New(kReleaseMilestone, kBuildNumber, + kPatchNumber, kReleaseChannel)); } TEST(ProbeServiceConverters, PairCachedVpdInfoPtrSystemInfoPtr) { @@ -725,14 +728,15 @@ TEST(ProbeServiceConverters, PairCachedVpdInfoPtrSystemInfoPtr) { input->os_info = std::move(os_info); input->vpd_info = std::move(vpd_info); } - EXPECT_EQ(ConvertProbePairPtr(std::move(input)), - std::make_pair( - health::mojom::CachedVpdInfo::New(kFirstPowerDate, kSkuNumber, + EXPECT_EQ( + ConvertProbePairPtr(std::move(input)), + std::make_pair( + crosapi::mojom::ProbeCachedVpdInfo::New(kFirstPowerDate, kSkuNumber, kSerialNumber, kModelName), - health::mojom::SystemInfo::New(health::mojom::OsInfo::New( - kOemName, health::mojom::OsVersion::New( - kReleaseMilestone, kBuildNumber, kPatchNumber, - kReleaseChannel))))); + crosapi::mojom::ProbeSystemInfo::New(crosapi::mojom::ProbeOsInfo::New( + kOemName, crosapi::mojom::ProbeOsVersion::New( + kReleaseMilestone, kBuildNumber, kPatchNumber, + kReleaseChannel))))); } TEST(ProbeServiceConverters, PairCachedVpdResultPtrSystemResultPtrInfo) { @@ -814,57 +818,60 @@ TEST(ProbeServiceConverters, TelemetryInfoPtrWithNotNullFields) { EXPECT_EQ( ConvertProbePtr(std::move(input)), - health::mojom::TelemetryInfo::New( - health::mojom::BatteryResult::NewBatteryInfo( - health::mojom::BatteryInfo::New( - health::mojom::Int64Value::New(0), - health::mojom::DoubleValue::New(0.), "", "", - health::mojom::DoubleValue::New(0.), - health::mojom::DoubleValue::New(0.), - health::mojom::DoubleValue::New(0.), "", - health::mojom::DoubleValue::New(0.), - health::mojom::DoubleValue::New(0.), "", "", absl::nullopt, + crosapi::mojom::ProbeTelemetryInfo::New( + crosapi::mojom::ProbeBatteryResult::NewBatteryInfo( + crosapi::mojom::ProbeBatteryInfo::New( + crosapi::mojom::Int64Value::New(0), + crosapi::mojom::DoubleValue::New(0.), "", "", + crosapi::mojom::DoubleValue::New(0.), + crosapi::mojom::DoubleValue::New(0.), + crosapi::mojom::DoubleValue::New(0.), "", + crosapi::mojom::DoubleValue::New(0.), + crosapi::mojom::DoubleValue::New(0.), "", "", absl::nullopt, nullptr)), - health::mojom::NonRemovableBlockDeviceResult::NewBlockDeviceInfo({}), - health::mojom::CachedVpdResult::NewVpdInfo( - health::mojom::CachedVpdInfo::New()), - health::mojom::CpuResult::NewCpuInfo(health::mojom::CpuInfo::New( - health::mojom::UInt32Value::New(0), - health::mojom::CpuArchitectureEnum::kUnknown, - std::vector())), - health::mojom::TimezoneResult::NewTimezoneInfo( - health::mojom::TimezoneInfo::New("", "")), - health::mojom::MemoryResult::NewMemoryInfo( - health::mojom::MemoryInfo::New( - health::mojom::UInt32Value::New(0), - health::mojom::UInt32Value::New(0), - health::mojom::UInt32Value::New(0), - health::mojom::UInt64Value::New(0))), - health::mojom::BacklightResult::NewBacklightInfo({}), - health::mojom::FanResult::NewFanInfo({}), - health::mojom::StatefulPartitionResult::NewPartitionInfo( - health::mojom::StatefulPartitionInfo::New( - health::mojom::UInt64Value::New(0), - health::mojom::UInt64Value::New(0))), - health::mojom::BluetoothResult::NewBluetoothAdapterInfo({}), - health::mojom::SystemResult::NewSystemInfo( - health::mojom::SystemInfo::New(health::mojom::OsInfo::New())))); + crosapi::mojom::ProbeNonRemovableBlockDeviceResult:: + NewBlockDeviceInfo({}), + crosapi::mojom::ProbeCachedVpdResult::NewVpdInfo( + crosapi::mojom::ProbeCachedVpdInfo::New()), + crosapi::mojom::ProbeCpuResult::NewCpuInfo( + crosapi::mojom::ProbeCpuInfo::New( + crosapi::mojom::UInt32Value::New(0), + crosapi::mojom::ProbeCpuArchitectureEnum::kUnknown, + std::vector())), + crosapi::mojom::ProbeTimezoneResult::NewTimezoneInfo( + crosapi::mojom::ProbeTimezoneInfo::New("", "")), + crosapi::mojom::ProbeMemoryResult::NewMemoryInfo( + crosapi::mojom::ProbeMemoryInfo::New( + crosapi::mojom::UInt32Value::New(0), + crosapi::mojom::UInt32Value::New(0), + crosapi::mojom::UInt32Value::New(0), + crosapi::mojom::UInt64Value::New(0))), + crosapi::mojom::ProbeBacklightResult::NewBacklightInfo({}), + crosapi::mojom::ProbeFanResult::NewFanInfo({}), + crosapi::mojom::ProbeStatefulPartitionResult::NewPartitionInfo( + crosapi::mojom::ProbeStatefulPartitionInfo::New( + crosapi::mojom::UInt64Value::New(0), + crosapi::mojom::UInt64Value::New(0))), + crosapi::mojom::ProbeBluetoothResult::NewBluetoothAdapterInfo({}), + crosapi::mojom::ProbeSystemResult::NewSystemInfo( + crosapi::mojom::ProbeSystemInfo::New( + crosapi::mojom::ProbeOsInfo::New())))); } TEST(ProbeServiceConverters, TelemetryInfoPtrWithNullFields) { EXPECT_EQ(ConvertProbePtr(cros_healthd::mojom::TelemetryInfo::New()), - health::mojom::TelemetryInfo::New( - health::mojom::BatteryResultPtr(nullptr), - health::mojom::NonRemovableBlockDeviceResultPtr(nullptr), - health::mojom::CachedVpdResultPtr(nullptr), - health::mojom::CpuResultPtr(nullptr), - health::mojom::TimezoneResultPtr(nullptr), - health::mojom::MemoryResultPtr(nullptr), - health::mojom::BacklightResultPtr(nullptr), - health::mojom::FanResultPtr(nullptr), - health::mojom::StatefulPartitionResultPtr(nullptr), - health::mojom::BluetoothResultPtr(nullptr), - health::mojom::SystemResultPtr(nullptr))); + crosapi::mojom::ProbeTelemetryInfo::New( + crosapi::mojom::ProbeBatteryResultPtr(nullptr), + crosapi::mojom::ProbeNonRemovableBlockDeviceResultPtr(nullptr), + crosapi::mojom::ProbeCachedVpdResultPtr(nullptr), + crosapi::mojom::ProbeCpuResultPtr(nullptr), + crosapi::mojom::ProbeTimezoneResultPtr(nullptr), + crosapi::mojom::ProbeMemoryResultPtr(nullptr), + crosapi::mojom::ProbeBacklightResultPtr(nullptr), + crosapi::mojom::ProbeFanResultPtr(nullptr), + crosapi::mojom::ProbeStatefulPartitionResultPtr(nullptr), + crosapi::mojom::ProbeBluetoothResultPtr(nullptr), + crosapi::mojom::ProbeSystemResultPtr(nullptr))); } } // namespace converters diff --git a/chrome/browser/ash/telemetry_extension/probe_service_unittest.cc b/chrome/browser/ash/telemetry_extension/probe_service_unittest.cc index 9547a5f38b03fe..8b01c09d3c4e54 100644 --- a/chrome/browser/ash/telemetry_extension/probe_service_unittest.cc +++ b/chrome/browser/ash/telemetry_extension/probe_service_unittest.cc @@ -33,15 +33,15 @@ class ProbeServiceTest : public testing::Test { DebugDaemonClient::Shutdown(); } - health::mojom::ProbeServiceProxy* probe_service() const { + crosapi::mojom::ProbeServiceProxy* probe_service() const { return remote_probe_service_.get(); } private: base::test::TaskEnvironment task_environment_; - mojo::Remote remote_probe_service_; - std::unique_ptr probe_service_{ + mojo::Remote remote_probe_service_; + std::unique_ptr probe_service_{ ProbeService::Factory::Create( remote_probe_service_.BindNewPipeAndPassReceiver())}; }; @@ -65,18 +65,20 @@ TEST_F(ProbeServiceTest, ProbeTelemetryInfoSuccess) { base::RunLoop run_loop; probe_service()->ProbeTelemetryInfo( - {health::mojom::ProbeCategoryEnum::kBattery}, - base::BindLambdaForTesting([&](health::mojom::TelemetryInfoPtr ptr) { - ASSERT_TRUE(ptr); - ASSERT_TRUE(ptr->battery_result); - ASSERT_TRUE(ptr->battery_result->is_battery_info()); - ASSERT_TRUE(ptr->battery_result->get_battery_info()); - ASSERT_TRUE(ptr->battery_result->get_battery_info()->cycle_count); - EXPECT_EQ(ptr->battery_result->get_battery_info()->cycle_count->value, - kCycleCount); - - run_loop.Quit(); - })); + {crosapi::mojom::ProbeCategoryEnum::kBattery}, + base::BindLambdaForTesting( + [&](crosapi::mojom::ProbeTelemetryInfoPtr ptr) { + ASSERT_TRUE(ptr); + ASSERT_TRUE(ptr->battery_result); + ASSERT_TRUE(ptr->battery_result->is_battery_info()); + ASSERT_TRUE(ptr->battery_result->get_battery_info()); + ASSERT_TRUE(ptr->battery_result->get_battery_info()->cycle_count); + EXPECT_EQ( + ptr->battery_result->get_battery_info()->cycle_count->value, + kCycleCount); + + run_loop.Quit(); + })); run_loop.Run(); } @@ -85,7 +87,7 @@ TEST_F(ProbeServiceTest, ProbeTelemetryInfoSuccess) { TEST_F(ProbeServiceTest, GetOemDataSuccess) { base::RunLoop run_loop; probe_service()->GetOemData( - base::BindLambdaForTesting([&](health::mojom::OemDataPtr ptr) { + base::BindLambdaForTesting([&](crosapi::mojom::ProbeOemDataPtr ptr) { ASSERT_TRUE(ptr); ASSERT_TRUE(ptr->oem_data.has_value()); EXPECT_EQ(ptr->oem_data.value(), "oemdata: response from GetLog"); diff --git a/chrome/browser/chromeos/extensions/telemetry/api/hardware_info_delegate.cc b/chrome/browser/chromeos/extensions/telemetry/api/hardware_info_delegate.cc index 63b0c316e72cf9..9d82d1370ff738 100644 --- a/chrome/browser/chromeos/extensions/telemetry/api/hardware_info_delegate.cc +++ b/chrome/browser/chromeos/extensions/telemetry/api/hardware_info_delegate.cc @@ -49,7 +49,7 @@ void GetManufacturerFromSysfs(base::OnceCallback callback) { } // Callback from ProbeTelemetryService::ProbeTelemetryInfo(). -std::string OnGetSystemInfo(ash::health::mojom::TelemetryInfoPtr ptr) { +std::string OnGetSystemInfo(crosapi::mojom::ProbeTelemetryInfoPtr ptr) { if (!ptr || !ptr->system_result || !ptr->system_result->is_system_info()) { return ""; } @@ -87,7 +87,7 @@ HardwareInfoDelegate::HardwareInfoDelegate() : remote_probe_service_strategy_(RemoteProbeServiceStrategy::Create()) {} HardwareInfoDelegate::~HardwareInfoDelegate() = default; -mojo::Remote& +mojo::Remote& HardwareInfoDelegate::GetRemoteService() { return remote_probe_service_strategy_->GetRemoteService(); } @@ -103,7 +103,7 @@ void HardwareInfoDelegate::GetManufacturer(ManufacturerCallback done_cb) { base::Unretained(this), std::move(done_cb)); auto cb = base::BindOnce(&OnGetSystemInfo).Then(std::move(fallback)); GetRemoteService()->ProbeTelemetryInfo( - {ash::health::mojom::ProbeCategoryEnum::kSystem}, std::move(cb)); + {crosapi::mojom::ProbeCategoryEnum::kSystem}, std::move(cb)); } void HardwareInfoDelegate::FallbackHandler(ManufacturerCallback done_cb, diff --git a/chrome/browser/chromeos/extensions/telemetry/api/hardware_info_delegate.h b/chrome/browser/chromeos/extensions/telemetry/api/hardware_info_delegate.h index 0ca36b0e1422c0..5cc72a621214ab 100644 --- a/chrome/browser/chromeos/extensions/telemetry/api/hardware_info_delegate.h +++ b/chrome/browser/chromeos/extensions/telemetry/api/hardware_info_delegate.h @@ -48,7 +48,7 @@ class HardwareInfoDelegate { void FallbackHandler(ManufacturerCallback done_cb, std::string probe_service_result); - mojo::Remote& GetRemoteService(); + mojo::Remote& GetRemoteService(); std::unique_ptr remote_probe_service_strategy_; }; diff --git a/chrome/browser/chromeos/extensions/telemetry/api/remote_probe_service_strategy.cc b/chrome/browser/chromeos/extensions/telemetry/api/remote_probe_service_strategy.cc index d678ff79f51366..0dc62a4e04ecce 100644 --- a/chrome/browser/chromeos/extensions/telemetry/api/remote_probe_service_strategy.cc +++ b/chrome/browser/chromeos/extensions/telemetry/api/remote_probe_service_strategy.cc @@ -23,14 +23,14 @@ class RemoteProbeServiceStrategyAsh : public RemoteProbeServiceStrategy { ~RemoteProbeServiceStrategyAsh() override = default; // RemoteProbeServiceStrategy override: - mojo::Remote& GetRemoteService() override { + mojo::Remote& GetRemoteService() override { return remote_probe_service_; } private: - mojo::Remote remote_probe_service_; + mojo::Remote remote_probe_service_; - std::unique_ptr probe_service_; + std::unique_ptr probe_service_; }; } // namespace diff --git a/chrome/browser/chromeos/extensions/telemetry/api/remote_probe_service_strategy.h b/chrome/browser/chromeos/extensions/telemetry/api/remote_probe_service_strategy.h index 2fe7c1273974b3..7744bfc048b0e2 100644 --- a/chrome/browser/chromeos/extensions/telemetry/api/remote_probe_service_strategy.h +++ b/chrome/browser/chromeos/extensions/telemetry/api/remote_probe_service_strategy.h @@ -25,8 +25,7 @@ class RemoteProbeServiceStrategy { delete; virtual ~RemoteProbeServiceStrategy(); - virtual mojo::Remote& - GetRemoteService() = 0; + virtual mojo::Remote& GetRemoteService() = 0; }; } // namespace chromeos diff --git a/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api.cc b/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api.cc index d9cff8604236f3..9df3333a7e13f0 100644 --- a/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api.cc +++ b/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api.cc @@ -27,7 +27,7 @@ TelemetryApiFunctionBase::TelemetryApiFunctionBase() TelemetryApiFunctionBase::~TelemetryApiFunctionBase() = default; -mojo::Remote& +mojo::Remote& TelemetryApiFunctionBase::GetRemoteService() { return remote_probe_service_strategy_->GetRemoteService(); } @@ -43,11 +43,11 @@ void OsTelemetryGetBatteryInfoFunction::RunIfAllowed() { auto cb = base::BindOnce(&OsTelemetryGetBatteryInfoFunction::OnResult, this); GetRemoteService()->ProbeTelemetryInfo( - {ash::health::mojom::ProbeCategoryEnum::kBattery}, std::move(cb)); + {crosapi::mojom::ProbeCategoryEnum::kBattery}, std::move(cb)); } void OsTelemetryGetBatteryInfoFunction::OnResult( - ash::health::mojom::TelemetryInfoPtr ptr) { + crosapi::mojom::ProbeTelemetryInfoPtr ptr) { if (!ptr || !ptr->battery_result || !ptr->battery_result->is_battery_info()) { Respond(Error("API internal error")); return; @@ -84,11 +84,11 @@ void OsTelemetryGetCpuInfoFunction::RunIfAllowed() { auto cb = base::BindOnce(&OsTelemetryGetCpuInfoFunction::OnResult, this); GetRemoteService()->ProbeTelemetryInfo( - {ash::health::mojom::ProbeCategoryEnum::kCpu}, std::move(cb)); + {crosapi::mojom::ProbeCategoryEnum::kCpu}, std::move(cb)); } void OsTelemetryGetCpuInfoFunction::OnResult( - ash::health::mojom::TelemetryInfoPtr ptr) { + crosapi::mojom::ProbeTelemetryInfoPtr ptr) { if (!ptr || !ptr->cpu_result || !ptr->cpu_result->is_cpu_info()) { Respond(Error("API internal error")); return; @@ -118,11 +118,11 @@ void OsTelemetryGetMemoryInfoFunction::RunIfAllowed() { auto cb = base::BindOnce(&OsTelemetryGetMemoryInfoFunction::OnResult, this); GetRemoteService()->ProbeTelemetryInfo( - {ash::health::mojom::ProbeCategoryEnum::kMemory}, std::move(cb)); + {crosapi::mojom::ProbeCategoryEnum::kMemory}, std::move(cb)); } void OsTelemetryGetMemoryInfoFunction::OnResult( - ash::health::mojom::TelemetryInfoPtr ptr) { + crosapi::mojom::ProbeTelemetryInfoPtr ptr) { if (!ptr || !ptr->memory_result || !ptr->memory_result->is_memory_info()) { Respond(Error("API internal error")); return; @@ -173,7 +173,7 @@ void OsTelemetryGetOemDataFunction::RunIfAllowed() { } void OsTelemetryGetOemDataFunction::OnResult( - ash::health::mojom::OemDataPtr ptr) { + crosapi::mojom::ProbeOemDataPtr ptr) { if (!ptr || !ptr->oem_data.has_value()) { Respond(Error("API internal error")); return; @@ -198,11 +198,11 @@ void OsTelemetryGetOsVersionInfoFunction::RunIfAllowed() { base::BindOnce(&OsTelemetryGetOsVersionInfoFunction::OnResult, this); GetRemoteService()->ProbeTelemetryInfo( - {ash::health::mojom::ProbeCategoryEnum::kSystem}, std::move(cb)); + {crosapi::mojom::ProbeCategoryEnum::kSystem}, std::move(cb)); } void OsTelemetryGetOsVersionInfoFunction::OnResult( - ash::health::mojom::TelemetryInfoPtr ptr) { + crosapi::mojom::ProbeTelemetryInfoPtr ptr) { if (!ptr || !ptr->system_result || !ptr->system_result->is_system_info()) { Respond(Error("API internal error")); return; @@ -236,12 +236,11 @@ void OsTelemetryGetStatefulPartitionInfoFunction::RunIfAllowed() { &OsTelemetryGetStatefulPartitionInfoFunction::OnResult, this); GetRemoteService()->ProbeTelemetryInfo( - {ash::health::mojom::ProbeCategoryEnum::kStatefulPartition}, - std::move(cb)); + {crosapi::mojom::ProbeCategoryEnum::kStatefulPartition}, std::move(cb)); } void OsTelemetryGetStatefulPartitionInfoFunction::OnResult( - ash::health::mojom::TelemetryInfoPtr ptr) { + crosapi::mojom::ProbeTelemetryInfoPtr ptr) { if (!ptr || !ptr->stateful_partition_result || !ptr->stateful_partition_result->is_partition_info()) { Respond(Error("API internal error")); @@ -267,11 +266,11 @@ void OsTelemetryGetVpdInfoFunction::RunIfAllowed() { auto cb = base::BindOnce(&OsTelemetryGetVpdInfoFunction::OnResult, this); GetRemoteService()->ProbeTelemetryInfo( - {ash::health::mojom::ProbeCategoryEnum::kCachedVpdData}, std::move(cb)); + {crosapi::mojom::ProbeCategoryEnum::kCachedVpdData}, std::move(cb)); } void OsTelemetryGetVpdInfoFunction::OnResult( - ash::health::mojom::TelemetryInfoPtr ptr) { + crosapi::mojom::ProbeTelemetryInfoPtr ptr) { if (!ptr || !ptr->vpd_result || !ptr->vpd_result->is_vpd_info()) { Respond(Error("API internal error")); return; diff --git a/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api.h b/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api.h index 5e31cc9d17f2e2..e7d7ae6d09eae0 100644 --- a/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api.h +++ b/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api.h @@ -26,7 +26,7 @@ class TelemetryApiFunctionBase : public BaseTelemetryExtensionApiGuardFunction { protected: ~TelemetryApiFunctionBase() override; - mojo::Remote& GetRemoteService(); + mojo::Remote& GetRemoteService(); private: std::unique_ptr remote_probe_service_strategy_; @@ -49,7 +49,7 @@ class OsTelemetryGetBatteryInfoFunction : public TelemetryApiFunctionBase { // BaseTelemetryExtensionApiGuardFunction: void RunIfAllowed() override; - void OnResult(ash::health::mojom::TelemetryInfoPtr ptr); + void OnResult(crosapi::mojom::ProbeTelemetryInfoPtr ptr); }; class OsTelemetryGetCpuInfoFunction : public TelemetryApiFunctionBase { @@ -67,7 +67,7 @@ class OsTelemetryGetCpuInfoFunction : public TelemetryApiFunctionBase { // BaseTelemetryExtensionApiGuardFunction: void RunIfAllowed() override; - void OnResult(ash::health::mojom::TelemetryInfoPtr ptr); + void OnResult(crosapi::mojom::ProbeTelemetryInfoPtr ptr); }; class OsTelemetryGetMemoryInfoFunction : public TelemetryApiFunctionBase { @@ -87,7 +87,7 @@ class OsTelemetryGetMemoryInfoFunction : public TelemetryApiFunctionBase { // BaseTelemetryExtensionApiGuardFunction: void RunIfAllowed() override; - void OnResult(ash::health::mojom::TelemetryInfoPtr ptr); + void OnResult(crosapi::mojom::ProbeTelemetryInfoPtr ptr); }; class OsTelemetryGetOemDataFunction : public TelemetryApiFunctionBase { @@ -105,7 +105,7 @@ class OsTelemetryGetOemDataFunction : public TelemetryApiFunctionBase { // BaseTelemetryExtensionApiGuardFunction: void RunIfAllowed() override; - void OnResult(ash::health::mojom::OemDataPtr ptr); + void OnResult(crosapi::mojom::ProbeOemDataPtr ptr); }; class OsTelemetryGetOsVersionInfoFunction : public TelemetryApiFunctionBase { @@ -125,7 +125,7 @@ class OsTelemetryGetOsVersionInfoFunction : public TelemetryApiFunctionBase { // BaseTelemetryExtensionApiGuardFunction: void RunIfAllowed() override; - void OnResult(ash::health::mojom::TelemetryInfoPtr ptr); + void OnResult(crosapi::mojom::ProbeTelemetryInfoPtr ptr); }; class OsTelemetryGetVpdInfoFunction : public TelemetryApiFunctionBase { @@ -143,7 +143,7 @@ class OsTelemetryGetVpdInfoFunction : public TelemetryApiFunctionBase { // BaseTelemetryExtensionApiGuardFunction: void RunIfAllowed() override; - void OnResult(ash::health::mojom::TelemetryInfoPtr ptr); + void OnResult(crosapi::mojom::ProbeTelemetryInfoPtr ptr); }; class OsTelemetryGetStatefulPartitionInfoFunction @@ -164,7 +164,7 @@ class OsTelemetryGetStatefulPartitionInfoFunction // BaseTelemetryExtensionApiGuardFunction: void RunIfAllowed() override; - void OnResult(ash::health::mojom::TelemetryInfoPtr ptr); + void OnResult(crosapi::mojom::ProbeTelemetryInfoPtr ptr); }; } // namespace chromeos diff --git a/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api_browsertest.cc b/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api_browsertest.cc index 9c7d0d0089f727..4a9369f42764ff 100644 --- a/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api_browsertest.cc +++ b/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api_browsertest.cc @@ -43,7 +43,7 @@ IN_PROC_BROWSER_TEST_F(TelemetryExtensionTelemetryApiBrowserTest, { auto fake_service_impl = std::make_unique(); fake_service_impl->SetExpectedLastRequestedCategories( - {ash::health::mojom::ProbeCategoryEnum::kBattery}); + {crosapi::mojom::ProbeCategoryEnum::kBattery}); SetServiceForTesting(std::move(fake_service_impl)); } @@ -65,41 +65,41 @@ IN_PROC_BROWSER_TEST_F(TelemetryExtensionTelemetryApiBrowserTest, GetBatteryInfo_Success) { // Configure FakeProbeService. { - auto telemetry_info = ash::health::mojom::TelemetryInfo::New(); + auto telemetry_info = crosapi::mojom::ProbeTelemetryInfo::New(); { - auto battery_info = ash::health::mojom::BatteryInfo::New(); + auto battery_info = crosapi::mojom::ProbeBatteryInfo::New(); battery_info->cycle_count = - ash::health::mojom::Int64Value::New(100000000000000); + crosapi::mojom::Int64Value::New(100000000000000); battery_info->voltage_now = - ash::health::mojom::DoubleValue::New(1234567890.123456); + crosapi::mojom::DoubleValue::New(1234567890.123456); battery_info->vendor = "Google"; battery_info->serial_number = "abcdef"; battery_info->charge_full_design = - ash::health::mojom::DoubleValue::New(3000000000000000); + crosapi::mojom::DoubleValue::New(3000000000000000); battery_info->charge_full = - ash::health::mojom::DoubleValue::New(9000000000000000); + crosapi::mojom::DoubleValue::New(9000000000000000); battery_info->voltage_min_design = - ash::health::mojom::DoubleValue::New(1000000000.1001); + crosapi::mojom::DoubleValue::New(1000000000.1001); battery_info->model_name = "Google Battery"; battery_info->charge_now = - ash::health::mojom::DoubleValue::New(7777777777.777); + crosapi::mojom::DoubleValue::New(7777777777.777); battery_info->current_now = - ash::health::mojom::DoubleValue::New(0.9999999999999); + crosapi::mojom::DoubleValue::New(0.9999999999999); battery_info->technology = "Li-ion"; battery_info->status = "Charging"; battery_info->manufacture_date = "2020-07-30"; battery_info->temperature = - ash::health::mojom::UInt64Value::New(7777777777777777); + crosapi::mojom::UInt64Value::New(7777777777777777); telemetry_info->battery_result = - ash::health::mojom::BatteryResult::NewBatteryInfo( + crosapi::mojom::ProbeBatteryResult::NewBatteryInfo( std::move(battery_info)); } auto fake_service_impl = std::make_unique(); fake_service_impl->SetProbeTelemetryInfoResponse(std::move(telemetry_info)); fake_service_impl->SetExpectedLastRequestedCategories( - {ash::health::mojom::ProbeCategoryEnum::kBattery}); + {crosapi::mojom::ProbeCategoryEnum::kBattery}); SetServiceForTesting(std::move(fake_service_impl)); } @@ -139,7 +139,7 @@ IN_PROC_BROWSER_TEST_F(TelemetryExtensionTelemetryApiBrowserTest, { auto fake_service_impl = std::make_unique(); fake_service_impl->SetExpectedLastRequestedCategories( - {ash::health::mojom::ProbeCategoryEnum::kCpu}); + {crosapi::mojom::ProbeCategoryEnum::kCpu}); SetServiceForTesting(std::move(fake_service_impl)); } @@ -161,78 +161,79 @@ IN_PROC_BROWSER_TEST_F(TelemetryExtensionTelemetryApiBrowserTest, GetCpuInfo_Success) { // Configure FakeProbeService. { - auto telemetry_info = ash::health::mojom::TelemetryInfo::New(); + auto telemetry_info = crosapi::mojom::ProbeTelemetryInfo::New(); { - auto c_state1 = ash::health::mojom::CpuCStateInfo::New(); + auto c_state1 = crosapi::mojom::ProbeCpuCStateInfo::New(); c_state1->name = "C1"; c_state1->time_in_state_since_last_boot_us = - ash::health::mojom::UInt64Value::New(1125899906875957); + crosapi::mojom::UInt64Value::New(1125899906875957); - auto c_state2 = ash::health::mojom::CpuCStateInfo::New(); + auto c_state2 = crosapi::mojom::ProbeCpuCStateInfo::New(); c_state2->name = "C2"; c_state2->time_in_state_since_last_boot_us = - ash::health::mojom::UInt64Value::New(1125899906877777); + crosapi::mojom::UInt64Value::New(1125899906877777); - auto logical_info1 = ash::health::mojom::LogicalCpuInfo::New(); + auto logical_info1 = crosapi::mojom::ProbeLogicalCpuInfo::New(); logical_info1->max_clock_speed_khz = - ash::health::mojom::UInt32Value::New(2147473647); + crosapi::mojom::UInt32Value::New(2147473647); logical_info1->scaling_max_frequency_khz = - ash::health::mojom::UInt32Value::New(1073764046); + crosapi::mojom::UInt32Value::New(1073764046); logical_info1->scaling_current_frequency_khz = - ash::health::mojom::UInt32Value::New(536904245); + crosapi::mojom::UInt32Value::New(536904245); // Idle time cannot be tested in browser test, because it requires USER_HZ // system constant to convert idle_time_user_hz to milliseconds. - logical_info1->idle_time_ms = ash::health::mojom::UInt64Value::New(0); + logical_info1->idle_time_ms = crosapi::mojom::UInt64Value::New(0); logical_info1->c_states.push_back(std::move(c_state1)); logical_info1->c_states.push_back(std::move(c_state2)); - auto logical_info2 = ash::health::mojom::LogicalCpuInfo::New(); + auto logical_info2 = crosapi::mojom::ProbeLogicalCpuInfo::New(); logical_info2->max_clock_speed_khz = - ash::health::mojom::UInt32Value::New(1147494759); + crosapi::mojom::UInt32Value::New(1147494759); logical_info2->scaling_max_frequency_khz = - ash::health::mojom::UInt32Value::New(1063764046); + crosapi::mojom::UInt32Value::New(1063764046); logical_info2->scaling_current_frequency_khz = - ash::health::mojom::UInt32Value::New(936904246); + crosapi::mojom::UInt32Value::New(936904246); // Idle time cannot be tested in browser test, because it requires USER_HZ // system constant to convert idle_time_user_hz to milliseconds. - logical_info2->idle_time_ms = ash::health::mojom::UInt64Value::New(0); + logical_info2->idle_time_ms = crosapi::mojom::UInt64Value::New(0); - auto physical_info1 = ash::health::mojom::PhysicalCpuInfo::New(); + auto physical_info1 = crosapi::mojom::ProbePhysicalCpuInfo::New(); physical_info1->model_name = "i9"; physical_info1->logical_cpus.push_back(std::move(logical_info1)); physical_info1->logical_cpus.push_back(std::move(logical_info2)); - auto logical_info3 = ash::health::mojom::LogicalCpuInfo::New(); + auto logical_info3 = crosapi::mojom::ProbeLogicalCpuInfo::New(); logical_info3->max_clock_speed_khz = - ash::health::mojom::UInt32Value::New(1247494759); + crosapi::mojom::UInt32Value::New(1247494759); logical_info3->scaling_max_frequency_khz = - ash::health::mojom::UInt32Value::New(1263764046); + crosapi::mojom::UInt32Value::New(1263764046); logical_info3->scaling_current_frequency_khz = - ash::health::mojom::UInt32Value::New(946904246); + crosapi::mojom::UInt32Value::New(946904246); // Idle time cannot be tested in browser test, because it requires USER_HZ // system constant to convert idle_time_user_hz to milliseconds. - logical_info3->idle_time_ms = ash::health::mojom::UInt64Value::New(0); + logical_info3->idle_time_ms = crosapi::mojom::UInt64Value::New(0); - auto physical_info2 = ash::health::mojom::PhysicalCpuInfo::New(); + auto physical_info2 = crosapi::mojom::ProbePhysicalCpuInfo::New(); physical_info2->model_name = "i9-low-powered"; physical_info2->logical_cpus.push_back(std::move(logical_info3)); - auto cpu_info = ash::health::mojom::CpuInfo::New(); + auto cpu_info = crosapi::mojom::ProbeCpuInfo::New(); cpu_info->num_total_threads = - ash::health::mojom::UInt32Value::New(2147483647); - cpu_info->architecture = ash::health::mojom::CpuArchitectureEnum::kArmv7l; + crosapi::mojom::UInt32Value::New(2147483647); + cpu_info->architecture = + crosapi::mojom::ProbeCpuArchitectureEnum::kArmv7l; cpu_info->physical_cpus.push_back(std::move(physical_info1)); cpu_info->physical_cpus.push_back(std::move(physical_info2)); telemetry_info->cpu_result = - ash::health::mojom::CpuResult::NewCpuInfo(std::move(cpu_info)); + crosapi::mojom::ProbeCpuResult::NewCpuInfo(std::move(cpu_info)); } auto fake_service_impl = std::make_unique(); fake_service_impl->SetProbeTelemetryInfoResponse(std::move(telemetry_info)); fake_service_impl->SetExpectedLastRequestedCategories( - {ash::health::mojom::ProbeCategoryEnum::kCpu}); + {crosapi::mojom::ProbeCategoryEnum::kCpu}); SetServiceForTesting(std::move(fake_service_impl)); } @@ -294,7 +295,7 @@ IN_PROC_BROWSER_TEST_F(TelemetryExtensionTelemetryApiBrowserTest, { auto fake_service_impl = std::make_unique(); fake_service_impl->SetExpectedLastRequestedCategories( - {ash::health::mojom::ProbeCategoryEnum::kMemory}); + {crosapi::mojom::ProbeCategoryEnum::kMemory}); SetServiceForTesting(std::move(fake_service_impl)); } @@ -316,28 +317,28 @@ IN_PROC_BROWSER_TEST_F(TelemetryExtensionTelemetryApiBrowserTest, GetMemoryInfo_Success) { // Configure FakeProbeService. { - auto telemetry_info = ash::health::mojom::TelemetryInfo::New(); + auto telemetry_info = crosapi::mojom::ProbeTelemetryInfo::New(); { - auto memory_info = ash::health::mojom::MemoryInfo::New(); + auto memory_info = crosapi::mojom::ProbeMemoryInfo::New(); memory_info->total_memory_kib = - ash::health::mojom::UInt32Value::New(2147483647); + crosapi::mojom::UInt32Value::New(2147483647); memory_info->free_memory_kib = - ash::health::mojom::UInt32Value::New(2147483646); + crosapi::mojom::UInt32Value::New(2147483646); memory_info->available_memory_kib = - ash::health::mojom::UInt32Value::New(2147483645); + crosapi::mojom::UInt32Value::New(2147483645); memory_info->page_faults_since_last_boot = - ash::health::mojom::UInt64Value::New(4611686018427388000); + crosapi::mojom::UInt64Value::New(4611686018427388000); telemetry_info->memory_result = - ash::health::mojom::MemoryResult::NewMemoryInfo( + crosapi::mojom::ProbeMemoryResult::NewMemoryInfo( std::move(memory_info)); } auto fake_service_impl = std::make_unique(); fake_service_impl->SetProbeTelemetryInfoResponse(std::move(telemetry_info)); fake_service_impl->SetExpectedLastRequestedCategories( - {ash::health::mojom::ProbeCategoryEnum::kMemory}); + {crosapi::mojom::ProbeCategoryEnum::kMemory}); SetServiceForTesting(std::move(fake_service_impl)); } @@ -384,7 +385,7 @@ IN_PROC_BROWSER_TEST_F(TelemetryExtensionTelemetryApiBrowserTest, { auto fake_service_impl = std::make_unique(); - auto oem_data = ash::health::mojom::OemData::New(); + auto oem_data = crosapi::mojom::ProbeOemData::New(); oem_data->oem_data = "123456789"; fake_service_impl->SetOemDataResponse(std::move(oem_data)); @@ -409,7 +410,7 @@ IN_PROC_BROWSER_TEST_F(TelemetryExtensionTelemetryApiBrowserTest, { auto fake_service_impl = std::make_unique(); fake_service_impl->SetExpectedLastRequestedCategories( - {ash::health::mojom::ProbeCategoryEnum::kSystem}); + {crosapi::mojom::ProbeCategoryEnum::kSystem}); SetServiceForTesting(std::move(fake_service_impl)); } @@ -431,29 +432,29 @@ IN_PROC_BROWSER_TEST_F(TelemetryExtensionTelemetryApiBrowserTest, GetOsVersionInfo_Success) { // Configure FakeProbeService. { - auto telemetry_info = ash::health::mojom::TelemetryInfo::New(); + auto telemetry_info = crosapi::mojom::ProbeTelemetryInfo::New(); { - auto os_version_info = ash::health::mojom::OsVersion::New(); + auto os_version_info = crosapi::mojom::ProbeOsVersion::New(); os_version_info->release_milestone = "87"; os_version_info->build_number = "13544"; os_version_info->patch_number = "59.0"; os_version_info->release_channel = "stable-channel"; - auto os_info = ash::health::mojom::OsInfo::New(); + auto os_info = crosapi::mojom::ProbeOsInfo::New(); os_info->os_version = std::move(os_version_info); - auto system_info = ash::health::mojom::SystemInfo::New(); + auto system_info = crosapi::mojom::ProbeSystemInfo::New(); system_info->os_info = std::move(os_info); telemetry_info->system_result = - ash::health::mojom::SystemResult::NewSystemInfo( + crosapi::mojom::ProbeSystemResult::NewSystemInfo( std::move(system_info)); } auto fake_service_impl = std::make_unique(); fake_service_impl->SetProbeTelemetryInfoResponse(std::move(telemetry_info)); fake_service_impl->SetExpectedLastRequestedCategories( - {ash::health::mojom::ProbeCategoryEnum::kSystem}); + {crosapi::mojom::ProbeCategoryEnum::kSystem}); SetServiceForTesting(std::move(fake_service_impl)); } @@ -481,7 +482,7 @@ IN_PROC_BROWSER_TEST_F(TelemetryExtensionTelemetryApiBrowserTest, { auto fake_service_impl = std::make_unique(); fake_service_impl->SetExpectedLastRequestedCategories( - {ash::health::mojom::ProbeCategoryEnum::kCachedVpdData}); + {crosapi::mojom::ProbeCategoryEnum::kCachedVpdData}); SetServiceForTesting(std::move(fake_service_impl)); } @@ -503,23 +504,23 @@ IN_PROC_BROWSER_TEST_F(TelemetryExtensionTelemetryApiBrowserTest, GetVpdInfoWithSerialNumberPermission) { // Configure FakeProbeService. { - auto telemetry_info = ash::health::mojom::TelemetryInfo::New(); + auto telemetry_info = crosapi::mojom::ProbeTelemetryInfo::New(); { - auto vpd_info = ash::health::mojom::CachedVpdInfo::New(); + auto vpd_info = crosapi::mojom::ProbeCachedVpdInfo::New(); vpd_info->first_power_date = "2021-50"; vpd_info->model_name = "COOL-LAPTOP-CHROME"; vpd_info->serial_number = "5CD9132880"; vpd_info->sku_number = "sku15"; telemetry_info->vpd_result = - ash::health::mojom::CachedVpdResult::NewVpdInfo(std::move(vpd_info)); + crosapi::mojom::ProbeCachedVpdResult::NewVpdInfo(std::move(vpd_info)); } auto fake_service_impl = std::make_unique(); fake_service_impl->SetProbeTelemetryInfoResponse(std::move(telemetry_info)); fake_service_impl->SetExpectedLastRequestedCategories( - {ash::health::mojom::ProbeCategoryEnum::kCachedVpdData}); + {crosapi::mojom::ProbeCategoryEnum::kCachedVpdData}); SetServiceForTesting(std::move(fake_service_impl)); } @@ -544,7 +545,7 @@ IN_PROC_BROWSER_TEST_F(TelemetryExtensionTelemetryApiBrowserTest, { auto fake_service_impl = std::make_unique(); fake_service_impl->SetExpectedLastRequestedCategories( - {ash::health::mojom::ProbeCategoryEnum::kStatefulPartition}); + {crosapi::mojom::ProbeCategoryEnum::kStatefulPartition}); SetServiceForTesting(std::move(fake_service_impl)); } @@ -566,24 +567,24 @@ IN_PROC_BROWSER_TEST_F(TelemetryExtensionTelemetryApiBrowserTest, GetStatefulPartitionInfo_Success) { // Configure FakeProbeService. { - auto telemetry_info = ash::health::mojom::TelemetryInfo::New(); + auto telemetry_info = crosapi::mojom::ProbeTelemetryInfo::New(); { auto stateful_part_info = - ash::health::mojom::StatefulPartitionInfo::New(); + crosapi::mojom::ProbeStatefulPartitionInfo::New(); stateful_part_info->available_space = - ash::health::mojom::UInt64Value::New(3000000000000000); + crosapi::mojom::UInt64Value::New(3000000000000000); stateful_part_info->total_space = - ash::health::mojom::UInt64Value::New(9000000000000000); + crosapi::mojom::UInt64Value::New(9000000000000000); telemetry_info->stateful_partition_result = - ash::health::mojom::StatefulPartitionResult::NewPartitionInfo( + crosapi::mojom::ProbeStatefulPartitionResult::NewPartitionInfo( std::move(stateful_part_info)); } auto fake_service_impl = std::make_unique(); fake_service_impl->SetProbeTelemetryInfoResponse(std::move(telemetry_info)); fake_service_impl->SetExpectedLastRequestedCategories( - {ash::health::mojom::ProbeCategoryEnum::kStatefulPartition}); + {crosapi::mojom::ProbeCategoryEnum::kStatefulPartition}); SetServiceForTesting(std::move(fake_service_impl)); } @@ -648,41 +649,41 @@ IN_PROC_BROWSER_TEST_F( GetBatteryInfoWithoutSerialNumberPermission) { // Configure FakeProbeService. { - auto telemetry_info = ash::health::mojom::TelemetryInfo::New(); + auto telemetry_info = crosapi::mojom::ProbeTelemetryInfo::New(); { - auto battery_info = ash::health::mojom::BatteryInfo::New(); + auto battery_info = crosapi::mojom::ProbeBatteryInfo::New(); battery_info->cycle_count = - ash::health::mojom::Int64Value::New(100000000000000); + crosapi::mojom::Int64Value::New(100000000000000); battery_info->voltage_now = - ash::health::mojom::DoubleValue::New(1234567890.123456); + crosapi::mojom::DoubleValue::New(1234567890.123456); battery_info->vendor = "Google"; battery_info->serial_number = "abcdef"; battery_info->charge_full_design = - ash::health::mojom::DoubleValue::New(3000000000000000); + crosapi::mojom::DoubleValue::New(3000000000000000); battery_info->charge_full = - ash::health::mojom::DoubleValue::New(9000000000000000); + crosapi::mojom::DoubleValue::New(9000000000000000); battery_info->voltage_min_design = - ash::health::mojom::DoubleValue::New(1000000000.1001); + crosapi::mojom::DoubleValue::New(1000000000.1001); battery_info->model_name = "Google Battery"; battery_info->charge_now = - ash::health::mojom::DoubleValue::New(7777777777.777); + crosapi::mojom::DoubleValue::New(7777777777.777); battery_info->current_now = - ash::health::mojom::DoubleValue::New(0.9999999999999); + crosapi::mojom::DoubleValue::New(0.9999999999999); battery_info->technology = "Li-ion"; battery_info->status = "Charging"; battery_info->manufacture_date = "2020-07-30"; battery_info->temperature = - ash::health::mojom::UInt64Value::New(7777777777777777); + crosapi::mojom::UInt64Value::New(7777777777777777); telemetry_info->battery_result = - ash::health::mojom::BatteryResult::NewBatteryInfo( + crosapi::mojom::ProbeBatteryResult::NewBatteryInfo( std::move(battery_info)); } auto fake_service_impl = std::make_unique(); fake_service_impl->SetProbeTelemetryInfoResponse(std::move(telemetry_info)); fake_service_impl->SetExpectedLastRequestedCategories( - {ash::health::mojom::ProbeCategoryEnum::kBattery}); + {crosapi::mojom::ProbeCategoryEnum::kBattery}); SetServiceForTesting(std::move(fake_service_impl)); } @@ -744,23 +745,23 @@ IN_PROC_BROWSER_TEST_F( GetVpdInfoWithoutSerialNumberPermission) { // Configure FakeProbeService. { - auto telemetry_info = ash::health::mojom::TelemetryInfo::New(); + auto telemetry_info = crosapi::mojom::ProbeTelemetryInfo::New(); { - auto vpd_info = ash::health::mojom::CachedVpdInfo::New(); + auto vpd_info = crosapi::mojom::ProbeCachedVpdInfo::New(); vpd_info->first_power_date = "2021-50"; vpd_info->model_name = "COOL-LAPTOP-CHROME"; vpd_info->serial_number = "5CD9132880"; vpd_info->sku_number = "sku15"; telemetry_info->vpd_result = - ash::health::mojom::CachedVpdResult::NewVpdInfo(std::move(vpd_info)); + crosapi::mojom::ProbeCachedVpdResult::NewVpdInfo(std::move(vpd_info)); } auto fake_service_impl = std::make_unique(); fake_service_impl->SetProbeTelemetryInfoResponse(std::move(telemetry_info)); fake_service_impl->SetExpectedLastRequestedCategories( - {ash::health::mojom::ProbeCategoryEnum::kCachedVpdData}); + {crosapi::mojom::ProbeCategoryEnum::kCachedVpdData}); SetServiceForTesting(std::move(fake_service_impl)); } diff --git a/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api_converters.cc b/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api_converters.cc index 84479c2c9451dd..fe18dcca2c091d 100644 --- a/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api_converters.cc +++ b/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api_converters.cc @@ -21,14 +21,14 @@ namespace converters { namespace { namespace telemetry_api = ::chromeos::api::os_telemetry; -namespace telemetry_service = ::ash::health::mojom; +namespace telemetry_service = ::crosapi::mojom; } // namespace namespace unchecked { telemetry_api::CpuCStateInfo UncheckedConvertPtr( - telemetry_service::CpuCStateInfoPtr input) { + telemetry_service::ProbeCpuCStateInfoPtr input) { telemetry_api::CpuCStateInfo result; if (input->name.has_value()) { result.name = std::make_unique(input->name.value()); @@ -41,7 +41,7 @@ telemetry_api::CpuCStateInfo UncheckedConvertPtr( } telemetry_api::LogicalCpuInfo UncheckedConvertPtr( - telemetry_service::LogicalCpuInfoPtr input) { + telemetry_service::ProbeLogicalCpuInfoPtr input) { telemetry_api::LogicalCpuInfo result; if (input->max_clock_speed_khz) { result.max_clock_speed_khz = @@ -65,7 +65,7 @@ telemetry_api::LogicalCpuInfo UncheckedConvertPtr( } telemetry_api::PhysicalCpuInfo UncheckedConvertPtr( - telemetry_service::PhysicalCpuInfoPtr input) { + telemetry_service::ProbePhysicalCpuInfoPtr input) { telemetry_api::PhysicalCpuInfo result; if (input->model_name.has_value()) { result.model_name = @@ -77,7 +77,7 @@ telemetry_api::PhysicalCpuInfo UncheckedConvertPtr( } telemetry_api::BatteryInfo UncheckedConvertPtr( - telemetry_service::BatteryInfoPtr input) { + telemetry_service::ProbeBatteryInfoPtr input) { telemetry_api::BatteryInfo result; if (input->vendor.has_value()) { result.vendor = @@ -130,7 +130,7 @@ telemetry_api::BatteryInfo UncheckedConvertPtr( } telemetry_api::OsVersionInfo UncheckedConvertPtr( - telemetry_service::OsVersionPtr input) { + telemetry_service::ProbeOsVersionPtr input) { telemetry_api::OsVersionInfo result; if (input->release_milestone) { @@ -157,7 +157,7 @@ telemetry_api::OsVersionInfo UncheckedConvertPtr( } telemetry_api::StatefulPartitionInfo UncheckedConvertPtr( - telemetry_service::StatefulPartitionInfoPtr input) { + telemetry_service::ProbeStatefulPartitionInfoPtr input) { telemetry_api::StatefulPartitionInfo result; if (input->available_space) { result.available_space = @@ -173,15 +173,15 @@ telemetry_api::StatefulPartitionInfo UncheckedConvertPtr( } // namespace unchecked telemetry_api::CpuArchitectureEnum Convert( - telemetry_service::CpuArchitectureEnum input) { + telemetry_service::ProbeCpuArchitectureEnum input) { switch (input) { - case telemetry_service::CpuArchitectureEnum::kUnknown: + case telemetry_service::ProbeCpuArchitectureEnum::kUnknown: return telemetry_api::CpuArchitectureEnum::CPU_ARCHITECTURE_ENUM_UNKNOWN; - case telemetry_service::CpuArchitectureEnum::kX86_64: + case telemetry_service::ProbeCpuArchitectureEnum::kX86_64: return telemetry_api::CpuArchitectureEnum::CPU_ARCHITECTURE_ENUM_X86_64; - case telemetry_service::CpuArchitectureEnum::kAArch64: + case telemetry_service::ProbeCpuArchitectureEnum::kAArch64: return telemetry_api::CpuArchitectureEnum::CPU_ARCHITECTURE_ENUM_AARCH64; - case telemetry_service::CpuArchitectureEnum::kArmv7l: + case telemetry_service::ProbeCpuArchitectureEnum::kArmv7l: return telemetry_api::CpuArchitectureEnum::CPU_ARCHITECTURE_ENUM_ARMV7L; } NOTREACHED(); diff --git a/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api_converters.h b/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api_converters.h index 60c550825a8f79..8e8d13bf832c9c 100644 --- a/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api_converters.h +++ b/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api_converters.h @@ -26,29 +26,29 @@ namespace unchecked { // whether input pointer is nullptr. chromeos::api::os_telemetry::CpuCStateInfo UncheckedConvertPtr( - ash::health::mojom::CpuCStateInfoPtr input); + crosapi::mojom::ProbeCpuCStateInfoPtr input); chromeos::api::os_telemetry::LogicalCpuInfo UncheckedConvertPtr( - ash::health::mojom::LogicalCpuInfoPtr input); + crosapi::mojom::ProbeLogicalCpuInfoPtr input); chromeos::api::os_telemetry::PhysicalCpuInfo UncheckedConvertPtr( - ash::health::mojom::PhysicalCpuInfoPtr input); + crosapi::mojom::ProbePhysicalCpuInfoPtr input); // Note: Battery's serial number is not converted in this function because it is // guarded by a permission. chromeos::api::os_telemetry::BatteryInfo UncheckedConvertPtr( - ash::health::mojom::BatteryInfoPtr input); + crosapi::mojom::ProbeBatteryInfoPtr input); chromeos::api::os_telemetry::OsVersionInfo UncheckedConvertPtr( - ash::health::mojom::OsVersionPtr input); + crosapi::mojom::ProbeOsVersionPtr input); chromeos::api::os_telemetry::StatefulPartitionInfo UncheckedConvertPtr( - ash::health::mojom::StatefulPartitionInfoPtr input); + crosapi::mojom::ProbeStatefulPartitionInfoPtr input); } // namespace unchecked chromeos::api::os_telemetry::CpuArchitectureEnum Convert( - ash::health::mojom::CpuArchitectureEnum input); + crosapi::mojom::ProbeCpuArchitectureEnum input); template std::vector ConvertPtrVector(std::vector input) { diff --git a/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api_converters_unittest.cc b/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api_converters_unittest.cc index fc10e5c3e458f1..3a50c87598ea02 100644 --- a/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api_converters_unittest.cc +++ b/chrome/browser/chromeos/extensions/telemetry/api/telemetry_api_converters_unittest.cc @@ -20,7 +20,7 @@ namespace chromeos { namespace { namespace telemetry_api = ::chromeos::api::os_telemetry; -namespace telemetry_service = ::ash::health::mojom; +namespace telemetry_service = ::crosapi::mojom; } // namespace @@ -28,20 +28,20 @@ namespace converters { TEST(TelemetryApiConverters, CpuArchitectureEnum) { EXPECT_EQ(telemetry_api::CpuArchitectureEnum::CPU_ARCHITECTURE_ENUM_UNKNOWN, - Convert(telemetry_service::CpuArchitectureEnum::kUnknown)); + Convert(telemetry_service::ProbeCpuArchitectureEnum::kUnknown)); EXPECT_EQ(telemetry_api::CpuArchitectureEnum::CPU_ARCHITECTURE_ENUM_X86_64, - Convert(telemetry_service::CpuArchitectureEnum::kX86_64)); + Convert(telemetry_service::ProbeCpuArchitectureEnum::kX86_64)); EXPECT_EQ(telemetry_api::CpuArchitectureEnum::CPU_ARCHITECTURE_ENUM_AARCH64, - Convert(telemetry_service::CpuArchitectureEnum::kAArch64)); + Convert(telemetry_service::ProbeCpuArchitectureEnum::kAArch64)); EXPECT_EQ(telemetry_api::CpuArchitectureEnum::CPU_ARCHITECTURE_ENUM_ARMV7L, - Convert(telemetry_service::CpuArchitectureEnum::kArmv7l)); + Convert(telemetry_service::ProbeCpuArchitectureEnum::kArmv7l)); } TEST(TelemetryApiConverters, CpuCStateInfo) { constexpr char kName[] = "C0"; constexpr uint64_t kTimeInStateSinceLastBootUs = 123456; - auto input = telemetry_service::CpuCStateInfo::New( + auto input = telemetry_service::ProbeCpuCStateInfo::New( kName, telemetry_service::UInt64Value::New(kTimeInStateSinceLastBootUs)); auto result = ConvertPtr(std::move(input)); @@ -57,8 +57,8 @@ TEST(TelemetryApiConverters, LogicalCpuInfo) { constexpr char kCpuCStateName[] = "C1"; constexpr uint64_t kCpuCStateTime = (1 << 27) + 50000; - std::vector expected_c_states; - expected_c_states.push_back(telemetry_service::CpuCStateInfo::New( + std::vector expected_c_states; + expected_c_states.push_back(telemetry_service::ProbeCpuCStateInfo::New( kCpuCStateName, telemetry_service::UInt64Value::New(kCpuCStateTime))); constexpr uint32_t kMaxClockSpeedKhz = (1 << 30) + 10000; @@ -66,7 +66,7 @@ TEST(TelemetryApiConverters, LogicalCpuInfo) { constexpr uint32_t kScalingCurrentFrequencyKhz = (1 << 29) + 30000; constexpr uint64_t kIdleTime = (1ULL << 52) + 40000; - auto input = telemetry_service::LogicalCpuInfo::New( + auto input = telemetry_service::ProbeLogicalCpuInfo::New( telemetry_service::UInt32Value::New(kMaxClockSpeedKhz), telemetry_service::UInt32Value::New(kScalingMaxFrequencyKhz), telemetry_service::UInt32Value::New(kScalingCurrentFrequencyKhz), @@ -103,8 +103,8 @@ TEST(TelemetryApiConverters, PhysicalCpuInfo) { constexpr char kCpuCStateName[] = "C2"; constexpr uint64_t kCpuCStateTime = (1 << 27) + 90000; - std::vector expected_c_states; - expected_c_states.push_back(telemetry_service::CpuCStateInfo::New( + std::vector expected_c_states; + expected_c_states.push_back(telemetry_service::ProbeCpuCStateInfo::New( kCpuCStateName, telemetry_service::UInt64Value::New(kCpuCStateTime))); constexpr uint32_t kMaxClockSpeedKhz = (1 << 30) + 80000; @@ -112,8 +112,8 @@ TEST(TelemetryApiConverters, PhysicalCpuInfo) { constexpr uint32_t kScalingCurrentFrequencyKhz = (1 << 29) + 60000; constexpr uint64_t kIdleTime = (1ULL << 52) + 50000; - std::vector logical_cpus; - logical_cpus.push_back(telemetry_service::LogicalCpuInfo::New( + std::vector logical_cpus; + logical_cpus.push_back(telemetry_service::ProbeLogicalCpuInfo::New( telemetry_service::UInt32Value::New(kMaxClockSpeedKhz), telemetry_service::UInt32Value::New(kScalingMaxFrequencyKhz), telemetry_service::UInt32Value::New(kScalingCurrentFrequencyKhz), @@ -122,8 +122,8 @@ TEST(TelemetryApiConverters, PhysicalCpuInfo) { constexpr char kModelName[] = "i9"; - auto input = telemetry_service::PhysicalCpuInfo::New(kModelName, - std::move(logical_cpus)); + auto input = telemetry_service::ProbePhysicalCpuInfo::New( + kModelName, std::move(logical_cpus)); auto result = ConvertPtr(std::move(input)); ASSERT_TRUE(result.model_name); @@ -176,15 +176,17 @@ TEST(TelemetryApiConverters, BatteryInfo) { constexpr char kManufacturerDate[] = "2020-07-30"; constexpr double_t kTemperature = 7777777777777777; - telemetry_service::BatteryInfoPtr input = telemetry_service::BatteryInfo::New( - telemetry_service::Int64Value::New(kCycleCount), - telemetry_service::DoubleValue::New(kVoltageNow), kVendor, kSerialNumber, - telemetry_service::DoubleValue::New(kChargeFullDesign), - telemetry_service::DoubleValue::New(kChargeFull), - telemetry_service::DoubleValue::New(kVoltageMinDesign), kModelName, - telemetry_service::DoubleValue::New(kChargeNow), - telemetry_service::DoubleValue::New(kCurrentNow), kTechnology, kStatus, - kManufacturerDate, telemetry_service::UInt64Value::New(kTemperature)); + telemetry_service::ProbeBatteryInfoPtr input = + telemetry_service::ProbeBatteryInfo::New( + telemetry_service::Int64Value::New(kCycleCount), + telemetry_service::DoubleValue::New(kVoltageNow), kVendor, + kSerialNumber, telemetry_service::DoubleValue::New(kChargeFullDesign), + telemetry_service::DoubleValue::New(kChargeFull), + telemetry_service::DoubleValue::New(kVoltageMinDesign), kModelName, + telemetry_service::DoubleValue::New(kChargeNow), + telemetry_service::DoubleValue::New(kCurrentNow), kTechnology, + kStatus, kManufacturerDate, + telemetry_service::UInt64Value::New(kTemperature)); auto result = ConvertPtr(std::move(input)); ASSERT_TRUE(result.cycle_count); @@ -237,7 +239,7 @@ TEST(TelemetryApiConverters, OsVersion) { constexpr char kPatchNumber[] = "59.0"; constexpr char kReleaseChannel[] = "stable-channel"; - auto input = telemetry_service::OsVersion::New( + auto input = telemetry_service::ProbeOsVersion::New( kReleaseMilestone, kBuildNumber, kPatchNumber, kReleaseChannel); auto result = ConvertPtr(std::move(input)); @@ -258,8 +260,8 @@ TEST(TelemetryApiConverters, StatefulPartitionInfo) { constexpr uint64_t kAvailableSpace = 3000000000000000; constexpr uint64_t kTotalSpace = 9000000000000000; - telemetry_service::StatefulPartitionInfoPtr input = - telemetry_service::StatefulPartitionInfo::New( + telemetry_service::ProbeStatefulPartitionInfoPtr input = + telemetry_service::ProbeStatefulPartitionInfo::New( telemetry_service::UInt64Value::New(kAvailableSpace), telemetry_service::UInt64Value::New(kTotalSpace)); @@ -273,8 +275,8 @@ TEST(TelemetryApiConverters, StatefulPartitionInfo) { } TEST(TelemetryApiConverters, StatefulPartitionInfoNullFields) { - telemetry_service::StatefulPartitionInfoPtr input = - telemetry_service::StatefulPartitionInfo::New< + telemetry_service::ProbeStatefulPartitionInfoPtr input = + telemetry_service::ProbeStatefulPartitionInfo::New< telemetry_service::UInt64ValuePtr, telemetry_service::UInt64ValuePtr>( nullptr, nullptr); diff --git a/chromeos/crosapi/mojom/BUILD.gn b/chromeos/crosapi/mojom/BUILD.gn index 2c6f03907799a5..d4353949a7a2a8 100644 --- a/chromeos/crosapi/mojom/BUILD.gn +++ b/chromeos/crosapi/mojom/BUILD.gn @@ -64,6 +64,7 @@ mojom("mojom") { "networking_attributes.mojom", "networking_private.mojom", "notification.mojom", + "nullable_primitives.mojom", "policy_namespace.mojom", "policy_service.mojom", "power.mojom", diff --git a/chromeos/crosapi/mojom/nullable_primitives.mojom b/chromeos/crosapi/mojom/nullable_primitives.mojom new file mode 100644 index 00000000000000..5fe72d4f47ea55 --- /dev/null +++ b/chromeos/crosapi/mojom/nullable_primitives.mojom @@ -0,0 +1,38 @@ +// Copyright 2022 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +module crosapi.mojom; + +// Primitive numeric types cannot be optional in Mojom. +// We therefore wrap them in structs here which can be used for optional values. + +[Stable, RenamedFrom="ash.health.mojom.DoubleValue"] +struct DoubleValue { + // The value of the double. + double value@0; +}; + +[Stable, RenamedFrom="ash.health.mojom.Int64Value"] +struct Int64Value { + // The value of the int64. + int64 value@0; +}; + +[Stable, RenamedFrom="ash.health.mojom.UInt32Value"] +struct UInt32Value { + // The value of the uint32. + uint32 value@0; +}; + +[Stable, RenamedFrom="ash.health.mojom.UInt64Value"] +struct UInt64Value { + // The value of the uint64. + uint64 value@0; +}; + +[Stable, RenamedFrom="ash.health.mojom.BoolValue"] +struct BoolValue { + // The value of the bool. + bool value@0; +}; diff --git a/chromeos/crosapi/mojom/probe_service.mojom b/chromeos/crosapi/mojom/probe_service.mojom index 86c398792f74df..32d38c8e7c9556 100644 --- a/chromeos/crosapi/mojom/probe_service.mojom +++ b/chromeos/crosapi/mojom/probe_service.mojom @@ -13,40 +13,41 @@ // (third-party telemetry extensions). // The subset is not as is but has the following differences: -// 1) Introduce DoubleValue, Int64Value, UInt32Value, UInt64Value structs -// since numeric primitives are not nullable in Mojo. -// 2) Make all fields in the following structures optional in case we want to +// 1) Make all fields in the following structures optional in case we want to // filter them out later: -// - NonRemovableBlockDeviceInfo -// - CpuCStateInfo -// - LogicalCpuInfo -// - PhysicalCpuInfo -// - CpuInfo -// - TimezoneInfo -// - MemoryInfo -// - BacklightInfo -// - FanInfo -// - StatefulPartitionInfo -// - BluetoothAdapterInfo -// 3) NonRemovableBlockDeviceInfo: -// 3.1) use uint32 to store manufacturer_id instead of uint8 in case we +// - ProbeNonRemovableBlockDeviceInfo +// - ProbeCpuCStateInfo +// - ProbeLogicalCpuInfo +// - ProbePhysicalCpuInfo +// - ProbeCpuInfo +// - ProbeTimezoneInfo +// - ProbeMemoryInfo +// - ProbeBacklightInfo +// - ProbeFanInfo +// - ProbeStatefulPartitionInfo +// - ProbeBluetoothAdapterInfo +// 2) ProbeNonRemovableBlockDeviceInfo: +// 2.1) use uint32 to store manufacturer_id instead of uint8 in case we // want to extend manufacturer range. -// 3.2) use string to store serial in a decimal numeral system instead +// 2.2) use string to store serial in a decimal numeral system instead // of uint32 in case we want to extend serial number range. -// 4) LogicalCpuInfo: -// 4.1) rename idle_time_user_hz to idle_time_ms and use milliseconds +// 3) ProbeLogicalCpuInfo: +// 3.1) rename idle_time_user_hz to idle_time_ms and use milliseconds // instead of USER_HZ units, because USER_HZ system constant is not // available in the web. -// 4.2) use uint64 to store idle_time_ms instead of uint32, idle_time_ms +// 3.2) use uint64 to store idle_time_ms instead of uint32, idle_time_ms // can easily be more than uint32 range. -// 5) MemoryInfo: use uint64 to store page_faults_since_last_boot instead of -// uint32, it can be more than uint32 range. +// 4) ProbeMemoryInfo: use uint64 to store page_faults_since_last_boot instead +// of uint32, it can be more than uint32 range. -module ash.health.mojom; +module crosapi.mojom; + +import "chromeos/crosapi/mojom/nullable_primitives.mojom"; // Interface for getting device telemetry information. Implemented in // ash-chrome. -[Stable, Uuid="f3dbbe3b-a810-43a9-889e-b130b4f94869"] +[Stable, Uuid="f3dbbe3b-a810-43a9-889e-b130b4f94869", +RenamedFrom="ash.health.mojom.ProbeService"] interface ProbeService { // Returns telemetry information for the desired categories. // @@ -59,19 +60,19 @@ interface ProbeService { // the fields corresponding to the requested categories // will be non-null. ProbeTelemetryInfo@0(array categories) - => (TelemetryInfo telemetry_info); + => (ProbeTelemetryInfo telemetry_info); // Returns OEM data. // // The response: // * |oem_data| - OEM data. - GetOemData@1() => (OemData oem_data); + GetOemData@1() => (ProbeOemData oem_data); }; // An enumeration of each category of information that cros_healthd can report. // // Next ID: 12 -[Stable, Extensible] +[Stable, Extensible, RenamedFrom="ash.health.mojom.ProbeCategoryEnum"] enum ProbeCategoryEnum { [Default] kUnknown = 11, kBattery = 0, @@ -91,8 +92,8 @@ enum ProbeCategoryEnum { // probing telemetry information. // // Next ID: 5 -[Stable, Extensible] -enum ErrorType { +[Stable, Extensible, RenamedFrom="ash.health.mojom.ErrorType"] +enum ProbeErrorType { // Default value. [Default] kUnknown = 4, // An error reading a system file. @@ -108,60 +109,20 @@ enum ErrorType { // Structure that contains error information for a telemetry probe. // // Next ID: 2 -[Stable] +[Stable, RenamedFrom="ash.health.mojom.ProbeError"] struct ProbeError { // The type of error that occurred. - ErrorType type@0; + ProbeErrorType type@0; // A debug message with more information about the error. This string is not // intended to be shown to the user. string msg@1; }; -// Optional double field. Since primitives numeric types cannot be optional, -// wrap double in a struct that can be nulled. -[Stable] -struct DoubleValue { - // The value of the double. - double value@0; -}; - -// Optional int64 field. Since primitives numeric types cannot be optional, -// wrap int64 in a struct that can be nulled. -[Stable] -struct Int64Value { - // The value of the int64. - int64 value@0; -}; - -// Optional uint32 field. Since primitives numeric types cannot be optional, -// wrap uint32 in a struct that can be nulled. -[Stable] -struct UInt32Value { - // The value of the uint32. - uint32 value@0; -}; - -// Optional uint64 field. Since primitives numeric types cannot be optional, -// wrap uint64 in a struct that can be nulled. -[Stable] -struct UInt64Value { - // The value of the uint64. - uint64 value@0; -}; - -// Optional bool field. Since primitives numeric types cannot be optional, -// wrap bool in a struct that can be nulled. -[Stable] -struct BoolValue { - // The value of the bool. - bool value@0; -}; - // Information related to the main battery. // // Next ID: 14 -[Stable] -struct BatteryInfo { +[Stable, RenamedFrom="ash.health.mojom.BatteryInfo"] +struct ProbeBatteryInfo { // Cycle count. Int64Value? cycle_count@0; // Current battery voltage (V) @@ -198,10 +159,10 @@ struct BatteryInfo { // Battery probe result. Can either be populated with the BatteryInfo or an // error retrieving the information. -[Stable] -union BatteryResult { +[Stable, RenamedFrom="ash.health.mojom.BatteryResult"] +union ProbeBatteryResult { // Valid BatteryInfo. Null value if a battery is not present. - BatteryInfo? battery_info; + ProbeBatteryInfo? battery_info; // The error that occurred attempting to retrieve the BatteryInfo. ProbeError error; }; @@ -209,8 +170,8 @@ union BatteryResult { // Information related to a specific non-removable block device. // // Next ID: 12 -[Stable] -struct NonRemovableBlockDeviceInfo { +[Stable, RenamedFrom="ash.health.mojom.NonRemovableBlockDeviceInfo"] +struct ProbeNonRemovableBlockDeviceInfo { // The path of this storage on the system. It is useful if caller needs to // correlate with other information. string? path@0; @@ -244,10 +205,10 @@ struct NonRemovableBlockDeviceInfo { // Non-removable block device probe result. Can either be populated with the // NonRemovableBlockDeviceInfo or an error retrieving the information. -[Stable] -union NonRemovableBlockDeviceResult { +[Stable, RenamedFrom="ash.health.mojom.NonRemovableBlockDeviceResult"] +union ProbeNonRemovableBlockDeviceResult { // Valid NonRemovableBlockDeviceInfo. - array block_device_info; + array block_device_info; // The error that occurred attempting to retrieve the // NonRemovableBlockDeviceInfo. ProbeError error; @@ -256,8 +217,8 @@ union NonRemovableBlockDeviceResult { // Cached VPD read from sysfs. // // Next ID: 4 -[Stable] -struct CachedVpdInfo { +[Stable, RenamedFrom="ash.health.mojom.CachedVpdInfo"] +struct ProbeCachedVpdInfo { // Contents of /sys/firmware/vpd/rw/ActivateDate, if the device supports it. string? first_power_date@0; // Contents of /sys/firmware/vpd/ro/sku_number, if the device supports it. @@ -270,10 +231,10 @@ struct CachedVpdInfo { // Cached VPD probe result. Can either be populated with the CachedVpdInfo or an // error retrieving the information. -[Stable] -union CachedVpdResult { +[Stable, RenamedFrom="ash.health.mojom.CachedVpdResult"] +union ProbeCachedVpdResult { // Valid CachedVpdInfo. - CachedVpdInfo vpd_info; + ProbeCachedVpdInfo vpd_info; // The error that occurred attempting to retrieve the CachedVpdInfo. ProbeError error; }; @@ -281,8 +242,8 @@ union CachedVpdResult { // Information about a CPU's C-states. // // Next ID: 2 -[Stable] -struct CpuCStateInfo { +[Stable, RenamedFrom="ash.health.mojom.CpuCStateInfo"] +struct ProbeCpuCStateInfo { // Name of the state. string? name@0; // Time spent in the state since the last reboot, in microseconds. @@ -292,8 +253,8 @@ struct CpuCStateInfo { // Information related to a particular logical CPU. // // Next ID: 5 -[Stable] -struct LogicalCpuInfo { +[Stable, RenamedFrom="ash.health.mojom.LogicalCpuInfo"] +struct ProbeLogicalCpuInfo { // The max CPU clock speed in kHz. UInt32Value? max_clock_speed_khz@0; // Maximum frequency the CPU is allowed to run at, by policy. @@ -303,25 +264,25 @@ struct LogicalCpuInfo { // Idle time since last boot, in milliseconds. UInt64Value? idle_time_ms@3; // Information about the logical CPU's time in various C-states. - array c_states@4; + array c_states@4; }; // Information related to a particular physical CPU. // // Next ID: 2 -[Stable] -struct PhysicalCpuInfo { +[Stable, RenamedFrom="ash.health.mojom.PhysicalCpuInfo"] +struct ProbePhysicalCpuInfo { // The CPU model name. string? model_name@0; // Logical CPUs corresponding to this physical CPU. - array logical_cpus@1; + array logical_cpus@1; }; // An enumeration of CPU architectures. // // Next ID: 4 -[Stable, Extensible] -enum CpuArchitectureEnum { +[Stable, Extensible, RenamedFrom="ash.health.mojom.CpuArchitectureEnum"] +enum ProbeCpuArchitectureEnum { [Default] kUnknown = 3, kX86_64 = 0, kAArch64 = 1, @@ -331,23 +292,23 @@ enum CpuArchitectureEnum { // Information about the device's CPUs. // // Next ID: 3 -[Stable] -struct CpuInfo { +[Stable, RenamedFrom="ash.health.mojom.CpuInfo"] +struct ProbeCpuInfo { // Number of total threads available. UInt32Value? num_total_threads@0; // The CPU architecture - it's assumed all of a device's CPUs share an // architecture. - CpuArchitectureEnum architecture@1; + ProbeCpuArchitectureEnum architecture@1; // Information about the device's physical CPUs. - array physical_cpus@2; + array physical_cpus@2; }; // CPU probe result. Can either be populated with the CpuInfo or an error // retrieving the information. -[Stable] -union CpuResult { +[Stable, RenamedFrom="ash.health.mojom.CpuResult"] +union ProbeCpuResult { // Valid CpuInfo. - CpuInfo cpu_info; + ProbeCpuInfo cpu_info; // The error that occurred attempting to retrieve the CpuInfo. ProbeError error; }; @@ -355,8 +316,8 @@ union CpuResult { // Timezone information. // // Next ID: 2 -[Stable] -struct TimezoneInfo { +[Stable, RenamedFrom="ash.health.mojom.TimezoneInfo"] +struct ProbeTimezoneInfo { // The timezone of the device in POSIX standard. string? posix@0; // The timezone region of the device. @@ -365,10 +326,10 @@ struct TimezoneInfo { // Timezone probe result. Can either be populated with the TimezoneInfo or an // error retrieving the information. -[Stable] -union TimezoneResult { +[Stable, RenamedFrom="ash.health.mojom.TimezoneResult"] +union ProbeTimezoneResult { // Valid TimezoneInfo. - TimezoneInfo timezone_info; + ProbeTimezoneInfo timezone_info; // The error that occurred attempting to retrieve the TimezoneInfo. ProbeError error; }; @@ -376,8 +337,8 @@ union TimezoneResult { // Memory information. // // Next ID: 4 -[Stable] -struct MemoryInfo { +[Stable, RenamedFrom="ash.health.mojom.MemoryInfo"] +struct ProbeMemoryInfo { // Total memory, in KiB. UInt32Value? total_memory_kib@0; // Free memory, in KiB. @@ -390,10 +351,10 @@ struct MemoryInfo { // Memory probe result. Can either be populated with the MemoryInfo or an // error retrieving the information. -[Stable] -union MemoryResult { +[Stable, RenamedFrom="ash.health.mojom.MemoryResult"] +union ProbeMemoryResult { // Valid MemoryInfo. - MemoryInfo memory_info; + ProbeMemoryInfo memory_info; // The error that occurred attempting to retrieve the MemoryInfo. ProbeError error; }; @@ -401,8 +362,8 @@ union MemoryResult { // Backlight information. // // Next ID: 3 -[Stable] -struct BacklightInfo { +[Stable, RenamedFrom="ash.health.mojom.BacklightInfo"] +struct ProbeBacklightInfo { // Path to this backlight on the system. Useful if the caller needs to // correlate with other information. string? path@0; @@ -414,27 +375,27 @@ struct BacklightInfo { // Backlight probe result. Can either be populated with the BacklightInfo or an // error retrieving the information. -[Stable] -union BacklightResult { +[Stable, RenamedFrom="ash.health.mojom.BacklightResult"] +union ProbeBacklightResult { // Valid BacklightInfo. - array backlight_info; + array backlight_info; // The error that occurred attempting to retrieve the BacklightInfo. ProbeError error; }; // Fan information. -[Stable] -struct FanInfo { +[Stable, RenamedFrom="ash.health.mojom.FanInfo"] +struct ProbeFanInfo { // Fan speed in RPM. UInt32Value? speed_rpm@0; }; // Fan probe result. Can either be populated with the FanInfo or an error // retrieving the information. -[Stable] -union FanResult { +[Stable, RenamedFrom="ash.health.mojom.FanResult"] +union ProbeFanResult { // A list of valid FanInfo. - array fan_info; + array fan_info; // The error that occurred attempting to retrieve the FanInfo. ProbeError error; }; @@ -442,8 +403,8 @@ union FanResult { // Stateful partition info // // Next ID: 2 -[Stable] -struct StatefulPartitionInfo { +[Stable, RenamedFrom="ash.health.mojom.StatefulPartitionInfo"] +struct ProbeStatefulPartitionInfo { // Available space for user data storage in the device in bytes. Rounded down // to multiples of 100MiB (100 * 1024 * 1024 bytes). UInt64Value? available_space@0; @@ -453,10 +414,10 @@ struct StatefulPartitionInfo { // Stateful partition probe result. Can either be populated with a valid // StatefulPartitionInfo or an error retrieving the information. -[Stable] -union StatefulPartitionResult { +[Stable, RenamedFrom="ash.health.mojom.StatefulPartitionResult"] +union ProbeStatefulPartitionResult { // A valid StatefulPartitionInfo. - StatefulPartitionInfo partition_info; + ProbeStatefulPartitionInfo partition_info; // The error that occurred attempting to retrieve the StatefulPartitionInfo. ProbeError error; }; @@ -464,8 +425,8 @@ union StatefulPartitionResult { // Information related to one of a device's Bluetooth adapters. // // Next ID: 4 -[Stable] -struct BluetoothAdapterInfo { +[Stable, RenamedFrom="ash.health.mojom.BluetoothAdapterInfo"] +struct ProbeBluetoothAdapterInfo { // The name of the adapter. string? name@0; // The MAC address of the adapter. @@ -478,10 +439,10 @@ struct BluetoothAdapterInfo { // Bluetooth probe result. Can either be populated with the BluetoothAdapterInfo // or an error retrieving the information. -[Stable] -union BluetoothResult { +[Stable, RenamedFrom="ash.health.mojom.BluetoothResult"] +union ProbeBluetoothResult { // Valid BluetoothAdapterInfo. - array bluetooth_adapter_info; + array bluetooth_adapter_info; // The error that occurred attempting to retrieve the BluetoothAdapterInfo. ProbeError error; }; @@ -489,8 +450,8 @@ union BluetoothResult { // OS Version information. // This structure decomposes a full version string // (e.g. "87.13544.59.0") into its parts. -[Stable] -struct OsVersion { +[Stable, RenamedFrom="ash.health.mojom.OsVersion"] +struct ProbeOsVersion { // The OS version release milestone (e.g. "87"). string? release_milestone@0; // The OS version build number (e.g. "13544"). @@ -502,27 +463,27 @@ struct OsVersion { }; // The OS information. -[Stable] -struct OsInfo { +[Stable, RenamedFrom="ash.health.mojom.OsInfo"] +struct ProbeOsInfo { // Contents of CrosConfig in /branding/oem-name. string? oem_name@0; // OS Version information. - [MinVersion=1] OsVersion? os_version@1; + [MinVersion=1] ProbeOsVersion? os_version@1; }; // System Information. -[Stable] -struct SystemInfo { +[Stable, RenamedFrom="ash.health.mojom.SystemInfo"] +struct ProbeSystemInfo { // The info related to the OS. - OsInfo os_info@0; + ProbeOsInfo os_info@0; }; // System probe result. Can either be populated with the SystemInfo or an // error retrieving the information. -[Stable] -union SystemResult { +[Stable, RenamedFrom="ash.health.mojom.SystemResult"] +union ProbeSystemResult { // Valid SystemInfo. - SystemInfo system_info; + ProbeSystemInfo system_info; // The error that occurred attempting to retrieve SystemInfo. ProbeError error; }; @@ -536,47 +497,47 @@ union SystemResult { // to fetch that information, but was unable to. // // Next ID: 11 -[Stable] -struct TelemetryInfo { +[Stable, RenamedFrom="ash.health.mojom.TelemetryInfo"] +struct ProbeTelemetryInfo { // Information about the device's main battery. Only present when kBattery was // included in the categories input to ProbeTelemetryInfo. - BatteryResult? battery_result@0; + ProbeBatteryResult? battery_result@0; // Information about all of the device's non-removable block devices. Only // present when kNonRemovableBlockDevices was included in the categories input // to ProbeTelemetryInfo. - NonRemovableBlockDeviceResult? block_device_result@1; + ProbeNonRemovableBlockDeviceResult? block_device_result@1; // Only present when kCachedVpdData was included in the categories input to // ProbeTelemetryInfo. - CachedVpdResult? vpd_result@2; + ProbeCachedVpdResult? vpd_result@2; // Information about each of the device's CPUs. Only present when kCpu was // included in the categories input to ProbeTelemetryInfo. - CpuResult? cpu_result@3; + ProbeCpuResult? cpu_result@3; // Information about the device's timezone. Only present when kTimezone was // included in the categories input to ProbeTelemetryInfo. - TimezoneResult? timezone_result@4; + ProbeTimezoneResult? timezone_result@4; // Information about the system's memory. Only present when kMemory was // included in the categories input to ProbeTelemetryInfo. - MemoryResult? memory_result@5; + ProbeMemoryResult? memory_result@5; // Information about all of the device's backlights. Only present when // kBacklight was included in the categories input to ProbeTelemetryInfo. - BacklightResult? backlight_result@6; + ProbeBacklightResult? backlight_result@6; // Information about each of the device's fans. Only present when kFan was // included in the categories input to ProbeTelemetryInfo. - FanResult? fan_result@7; + ProbeFanResult? fan_result@7; // Information about the stateful partition. Only present when // kStatefulPartition was included in the categories input to // ProbeTelemetryInfo. - StatefulPartitionResult? stateful_partition_result@8; + ProbeStatefulPartitionResult? stateful_partition_result@8; // Information about the device's Bluetooth adapters and devices. Only present // when kBluetooth was included in the categories input to ProbeTelemetryInfo. - BluetoothResult? bluetooth_result@9; + ProbeBluetoothResult? bluetooth_result@9; // Information about the system. Only present when kSystem was included in // the categories input to ProbeTelemetryInfo. - SystemResult? system_result@10; + ProbeSystemResult? system_result@10; }; // Result of running /usr/share/cros/oemdata.sh script. -[Stable] -struct OemData { +[Stable, RenamedFrom="ash.health.mojom.OemData"] +struct ProbeOemData { string? oem_data@0; };