diff options
author | Yifan Hong <elsk@google.com> | 2020-01-28 18:48:11 -0800 |
---|---|---|
committer | Yifan Hong <elsk@google.com> | 2020-01-28 19:00:53 -0800 |
commit | 3f91f296bafe47f3aec419ff203df89b10af755d (patch) | |
tree | ab11028c307ec669f5ca08a04212a015c03847a0 /health | |
parent | 3a8eb92143267109ba986c94c9605aa63f63c8b5 (diff) | |
download | platform_hardware_interfaces-3f91f296bafe47f3aec419ff203df89b10af755d.tar.gz platform_hardware_interfaces-3f91f296bafe47f3aec419ff203df89b10af755d.tar.bz2 platform_hardware_interfaces-3f91f296bafe47f3aec419ff203df89b10af755d.zip |
health 2.1 VTS: fix test on batteryFullCapacityUah
getHealthInfo_2_1 reports batteryFullCapacityUah:
- 0 if value is unknown. In such case, no requirement is enforced.
- positive if value is known. In such case, require it to be 50%~120% of
batteryFullCharge.
Test: run on cuttlefish
Bug: 144948996
Change-Id: I7856729aafa3a19a3bfcc00e6e0ad5162f22afea
Diffstat (limited to 'health')
-rw-r--r-- | health/2.1/vts/functional/VtsHalHealthV2_1TargetTest.cpp | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/health/2.1/vts/functional/VtsHalHealthV2_1TargetTest.cpp b/health/2.1/vts/functional/VtsHalHealthV2_1TargetTest.cpp index da9f5bbbbc..e75b299b0b 100644 --- a/health/2.1/vts/functional/VtsHalHealthV2_1TargetTest.cpp +++ b/health/2.1/vts/functional/VtsHalHealthV2_1TargetTest.cpp @@ -233,9 +233,13 @@ TEST_P(HealthHidlTest, getHealthInfo_2_1) { EXPECT_TRUE(IsEnum(value.batteryCapacityLevel)) << " BatteryCapacityLevel"; EXPECT_GE(value.batteryChargeTimeToFullNowSeconds, 0); - EXPECT_GE(value.batteryFullCapacityUah, 0) << "batteryFullCapacityUah is unknown"; - EXPECT_GE(value.batteryFullCapacityUah, legacy.batteryFullCharge * 0.50); - EXPECT_LE(value.batteryFullCapacityUah, legacy.batteryFullCharge * 1.20); + EXPECT_GE(value.batteryFullCapacityUah, 0) + << "batteryFullCapacityUah should not be negative"; + + if (value.batteryFullCapacityUah > 0) { + EXPECT_GE(value.batteryFullCapacityUah, legacy.batteryFullCharge * 0.50); + EXPECT_LE(value.batteryFullCapacityUah, legacy.batteryFullCharge * 1.20); + } }))); } |