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

Side by Side Diff: content/browser/media/session/media_session_browsertest.cc

Issue 2821303004: cros: Suspend media sessions with display off trigger by tablet power button (Closed)
Patch Set: rebase Created 3 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 unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/public/browser/media_session.h" 5 #include "content/public/browser/media_session.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "content/public/browser/render_frame_host.h" 10 #include "content/public/browser/render_frame_host.h"
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 Type type_; 104 Type type_;
105 105
106 DISALLOW_COPY_AND_ASSIGN(MediaStartStopObserver); 106 DISALLOW_COPY_AND_ASSIGN(MediaStartStopObserver);
107 }; 107 };
108 108
109 DISALLOW_COPY_AND_ASSIGN(MediaSessionBrowserTest); 109 DISALLOW_COPY_AND_ASSIGN(MediaSessionBrowserTest);
110 }; 110 };
111 111
112 } // anonymous namespace 112 } // anonymous namespace
113 113
114 #if !defined(OS_ANDROID) 114 #if !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
115 // The feature can't be disabled on Android. 115 // The feature can't be disabled on Android and Chrome OS.
116 IN_PROC_BROWSER_TEST_F(MediaSessionBrowserTest, MediaSessionNoOpWhenDisabled) { 116 IN_PROC_BROWSER_TEST_F(MediaSessionBrowserTest, MediaSessionNoOpWhenDisabled) {
117 NavigateToURL(shell(), GetTestUrl("media/session", "media-session.html")); 117 NavigateToURL(shell(), GetTestUrl("media/session", "media-session.html"));
118 118
119 MediaSession* media_session = MediaSession::Get(shell()->web_contents()); 119 MediaSession* media_session = MediaSession::Get(shell()->web_contents());
120 ASSERT_NE(nullptr, media_session); 120 ASSERT_NE(nullptr, media_session);
121 121
122 StartPlaybackAndWait(shell(), "long-video"); 122 StartPlaybackAndWait(shell(), "long-video");
123 StartPlaybackAndWait(shell(), "long-audio"); 123 StartPlaybackAndWait(shell(), "long-audio");
124 124
125 media_session->Suspend(MediaSession::SuspendType::SYSTEM); 125 media_session->Suspend(MediaSession::SuspendType::SYSTEM);
126 StopPlaybackAndWait(shell(), "long-audio"); 126 StopPlaybackAndWait(shell(), "long-audio");
127 127
128 // At that point, only "long-audio" is paused. 128 // At that point, only "long-audio" is paused.
129 EXPECT_FALSE(IsPlaying(shell(), "long-audio")); 129 EXPECT_FALSE(IsPlaying(shell(), "long-audio"));
130 EXPECT_TRUE(IsPlaying(shell(), "long-video")); 130 EXPECT_TRUE(IsPlaying(shell(), "long-video"));
131 } 131 }
132 #endif // !defined(OS_ANDROID) 132 #endif // !defined(OS_ANDROID) && !defined(OS_CHROMEOS)
133 133
134 IN_PROC_BROWSER_TEST_F(MediaSessionBrowserTest, SimplePlayPause) { 134 IN_PROC_BROWSER_TEST_F(MediaSessionBrowserTest, SimplePlayPause) {
135 EnableInternalMediaSesion(); 135 EnableInternalMediaSesion();
136 136
137 NavigateToURL(shell(), GetTestUrl("media/session", "media-session.html")); 137 NavigateToURL(shell(), GetTestUrl("media/session", "media-session.html"));
138 138
139 MediaSession* media_session = MediaSession::Get(shell()->web_contents()); 139 MediaSession* media_session = MediaSession::Get(shell()->web_contents());
140 ASSERT_NE(nullptr, media_session); 140 ASSERT_NE(nullptr, media_session);
141 141
142 StartPlaybackAndWait(shell(), "long-video"); 142 StartPlaybackAndWait(shell(), "long-video");
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 EXPECT_FALSE(IsPlaying(other_shell, "long-video")); 207 EXPECT_FALSE(IsPlaying(other_shell, "long-video"));
208 208
209 other_media_session->Resume(MediaSession::SuspendType::SYSTEM); 209 other_media_session->Resume(MediaSession::SuspendType::SYSTEM);
210 WaitForStart(other_shell); 210 WaitForStart(other_shell);
211 EXPECT_TRUE(IsPlaying(shell(), "long-video")); 211 EXPECT_TRUE(IsPlaying(shell(), "long-video"));
212 EXPECT_TRUE(IsPlaying(other_shell, "long-video")); 212 EXPECT_TRUE(IsPlaying(other_shell, "long-video"));
213 } 213 }
214 #endif // defined(OS_ANDROID) 214 #endif // defined(OS_ANDROID)
215 215
216 } // namespace content 216 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/chrome_shell_delegate.cc ('k') | content/browser/media/session/media_session_controllers_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698