Chromium Code Reviews| Index: chromeos/dbus/fake_power_manager_client_unittest.cc |
| diff --git a/chromeos/dbus/fake_power_manager_client_unittest.cc b/chromeos/dbus/fake_power_manager_client_unittest.cc |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6274fb29566a5cbe4ae306963e23fad0ac213fdb |
| --- /dev/null |
| +++ b/chromeos/dbus/fake_power_manager_client_unittest.cc |
| @@ -0,0 +1,31 @@ |
| +// Copyright 2015 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. |
| + |
| +#include "chromeos/dbus/fake_power_manager_client.h" |
| + |
| +#include "testing/gtest/include/gtest/gtest.h" |
| + |
| +namespace chromeos { |
| + |
| +TEST(FakePowerManagerClientTest, UpdatePowerPropertiesTest) { |
| + 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.
|
| + |
| + 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.
|
| + |
| + client->UpdatePowerProperties( |
| + 80, true, power_manager::PowerSupplyProperties_BatteryState_CHARGING, |
| + power_manager::PowerSupplyProperties_ExternalPower_USB); |
| + |
| + EXPECT_EQ(80, client->GetPowerSupplyProperties().battery_percent()); |
| + |
| + EXPECT_TRUE(client->GetPowerSupplyProperties().is_calculating_battery_time()); |
| + |
| + 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.
|
| + client->GetPowerSupplyProperties().battery_state()); |
| + |
| + EXPECT_EQ(power_manager::PowerSupplyProperties_ExternalPower_USB, |
| + client->GetPowerSupplyProperties().external_power()); |
| +} |
| + |
| +} // namespace chromeos |