Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "chromeos/dbus/fake_power_manager_client.h" | |
| 6 | |
| 7 #include "testing/gtest/include/gtest/gtest.h" | |
| 8 | |
| 9 namespace chromeos { | |
| 10 | |
| 11 TEST(FakePowerManagerClientTest, UpdatePowerPropertiesTest) { | |
| 12 FakePowerManagerClient* client = new FakePowerManagerClient(); | |
|
Daniel Erat
2015/06/30 22:13:31
you're leaking memory here. why don't you just all
mozartalouis
2015/07/01 00:43:28
Done.
| |
| 13 | |
| 14 ASSERT_TRUE(client != NULL); | |
|
Daniel Erat
2015/06/30 22:13:31
you don't need to test the output of the 'new' ope
mozartalouis
2015/07/01 00:43:28
Done.
| |
| 15 | |
| 16 client->UpdatePowerProperties( | |
| 17 80, true, power_manager::PowerSupplyProperties_BatteryState_CHARGING, | |
| 18 power_manager::PowerSupplyProperties_ExternalPower_USB); | |
| 19 | |
| 20 EXPECT_EQ(80, client->GetPowerSupplyProperties().battery_percent()); | |
| 21 | |
| 22 EXPECT_TRUE(client->GetPowerSupplyProperties().is_calculating_battery_time()); | |
| 23 | |
| 24 EXPECT_EQ(power_manager::PowerSupplyProperties_BatteryState_CHARGING, | |
|
Daniel Erat
2015/06/30 22:13:31
please test more cases, e.g. _FULL. make sure you
mozartalouis
2015/07/01 00:43:28
Done.
| |
| 25 client->GetPowerSupplyProperties().battery_state()); | |
| 26 | |
| 27 EXPECT_EQ(power_manager::PowerSupplyProperties_ExternalPower_USB, | |
| 28 client->GetPowerSupplyProperties().external_power()); | |
| 29 } | |
| 30 | |
| 31 } // namespace chromeos | |
| OLD | NEW |