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

Unified 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, 6 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 side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698