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

Unified Diff: content/browser/web_contents/web_contents_impl_unittest.cc

Issue 886603009: Cleanup power save blockers after a RenderView crashes. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Nit. Created 5 years, 10 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
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/web_contents/web_contents_impl_unittest.cc
diff --git a/content/browser/web_contents/web_contents_impl_unittest.cc b/content/browser/web_contents/web_contents_impl_unittest.cc
index ded5a4be207d4f581cabbe833f670c4554cfbc5c..9dc14657fe2a4073493dbb10c3f6272c8502ba2f 100644
--- a/content/browser/web_contents/web_contents_impl_unittest.cc
+++ b/content/browser/web_contents/web_contents_impl_unittest.cc
@@ -3026,6 +3026,24 @@ TEST_F(WebContentsImplTest, MediaPowerSaveBlocking) {
FrameHostMsg_MediaPausedNotification(0, kPlayerRemoteId));
EXPECT_FALSE(contents()->has_video_power_save_blocker_for_testing());
EXPECT_FALSE(contents()->has_audio_power_save_blocker_for_testing());
+
+ // Start a player with both audio and video. A video power save blocker
+ // should be created. If audio stream monitoring is available, an audio power
+ // save blocker should be created too.
+ rfh->OnMessageReceived(FrameHostMsg_MediaPlayingNotification(
+ 0, kPlayerAudioVideoId, true, true, false));
+ EXPECT_TRUE(contents()->has_video_power_save_blocker_for_testing());
+ EXPECT_EQ(contents()->has_audio_power_save_blocker_for_testing(),
+ !AudioStreamMonitor::monitoring_available());
+
+ // Crash the renderer.
+ contents()->GetMainFrame()->GetRenderViewHost()->OnMessageReceived(
+ ViewHostMsg_RenderProcessGone(
+ 0, base::TERMINATION_STATUS_PROCESS_CRASHED, -1));
+
+ // Verify that all the power save blockers have been released.
+ EXPECT_FALSE(contents()->has_video_power_save_blocker_for_testing());
+ EXPECT_FALSE(contents()->has_audio_power_save_blocker_for_testing());
}
#endif
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698