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

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

Issue 2416853005: Fixing naming issues in MediaSession (Closed)
Patch Set: addressed nits Created 4 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "base/command_line.h"
6 #include "content/browser/media/session/media_session.h"
7 #include "content/browser/media/session/mock_media_session_observer.h"
8 #include "content/public/test/content_browser_test.h"
9 #include "content/shell/browser/shell.h"
10 #include "media/base/media_content_type.h"
11 #include "media/base/media_switches.h"
12
13 namespace content {
14
15 class MediaSessionDelegateDefaultBrowserTest : public ContentBrowserTest {
16 protected:
17 void SetUpCommandLine(base::CommandLine* command_line) override {
18 command_line->AppendSwitch(switches::kEnableDefaultMediaSession);
19 }
20
21 void Run(WebContents* start_contents, WebContents* interrupt_contents) {
22 std::unique_ptr<MockMediaSessionObserver> media_session_observer(
23 new MockMediaSessionObserver);
24
25 MediaSession* media_session = MediaSession::Get(start_contents);
26 ASSERT_TRUE(media_session);
27
28 MediaSession* other_media_session = MediaSession::Get(interrupt_contents);
29 ASSERT_TRUE(other_media_session);
30
31 media_session_observer->StartNewPlayer();
32 media_session->AddPlayer(media_session_observer.get(), 0,
33 media::MediaContentType::Persistent);
34 EXPECT_TRUE(media_session->IsActive());
35 EXPECT_FALSE(other_media_session->IsActive());
36
37 media_session_observer->StartNewPlayer();
38 other_media_session->AddPlayer(media_session_observer.get(), 1,
39 media::MediaContentType::Persistent);
40 EXPECT_FALSE(media_session->IsActive());
41 EXPECT_TRUE(other_media_session->IsActive());
42
43 media_session->Stop(MediaSession::SuspendType::UI);
44 other_media_session->Stop(MediaSession::SuspendType::UI);
45 }
46 };
47
48 // Two windows from the same BrowserContext.
49 IN_PROC_BROWSER_TEST_F(MediaSessionDelegateDefaultBrowserTest,
50 ActiveWebContentsPauseOthers) {
51 Run(shell()->web_contents(), CreateBrowser()->web_contents());
52 }
53
54 // Regular BrowserContext is interrupted by OffTheRecord one.
55 IN_PROC_BROWSER_TEST_F(MediaSessionDelegateDefaultBrowserTest,
56 RegularBrowserInterruptsOffTheRecord) {
57 Run(shell()->web_contents(), CreateOffTheRecordBrowser()->web_contents());
58 }
59
60 // OffTheRecord BrowserContext is interrupted by regular one.
61 IN_PROC_BROWSER_TEST_F(MediaSessionDelegateDefaultBrowserTest,
62 OffTheRecordInterruptsRegular) {
63 Run(CreateOffTheRecordBrowser()->web_contents(), shell()->web_contents());
64 }
65
66 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698