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

Unified Diff: content/browser/power_monitor_message_broadcaster_unittest.cc

Issue 401083002: Initialize PowerMonitor on_power_battery intitial value for newly created processes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Typo Created 6 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/power_monitor_message_broadcaster_unittest.cc
diff --git a/content/browser/power_monitor_message_broadcaster_unittest.cc b/content/browser/power_monitor_message_broadcaster_unittest.cc
index 515508266cf812cf6ca10152d64f46a72fe4593f..c277e83177d9872bd47d0141007af0fbb84626d6 100644
--- a/content/browser/power_monitor_message_broadcaster_unittest.cc
+++ b/content/browser/power_monitor_message_broadcaster_unittest.cc
@@ -69,6 +69,10 @@ TEST_F(PowerMonitorMessageBroadcasterTest, PowerMessageBroadcast) {
PowerMonitorMessageSender sender;
PowerMonitorMessageBroadcaster broadcaster(&sender);
+ // Calling Init should invoke a power state change.
+ broadcaster.Init();
+ EXPECT_EQ(sender.power_state_changes(), 1);
+
// Sending resume when not suspended should have no effect.
source()->GenerateResumeEvent();
EXPECT_EQ(sender.resumes(), 0);
@@ -91,19 +95,19 @@ TEST_F(PowerMonitorMessageBroadcasterTest, PowerMessageBroadcast) {
// Pretend the device has gone on battery power
source()->GeneratePowerStateEvent(true);
- EXPECT_EQ(sender.power_state_changes(), 1);
+ EXPECT_EQ(sender.power_state_changes(), 2);
// Repeated indications the device is on battery power should be suppressed.
source()->GeneratePowerStateEvent(true);
- EXPECT_EQ(sender.power_state_changes(), 1);
+ EXPECT_EQ(sender.power_state_changes(), 2);
// Pretend the device has gone off battery power
source()->GeneratePowerStateEvent(false);
- EXPECT_EQ(sender.power_state_changes(), 2);
+ EXPECT_EQ(sender.power_state_changes(), 3);
// Repeated indications the device is off battery power should be suppressed.
source()->GeneratePowerStateEvent(false);
- EXPECT_EQ(sender.power_state_changes(), 2);
+ EXPECT_EQ(sender.power_state_changes(), 3);
}
} // namespace base
« no previous file with comments | « content/browser/power_monitor_message_broadcaster.cc ('k') | content/browser/renderer_host/render_process_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698