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( |
Charlie Reis
2015/02/06 00:08:21
@nasko FYI: You'll get a conflict from this line i
|
+ 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 |