diff options
author | Yifan Hong | 2018-10-02 18:37:43 -0500 |
---|---|---|
committer | Gerrit Code Review | 2018-10-02 18:37:43 -0500 |
commit | f8a8873ee683fffd591d7fd9e2d492173080308e (patch) | |
tree | 6aba5955a64f11132be9c526f0233a342a26b1c3 | |
parent | e9fc235eb4c238e3f9e43a5e8d2e9e30f567ffce (diff) | |
parent | 26c1200e544fd53ea7e74af316eb346669058c0f (diff) | |
download | platform-hardware-interfaces-f8a8873ee683fffd591d7fd9e2d492173080308e.tar.gz platform-hardware-interfaces-f8a8873ee683fffd591d7fd9e2d492173080308e.tar.xz platform-hardware-interfaces-f8a8873ee683fffd591d7fd9e2d492173080308e.zip |
Merge "health VTS: split Properties test"
-rw-r--r-- | health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp | 55 |
1 files changed, 50 insertions, 5 deletions
diff --git a/health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp b/health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp index bba4661f..f895aecf 100644 --- a/health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp +++ b/health/2.0/vts/functional/VtsHalHealthV2_0TargetTest.cpp | |||
@@ -222,38 +222,83 @@ bool verifyHealthInfo(const HealthInfo& health_info) { | |||
222 | } | 222 | } |
223 | 223 | ||
224 | /* | 224 | /* |
225 | * Tests the values returned by getChargeCounter(), | 225 | * Tests the values returned by getChargeCounter() from interface IHealth. |
226 | * getCurrentNow(), getCurrentAverage(), getCapacity(), getEnergyCounter(), | ||
227 | * getChargeStatus(), getStorageInfo(), getDiskStats() and getHealthInfo() from | ||
228 | * interface IHealth. | ||
229 | */ | 226 | */ |
230 | TEST_F(HealthHidlTest, Properties) { | 227 | TEST_F(HealthHidlTest, getChargeCounter) { |
231 | EXPECT_OK(mHealth->getChargeCounter([](auto result, auto value) { | 228 | EXPECT_OK(mHealth->getChargeCounter([](auto result, auto value) { |
232 | EXPECT_VALID_OR_UNSUPPORTED_PROP(result, std::to_string(value), value > 0); | 229 | EXPECT_VALID_OR_UNSUPPORTED_PROP(result, std::to_string(value), value > 0); |
233 | })); | 230 | })); |
231 | } | ||
232 | |||
233 | /* | ||
234 | * Tests the values returned by getCurrentNow() from interface IHealth. | ||
235 | */ | ||
236 | TEST_F(HealthHidlTest, getCurrentNow) { | ||
234 | EXPECT_OK(mHealth->getCurrentNow([](auto result, auto value) { | 237 | EXPECT_OK(mHealth->getCurrentNow([](auto result, auto value) { |
235 | EXPECT_VALID_OR_UNSUPPORTED_PROP(result, std::to_string(value), value != INT32_MIN); | 238 | EXPECT_VALID_OR_UNSUPPORTED_PROP(result, std::to_string(value), value != INT32_MIN); |
236 | })); | 239 | })); |
240 | } | ||
241 | |||
242 | /* | ||
243 | * Tests the values returned by getCurrentAverage() from interface IHealth. | ||
244 | */ | ||
245 | TEST_F(HealthHidlTest, getCurrentAverage) { | ||
237 | EXPECT_OK(mHealth->getCurrentAverage([](auto result, auto value) { | 246 | EXPECT_OK(mHealth->getCurrentAverage([](auto result, auto value) { |
238 | EXPECT_VALID_OR_UNSUPPORTED_PROP(result, std::to_string(value), value != INT32_MIN); | 247 | EXPECT_VALID_OR_UNSUPPORTED_PROP(result, std::to_string(value), value != INT32_MIN); |
239 | })); | 248 | })); |
249 | } | ||
250 | |||
251 | /* | ||
252 | * Tests the values returned by getCapacity() from interface IHealth. | ||
253 | */ | ||
254 | TEST_F(HealthHidlTest, getCapacity) { | ||
240 | EXPECT_OK(mHealth->getCapacity([](auto result, auto value) { | 255 | EXPECT_OK(mHealth->getCapacity([](auto result, auto value) { |
241 | EXPECT_VALID_OR_UNSUPPORTED_PROP(result, std::to_string(value), 0 <= value && value <= 100); | 256 | EXPECT_VALID_OR_UNSUPPORTED_PROP(result, std::to_string(value), 0 <= value && value <= 100); |
242 | })); | 257 | })); |
258 | } | ||
259 | |||
260 | /* | ||
261 | * Tests the values returned by getEnergyCounter() from interface IHealth. | ||
262 | */ | ||
263 | TEST_F(HealthHidlTest, getEnergyCounter) { | ||
243 | EXPECT_OK(mHealth->getEnergyCounter([](auto result, auto value) { | 264 | EXPECT_OK(mHealth->getEnergyCounter([](auto result, auto value) { |
244 | EXPECT_VALID_OR_UNSUPPORTED_PROP(result, std::to_string(value), value != INT64_MIN); | 265 | EXPECT_VALID_OR_UNSUPPORTED_PROP(result, std::to_string(value), value != INT64_MIN); |
245 | })); | 266 | })); |
267 | } | ||
268 | |||
269 | /* | ||
270 | * Tests the values returned by getChargeStatus() from interface IHealth. | ||
271 | */ | ||
272 | TEST_F(HealthHidlTest, getChargeStatus) { | ||
246 | EXPECT_OK(mHealth->getChargeStatus([](auto result, auto value) { | 273 | EXPECT_OK(mHealth->getChargeStatus([](auto result, auto value) { |
247 | EXPECT_VALID_OR_UNSUPPORTED_PROP( | 274 | EXPECT_VALID_OR_UNSUPPORTED_PROP( |
248 | result, toString(value), | 275 | result, toString(value), |
249 | value != BatteryStatus::UNKNOWN && verifyEnum<BatteryStatus>(value)); | 276 | value != BatteryStatus::UNKNOWN && verifyEnum<BatteryStatus>(value)); |
250 | })); | 277 | })); |
278 | } | ||
279 | |||
280 | /* | ||
281 | * Tests the values returned by getStorageInfo() from interface IHealth. | ||
282 | */ | ||
283 | TEST_F(HealthHidlTest, getStorageInfo) { | ||
251 | EXPECT_OK(mHealth->getStorageInfo([](auto result, auto& value) { | 284 | EXPECT_OK(mHealth->getStorageInfo([](auto result, auto& value) { |
252 | EXPECT_VALID_OR_UNSUPPORTED_PROP(result, toString(value), verifyStorageInfo(value)); | 285 | EXPECT_VALID_OR_UNSUPPORTED_PROP(result, toString(value), verifyStorageInfo(value)); |
253 | })); | 286 | })); |
287 | } | ||
288 | |||
289 | /* | ||
290 | * Tests the values returned by getDiskStats() from interface IHealth. | ||
291 | */ | ||
292 | TEST_F(HealthHidlTest, getDiskStats) { | ||
254 | EXPECT_OK(mHealth->getDiskStats([](auto result, auto& value) { | 293 | EXPECT_OK(mHealth->getDiskStats([](auto result, auto& value) { |
255 | EXPECT_VALID_OR_UNSUPPORTED_PROP(result, toString(value), true); | 294 | EXPECT_VALID_OR_UNSUPPORTED_PROP(result, toString(value), true); |
256 | })); | 295 | })); |
296 | } | ||
297 | |||
298 | /* | ||
299 | * Tests the values returned by getHealthInfo() from interface IHealth. | ||
300 | */ | ||
301 | TEST_F(HealthHidlTest, getHealthInfo) { | ||
257 | EXPECT_OK(mHealth->getHealthInfo([](auto result, auto& value) { | 302 | EXPECT_OK(mHealth->getHealthInfo([](auto result, auto& value) { |
258 | EXPECT_VALID_OR_UNSUPPORTED_PROP(result, toString(value), verifyHealthInfo(value)); | 303 | EXPECT_VALID_OR_UNSUPPORTED_PROP(result, toString(value), verifyHealthInfo(value)); |
259 | })); | 304 | })); |