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

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

Issue 644463003: [Cast, Android] Don't hold the wake lock if the video is playing remotely. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Ignore remote players altogether Created 6 years, 2 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') | content/common/frame_messages.h » ('j') | 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 5cd05c12a1c9d2969c8acbd58ed6e0dd15e4b77d..645c8254a8c4d5bb0aba648419acc02afa7bdbca 100644
--- a/content/browser/web_contents/web_contents_impl_unittest.cc
+++ b/content/browser/web_contents/web_contents_impl_unittest.cc
@@ -2701,6 +2701,7 @@ TEST_F(WebContentsImplTest, MediaPowerSaveBlocking) {
const int kPlayerAudioVideoId = 15;
const int kPlayerAudioOnlyId = -15;
const int kPlayerVideoOnlyId = 30;
+ const int kPlayerRemoteId = -30;
EXPECT_FALSE(contents()->has_audio_power_save_blocker_for_testing());
EXPECT_FALSE(contents()->has_video_power_save_blocker_for_testing());
@@ -2728,7 +2729,7 @@ TEST_F(WebContentsImplTest, MediaPowerSaveBlocking) {
// 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));
+ 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());
@@ -2741,7 +2742,7 @@ TEST_F(WebContentsImplTest, MediaPowerSaveBlocking) {
// the power save blockers. The notification should take into account the
// visibility state of the WebContents.
rfh->OnMessageReceived(FrameHostMsg_MediaPlayingNotification(
- 0, kPlayerVideoOnlyId, true, false));
+ 0, kPlayerVideoOnlyId, true, false, false));
EXPECT_FALSE(contents()->has_video_power_save_blocker_for_testing());
EXPECT_EQ(contents()->has_audio_power_save_blocker_for_testing(),
!AudioStreamMonitor::monitoring_available());
@@ -2753,7 +2754,15 @@ TEST_F(WebContentsImplTest, MediaPowerSaveBlocking) {
// Start another player that only has audio. There should be no change in
// the power save blockers.
rfh->OnMessageReceived(FrameHostMsg_MediaPlayingNotification(
- 0, kPlayerAudioOnlyId, false, true));
+ 0, kPlayerAudioOnlyId, false, 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());
+
+ // Start a remote player. There should be no change in the power save
+ // blockers.
+ rfh->OnMessageReceived(FrameHostMsg_MediaPlayingNotification(
+ 0, kPlayerRemoteId, true, true, true));
EXPECT_TRUE(contents()->has_video_power_save_blocker_for_testing());
EXPECT_EQ(contents()->has_audio_power_save_blocker_for_testing(),
!AudioStreamMonitor::monitoring_available());
@@ -2777,6 +2786,12 @@ TEST_F(WebContentsImplTest, MediaPowerSaveBlocking) {
FrameHostMsg_MediaPausedNotification(0, kPlayerVideoOnlyId));
EXPECT_FALSE(contents()->has_video_power_save_blocker_for_testing());
EXPECT_FALSE(contents()->has_audio_power_save_blocker_for_testing());
+
+ // Destroy the remote player. No power save blockers should remain.
+ rfh->OnMessageReceived(
+ FrameHostMsg_MediaPausedNotification(0, kPlayerRemoteId));
+ 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') | content/common/frame_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698