Commit 4dd4d4a2 authored by Oleh Lamzin's avatar Oleh Lamzin Committed by Commit Bot

[Telemetry SWX] Do not compare field by field in tests

Do not compare field by field in tests to not forget testing new field
in the future.

Bug: b:158658869
Change-Id: I46225a1b3601bd0d7f0cf7026e246eeffb745a95
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2274891
Commit-Queue: Oleh Lamzin <lamzin@google.com>
Reviewed-by: default avatarMahmoud Gawad <mgawad@google.com>
Reviewed-by: default avatarRoland Bock <rbock@google.com>
Cr-Commit-Position: refs/heads/master@{#786478}
parent 85bee24d
...@@ -17,6 +17,12 @@ using testing::ElementsAre; ...@@ -17,6 +17,12 @@ using testing::ElementsAre;
namespace chromeos { namespace chromeos {
namespace probe_service_converters { namespace probe_service_converters {
// 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.
TEST(ProbeServiceConvertors, ConvertCategoryVector) { TEST(ProbeServiceConvertors, ConvertCategoryVector) {
const std::vector<health::mojom::ProbeCategoryEnum> kInput{ const std::vector<health::mojom::ProbeCategoryEnum> kInput{
health::mojom::ProbeCategoryEnum::kBattery, health::mojom::ProbeCategoryEnum::kBattery,
...@@ -111,29 +117,26 @@ TEST(ProbeServiceConvertors, BatteryInfoPtr) { ...@@ -111,29 +117,26 @@ TEST(ProbeServiceConvertors, BatteryInfoPtr) {
constexpr char kManufactureDate[] = "2018-10-01"; constexpr char kManufactureDate[] = "2018-10-01";
constexpr uint64_t kTemperature = 3097; constexpr uint64_t kTemperature = 3097;
// Here we don't use cros_healthd::mojom::BatteryInfo::New because BatteryInfo auto input = cros_healthd::mojom::BatteryInfo::New();
// may contain some fields that we don't use yet. {
auto battery_info = cros_healthd::mojom::BatteryInfo::New(); input->cycle_count = kCycleCount;
battery_info->cycle_count = kCycleCount; input->voltage_now = kVoltageNow;
battery_info->voltage_now = kVoltageNow; input->vendor = kVendor;
battery_info->vendor = kVendor; input->serial_number = kSerialNumber;
battery_info->serial_number = kSerialNumber; input->charge_full_design = kChargeFullDesign;
battery_info->charge_full_design = kChargeFullDesign; input->charge_full = kChargeFull;
battery_info->charge_full = kChargeFull; input->voltage_min_design = kVoltageMinDesign;
battery_info->voltage_min_design = kVoltageMinDesign; input->model_name = kModelName;
battery_info->model_name = kModelName; input->charge_now = kChargeNow;
battery_info->charge_now = kChargeNow; input->current_now = kCurrentNow;
battery_info->current_now = kCurrentNow; input->technology = kTechnology;
battery_info->technology = kTechnology; input->status = kStatus;
battery_info->status = kStatus; input->manufacture_date = kManufactureDate;
battery_info->manufacture_date = kManufactureDate; input->temperature = cros_healthd::mojom::UInt64Value::New(kTemperature);
battery_info->temperature = }
cros_healthd::mojom::UInt64Value::New(kTemperature);
// Here we intentionaly use health::mojom::BatteryInfo::New not to
// forget to test new fields.
EXPECT_EQ( EXPECT_EQ(
ConvertPtr(battery_info.Clone()), ConvertPtr(std::move(input)),
health::mojom::BatteryInfo::New( health::mojom::BatteryInfo::New(
health::mojom::Int64Value::New(kCycleCount), health::mojom::Int64Value::New(kCycleCount),
health::mojom::DoubleValue::New(kVoltageNow), kVendor, kSerialNumber, health::mojom::DoubleValue::New(kVoltageNow), kVendor, kSerialNumber,
...@@ -173,29 +176,25 @@ TEST(ProbeServiceConvertors, NonRemovableBlockDeviceInfoPtr) { ...@@ -173,29 +176,25 @@ TEST(ProbeServiceConvertors, NonRemovableBlockDeviceInfoPtr) {
constexpr uint64_t kIoTimeSecondsSinceLastBoot = 100000; constexpr uint64_t kIoTimeSecondsSinceLastBoot = 100000;
constexpr uint64_t kDiscardTimeSecondsSinceLastBoot = 1000000; constexpr uint64_t kDiscardTimeSecondsSinceLastBoot = 1000000;
// Here we don't use cros_healthd::mojom::NonRemovableBlockDeviceInfo::New auto input = cros_healthd::mojom::NonRemovableBlockDeviceInfo::New();
// because NonRemovableBlockDeviceInfo may contain some fields that we {
// don't use yet. input->path = kPath;
auto info = cros_healthd::mojom::NonRemovableBlockDeviceInfo::New(); input->size = kSize;
input->type = kType;
info->path = kPath; input->manufacturer_id = kManufacturerId;
info->size = kSize; input->name = kName;
info->type = kType; input->serial = kSerial;
info->manufacturer_id = kManufacturerId; input->bytes_read_since_last_boot = kBytesReadSinceLastBoot;
info->name = kName; input->bytes_written_since_last_boot = kBytesWrittenSinceLastBoot;
info->serial = kSerial; input->read_time_seconds_since_last_boot = kReadTimeSecondsSinceLastBoot;
info->bytes_read_since_last_boot = kBytesReadSinceLastBoot; input->write_time_seconds_since_last_boot = kWriteTimeSecondsSinceLastBoot;
info->bytes_written_since_last_boot = kBytesWrittenSinceLastBoot; input->io_time_seconds_since_last_boot = kIoTimeSecondsSinceLastBoot;
info->read_time_seconds_since_last_boot = kReadTimeSecondsSinceLastBoot; input->discard_time_seconds_since_last_boot =
info->write_time_seconds_since_last_boot = kWriteTimeSecondsSinceLastBoot;
info->io_time_seconds_since_last_boot = kIoTimeSecondsSinceLastBoot;
info->discard_time_seconds_since_last_boot =
cros_healthd::mojom::UInt64Value::New(kDiscardTimeSecondsSinceLastBoot); cros_healthd::mojom::UInt64Value::New(kDiscardTimeSecondsSinceLastBoot);
}
// Here we intentionaly use health::mojom::NonRemovableBlockDeviceInfo::New
// not to forget to test new fields.
EXPECT_EQ( EXPECT_EQ(
ConvertPtr(info.Clone()), ConvertPtr(std::move(input)),
health::mojom::NonRemovableBlockDeviceInfo::New( health::mojom::NonRemovableBlockDeviceInfo::New(
kPath, health::mojom::UInt64Value::New(kSize), kType, kPath, health::mojom::UInt64Value::New(kSize), kType,
health::mojom::UInt32Value::New(kManufacturerId), kName, health::mojom::UInt32Value::New(kManufacturerId), kName,
...@@ -275,11 +274,10 @@ TEST(ProbeServiceConvertors, CpuCStateInfoPtr) { ...@@ -275,11 +274,10 @@ TEST(ProbeServiceConvertors, CpuCStateInfoPtr) {
input->time_in_state_since_last_boot_us = kTimeInStateSinceLastBootUs; input->time_in_state_since_last_boot_us = kTimeInStateSinceLastBootUs;
} }
const auto output = ConvertPtr(std::move(input)); EXPECT_EQ(
ASSERT_TRUE(output); ConvertPtr(std::move(input)),
EXPECT_EQ(output->name, kName); health::mojom::CpuCStateInfo::New(
EXPECT_EQ(output->time_in_state_since_last_boot_us, kName, health::mojom::UInt64Value::New(kTimeInStateSinceLastBootUs)));
health::mojom::UInt64Value::New(kTimeInStateSinceLastBootUs));
} }
TEST(ProbeServiceConvertors, LogicalCpuInfoPtr) { TEST(ProbeServiceConvertors, LogicalCpuInfoPtr) {
...@@ -289,11 +287,13 @@ TEST(ProbeServiceConvertors, LogicalCpuInfoPtr) { ...@@ -289,11 +287,13 @@ TEST(ProbeServiceConvertors, LogicalCpuInfoPtr) {
constexpr uint32_t kIdleTimeUserHz = 1000000; constexpr uint32_t kIdleTimeUserHz = 1000000;
constexpr char kCpuCStateName[] = "C1"; constexpr char kCpuCStateName[] = "C1";
constexpr uint64_t kCpuCStateTime = 9999999999999;
auto input = cros_healthd::mojom::LogicalCpuInfo::New(); auto input = cros_healthd::mojom::LogicalCpuInfo::New();
{ {
auto c_state = cros_healthd::mojom::CpuCStateInfo::New(); auto c_state = cros_healthd::mojom::CpuCStateInfo::New();
c_state->name = kCpuCStateName; c_state->name = kCpuCStateName;
c_state->time_in_state_since_last_boot_us = kCpuCStateTime;
input->max_clock_speed_khz = kMaxClockSpeedKhz; input->max_clock_speed_khz = kMaxClockSpeedKhz;
input->scaling_max_frequency_khz = kScalingMaxFrequencyKhz; input->scaling_max_frequency_khz = kScalingMaxFrequencyKhz;
...@@ -302,41 +302,50 @@ TEST(ProbeServiceConvertors, LogicalCpuInfoPtr) { ...@@ -302,41 +302,50 @@ TEST(ProbeServiceConvertors, LogicalCpuInfoPtr) {
input->c_states.push_back(std::move(c_state)); input->c_states.push_back(std::move(c_state));
} }
const auto output = ConvertPtr(std::move(input)); std::vector<health::mojom::CpuCStateInfoPtr> expected_c_states;
ASSERT_TRUE(output); expected_c_states.push_back(health::mojom::CpuCStateInfo::New(
EXPECT_EQ(output->max_clock_speed_khz, kCpuCStateName, health::mojom::UInt64Value::New(kCpuCStateTime)));
health::mojom::UInt32Value::New(kMaxClockSpeedKhz));
EXPECT_EQ(output->scaling_max_frequency_khz, EXPECT_EQ(ConvertPtr(std::move(input)),
health::mojom::UInt32Value::New(kScalingMaxFrequencyKhz)); health::mojom::LogicalCpuInfo::New(
EXPECT_EQ(output->scaling_current_frequency_khz, health::mojom::UInt32Value::New(kMaxClockSpeedKhz),
health::mojom::UInt32Value::New(kScalingCurrentFrequencyKhz)); health::mojom::UInt32Value::New(kScalingMaxFrequencyKhz),
EXPECT_EQ(output->idle_time_user, health::mojom::UInt32Value::New(kScalingCurrentFrequencyKhz),
health::mojom::UInt64Value::New(kIdleTimeUserHz)); health::mojom::UInt64Value::New(kIdleTimeUserHz),
ASSERT_EQ(output->c_states.size(), 1ULL); std::move(expected_c_states)));
ASSERT_TRUE(output->c_states[0]);
EXPECT_EQ(output->c_states[0]->name, kCpuCStateName);
} }
TEST(ProbeServiceConvertors, PhysicalCpuInfoPtr) { TEST(ProbeServiceConvertors, PhysicalCpuInfoPtr) {
constexpr char kModelName[] = "i9"; constexpr char kModelName[] = "i9";
constexpr uint32_t kMaxClockSpeedKhz = 1000;
constexpr uint32_t kMaxClockSpeedKhz = 9000;
constexpr uint32_t kScalingMaxFrequencyKhz = 90000;
constexpr uint32_t kScalingCurrentFrequencyKhz = 900000;
constexpr uint32_t kIdleTimeUserHz = 9000000;
auto input = cros_healthd::mojom::PhysicalCpuInfo::New(); auto input = cros_healthd::mojom::PhysicalCpuInfo::New();
{ {
auto logical_info = cros_healthd::mojom::LogicalCpuInfo::New(); auto logical_info = cros_healthd::mojom::LogicalCpuInfo::New();
logical_info->max_clock_speed_khz = kMaxClockSpeedKhz; logical_info->max_clock_speed_khz = kMaxClockSpeedKhz;
logical_info->scaling_max_frequency_khz = kScalingMaxFrequencyKhz;
logical_info->scaling_current_frequency_khz = kScalingCurrentFrequencyKhz;
logical_info->idle_time_user_hz = kIdleTimeUserHz;
input->model_name = kModelName; input->model_name = kModelName;
input->logical_cpus.push_back(std::move(logical_info)); input->logical_cpus.push_back(std::move(logical_info));
} }
const auto output = ConvertPtr(std::move(input)); std::vector<health::mojom::LogicalCpuInfoPtr> expected_infos;
ASSERT_TRUE(output); expected_infos.push_back(health::mojom::LogicalCpuInfo::New(
ASSERT_EQ(output->model_name, kModelName); health::mojom::UInt32Value::New(kMaxClockSpeedKhz),
ASSERT_EQ(output->logical_cpus.size(), 1ULL); health::mojom::UInt32Value::New(kScalingMaxFrequencyKhz),
ASSERT_TRUE(output->logical_cpus[0]); health::mojom::UInt32Value::New(kScalingCurrentFrequencyKhz),
EXPECT_EQ(output->logical_cpus[0]->max_clock_speed_khz, health::mojom::UInt64Value::New(kIdleTimeUserHz),
health::mojom::UInt32Value::New(kMaxClockSpeedKhz)); std::vector<health::mojom::CpuCStateInfoPtr>{}));
EXPECT_EQ(ConvertPtr(std::move(input)),
health::mojom::PhysicalCpuInfo::New(kModelName,
std::move(expected_infos)));
} }
TEST(ProbeServiceConvertors, CpuArchitectureEnum) { TEST(ProbeServiceConvertors, CpuArchitectureEnum) {
...@@ -360,16 +369,19 @@ TEST(ProbeServiceConvertors, CpuInfoPtr) { ...@@ -360,16 +369,19 @@ TEST(ProbeServiceConvertors, CpuInfoPtr) {
physical_info->model_name = kModelName; physical_info->model_name = kModelName;
input->num_total_threads = kNumTotalThreads; input->num_total_threads = kNumTotalThreads;
input->architecture = cros_healthd::mojom::CpuArchitectureEnum::kArmv7l;
input->physical_cpus.push_back(std::move(physical_info)); input->physical_cpus.push_back(std::move(physical_info));
} }
const auto output = ConvertPtr(std::move(input)); std::vector<health::mojom::PhysicalCpuInfoPtr> expected_infos;
ASSERT_TRUE(output); expected_infos.push_back(health::mojom::PhysicalCpuInfo::New(
ASSERT_EQ(output->num_total_threads, kModelName, std::vector<health::mojom::LogicalCpuInfoPtr>{}));
health::mojom::UInt32Value::New(kNumTotalThreads));
ASSERT_EQ(output->physical_cpus.size(), 1ULL); EXPECT_EQ(ConvertPtr(std::move(input)),
ASSERT_TRUE(output->physical_cpus[0]); health::mojom::CpuInfo::New(
EXPECT_EQ(output->physical_cpus[0]->model_name, kModelName); health::mojom::UInt32Value::New(kNumTotalThreads),
health::mojom::CpuArchitectureEnum::kArmv7l,
std::move(expected_infos)));
} }
TEST(ProbeServiceConvertors, CpuResultPtrInfo) { TEST(ProbeServiceConvertors, CpuResultPtrInfo) {
...@@ -394,10 +406,8 @@ TEST(ProbeServiceConvertors, TimezoneInfoPtr) { ...@@ -394,10 +406,8 @@ TEST(ProbeServiceConvertors, TimezoneInfoPtr) {
input->posix = kPosix; input->posix = kPosix;
input->region = kRegion; input->region = kRegion;
const auto output = ConvertPtr(std::move(input)); EXPECT_EQ(ConvertPtr(std::move(input)),
ASSERT_TRUE(output); health::mojom::TimezoneInfo::New(kPosix, kRegion));
EXPECT_EQ(output->posix, kPosix);
EXPECT_EQ(output->region, kRegion);
} }
TEST(ProbeServiceConvertors, TimezoneResultPtrInfo) { TEST(ProbeServiceConvertors, TimezoneResultPtrInfo) {
...@@ -426,16 +436,12 @@ TEST(ProbeServiceConvertors, MemoryInfoPtr) { ...@@ -426,16 +436,12 @@ TEST(ProbeServiceConvertors, MemoryInfoPtr) {
input->available_memory_kib = kAvailableMemoryKib; input->available_memory_kib = kAvailableMemoryKib;
input->page_faults_since_last_boot = kPageFaultsSinceLastBoot; input->page_faults_since_last_boot = kPageFaultsSinceLastBoot;
const auto output = ConvertPtr(std::move(input)); EXPECT_EQ(ConvertPtr(std::move(input)),
ASSERT_TRUE(output); health::mojom::MemoryInfo::New(
EXPECT_EQ(output->total_memory_kib, health::mojom::UInt32Value::New(kTotalMemoryKib),
health::mojom::UInt32Value::New(kTotalMemoryKib)); health::mojom::UInt32Value::New(kFreeMemoryKib),
EXPECT_EQ(output->free_memory_kib, health::mojom::UInt32Value::New(kAvailableMemoryKib),
health::mojom::UInt32Value::New(kFreeMemoryKib)); health::mojom::UInt64Value::New(kPageFaultsSinceLastBoot)));
EXPECT_EQ(output->available_memory_kib,
health::mojom::UInt32Value::New(kAvailableMemoryKib));
EXPECT_EQ(output->page_faults_since_last_boot,
health::mojom::UInt64Value::New(kPageFaultsSinceLastBoot));
} }
TEST(ProbeServiceConvertors, MemoryResultPtrInfo) { TEST(ProbeServiceConvertors, MemoryResultPtrInfo) {
...@@ -462,12 +468,10 @@ TEST(ProbeServiceConvertors, BacklightInfoPtr) { ...@@ -462,12 +468,10 @@ TEST(ProbeServiceConvertors, BacklightInfoPtr) {
input->max_brightness = kMaxBrightness; input->max_brightness = kMaxBrightness;
input->brightness = kBrightness; input->brightness = kBrightness;
const auto output = ConvertPtr(std::move(input)); EXPECT_EQ(ConvertPtr(std::move(input)),
ASSERT_TRUE(output); health::mojom::BacklightInfo::New(
EXPECT_EQ(output->path, kPath); kPath, health::mojom::UInt32Value::New(kMaxBrightness),
EXPECT_EQ(output->max_brightness, health::mojom::UInt32Value::New(kBrightness)));
health::mojom::UInt32Value::New(kMaxBrightness));
EXPECT_EQ(output->brightness, health::mojom::UInt32Value::New(kBrightness));
} }
TEST(ProbeServiceConvertors, BacklightResultPtrInfo) { TEST(ProbeServiceConvertors, BacklightResultPtrInfo) {
...@@ -527,15 +531,12 @@ TEST(ProbeServiceConvertors, FanResultPtrInfo) { ...@@ -527,15 +531,12 @@ TEST(ProbeServiceConvertors, FanResultPtrInfo) {
input = cros_healthd::mojom::FanResult::NewFanInfo(std::move(fan_infos)); input = cros_healthd::mojom::FanResult::NewFanInfo(std::move(fan_infos));
} }
const auto output = ConvertPtr(std::move(input)); std::vector<health::mojom::FanInfoPtr> expected_fans;
ASSERT_TRUE(output); expected_fans.push_back(
ASSERT_TRUE(output->is_fan_info()); health::mojom::FanInfo::New(health::mojom::UInt32Value::New(kSpeedRpm)));
const auto& fan_info_output = output->get_fan_info(); EXPECT_EQ(ConvertPtr(std::move(input)),
ASSERT_EQ(fan_info_output.size(), 1ULL); health::mojom::FanResult::NewFanInfo(std::move(expected_fans)));
ASSERT_TRUE(fan_info_output[0]);
EXPECT_EQ(fan_info_output[0]->speed_rpm,
health::mojom::UInt32Value::New(kSpeedRpm));
} }
TEST(ProbeServiceConvertors, FanResultPtrError) { TEST(ProbeServiceConvertors, FanResultPtrError) {
...@@ -555,11 +556,10 @@ TEST(ProbeServiceConvertors, StatefulPartitionInfoPtr) { ...@@ -555,11 +556,10 @@ TEST(ProbeServiceConvertors, StatefulPartitionInfoPtr) {
input->available_space = kAvailableSpace; input->available_space = kAvailableSpace;
input->total_space = kTotalSpace; input->total_space = kTotalSpace;
const auto output = ConvertPtr(std::move(input)); EXPECT_EQ(ConvertPtr(std::move(input)),
ASSERT_TRUE(output); health::mojom::StatefulPartitionInfo::New(
EXPECT_EQ(output->available_space, health::mojom::UInt64Value::New(kRoundedAvailableSpace),
health::mojom::UInt64Value::New(kRoundedAvailableSpace)); health::mojom::UInt64Value::New(kTotalSpace)));
EXPECT_EQ(output->total_space, health::mojom::UInt64Value::New(kTotalSpace));
} }
TEST(ProbeServiceConvertors, StatefulPartitionResultPtrInfo) { TEST(ProbeServiceConvertors, StatefulPartitionResultPtrInfo) {
...@@ -583,18 +583,17 @@ TEST(ProbeServiceConvertors, BluetoothAdapterInfoPtr) { ...@@ -583,18 +583,17 @@ TEST(ProbeServiceConvertors, BluetoothAdapterInfoPtr) {
constexpr uint32_t kNumConnectedDevices = 3; constexpr uint32_t kNumConnectedDevices = 3;
auto input = cros_healthd::mojom::BluetoothAdapterInfo::New(); auto input = cros_healthd::mojom::BluetoothAdapterInfo::New();
{
input->name = kName; input->name = kName;
input->address = kAddress; input->address = kAddress;
input->powered = kPowered; input->powered = kPowered;
input->num_connected_devices = kNumConnectedDevices; input->num_connected_devices = kNumConnectedDevices;
}
const auto output = ConvertPtr(std::move(input)); EXPECT_EQ(ConvertPtr(std::move(input)),
ASSERT_TRUE(output); health::mojom::BluetoothAdapterInfo::New(
EXPECT_EQ(output->name, kName); kName, kAddress, health::mojom::BoolValue::New(kPowered),
EXPECT_EQ(output->address, kAddress); health::mojom::UInt32Value::New(kNumConnectedDevices)));
EXPECT_EQ(output->powered, health::mojom::BoolValue::New(kPowered));
EXPECT_EQ(output->num_connected_devices,
health::mojom::UInt32Value::New(kNumConnectedDevices));
} }
TEST(ProbeServiceConvertors, BluetoothResultPtrInfo) { TEST(ProbeServiceConvertors, BluetoothResultPtrInfo) {
...@@ -632,6 +631,7 @@ TEST(ProbeServiceConvertors, BluetoothResultPtrError) { ...@@ -632,6 +631,7 @@ TEST(ProbeServiceConvertors, BluetoothResultPtrError) {
TEST(ProbeServiceConvertors, TelemetryInfoPtrWithNotNullFields) { TEST(ProbeServiceConvertors, TelemetryInfoPtrWithNotNullFields) {
auto input = cros_healthd::mojom::TelemetryInfo::New(); auto input = cros_healthd::mojom::TelemetryInfo::New();
{
input->battery_result = cros_healthd::mojom::BatteryResult::New(); input->battery_result = cros_healthd::mojom::BatteryResult::New();
input->block_device_result = input->block_device_result =
cros_healthd::mojom::NonRemovableBlockDeviceResult::New(); cros_healthd::mojom::NonRemovableBlockDeviceResult::New();
...@@ -644,34 +644,35 @@ TEST(ProbeServiceConvertors, TelemetryInfoPtrWithNotNullFields) { ...@@ -644,34 +644,35 @@ TEST(ProbeServiceConvertors, TelemetryInfoPtrWithNotNullFields) {
input->stateful_partition_result = input->stateful_partition_result =
cros_healthd::mojom::StatefulPartitionResult::New(); cros_healthd::mojom::StatefulPartitionResult::New();
input->bluetooth_result = cros_healthd::mojom::BluetoothResult::New(); input->bluetooth_result = cros_healthd::mojom::BluetoothResult::New();
}
const auto output = ConvertPtr(std::move(input)); EXPECT_EQ(
ASSERT_TRUE(output); ConvertPtr(std::move(input)),
EXPECT_TRUE(output->battery_result); health::mojom::TelemetryInfo::New(
EXPECT_TRUE(output->block_device_result); health::mojom::BatteryResult::New(),
EXPECT_TRUE(output->vpd_result); health::mojom::NonRemovableBlockDeviceResult::New(),
EXPECT_TRUE(output->cpu_result); health::mojom::CachedVpdResult::New(),
EXPECT_TRUE(output->timezone_result); health::mojom::CpuResult::New(), health::mojom::TimezoneResult::New(),
EXPECT_TRUE(output->memory_result); health::mojom::MemoryResult::New(),
EXPECT_TRUE(output->backlight_result); health::mojom::BacklightResult::New(),
EXPECT_TRUE(output->fan_result); health::mojom::FanResult::New(),
EXPECT_TRUE(output->stateful_partition_result); health::mojom::StatefulPartitionResult::New(),
EXPECT_TRUE(output->bluetooth_result); health::mojom::BluetoothResult::New()));
} }
TEST(ProbeServiceConvertors, TelemetryInfoPtrWithNullFields) { TEST(ProbeServiceConvertors, TelemetryInfoPtrWithNullFields) {
const auto output = ConvertPtr(cros_healthd::mojom::TelemetryInfo::New()); EXPECT_EQ(ConvertPtr(cros_healthd::mojom::TelemetryInfo::New()),
ASSERT_TRUE(output); health::mojom::TelemetryInfo::New(
EXPECT_FALSE(output->battery_result); health::mojom::BatteryResultPtr(nullptr),
EXPECT_FALSE(output->block_device_result); health::mojom::NonRemovableBlockDeviceResultPtr(nullptr),
EXPECT_FALSE(output->vpd_result); health::mojom::CachedVpdResultPtr(nullptr),
EXPECT_FALSE(output->cpu_result); health::mojom::CpuResultPtr(nullptr),
EXPECT_FALSE(output->timezone_result); health::mojom::TimezoneResultPtr(nullptr),
EXPECT_FALSE(output->memory_result); health::mojom::MemoryResultPtr(nullptr),
EXPECT_FALSE(output->backlight_result); health::mojom::BacklightResultPtr(nullptr),
EXPECT_FALSE(output->fan_result); health::mojom::FanResultPtr(nullptr),
EXPECT_FALSE(output->stateful_partition_result); health::mojom::StatefulPartitionResultPtr(nullptr),
EXPECT_FALSE(output->bluetooth_result); health::mojom::BluetoothResultPtr(nullptr)));
} }
} // namespace probe_service_converters } // namespace probe_service_converters
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment