Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: chromeos/dbus/fake_power_manager_client_unittest.cc

Issue 1206733002: ChromeOs Power Emulation Impl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created unittest for FakePowerManagerClient Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698