| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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/browser/media/session/audio_focus_manager.h" | 5 #include "content/browser/media/session/audio_focus_manager.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 "content/browser/media/session/media_session_impl.h" | 9 #include "content/browser/media/session/media_session_impl.h" |
| 10 #include "content/browser/media/session/media_session_player_observer.h" | 10 #include "content/browser/media/session/media_session_player_observer.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 | 32 |
| 33 using AudioFocusType = AudioFocusManager::AudioFocusType; | 33 using AudioFocusType = AudioFocusManager::AudioFocusType; |
| 34 using SuspendType = MediaSession::SuspendType; | 34 using SuspendType = MediaSession::SuspendType; |
| 35 | 35 |
| 36 class AudioFocusManagerTest : public testing::Test { | 36 class AudioFocusManagerTest : public testing::Test { |
| 37 public: | 37 public: |
| 38 AudioFocusManagerTest() = default; | 38 AudioFocusManagerTest() = default; |
| 39 | 39 |
| 40 void SetUp() override { | 40 void SetUp() override { |
| 41 base::CommandLine::ForCurrentProcess()->AppendSwitch( | 41 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 42 switches::kEnableDefaultMediaSession); | 42 switches::kEnableAudioFocus); |
| 43 rph_factory_.reset(new MockRenderProcessHostFactory()); | 43 rph_factory_.reset(new MockRenderProcessHostFactory()); |
| 44 SiteInstanceImpl::set_render_process_host_factory(rph_factory_.get()); | 44 SiteInstanceImpl::set_render_process_host_factory(rph_factory_.get()); |
| 45 browser_context_.reset(new TestBrowserContext()); | 45 browser_context_.reset(new TestBrowserContext()); |
| 46 pepper_observer_.reset(new MockMediaSessionPlayerObserver()); | 46 pepper_observer_.reset(new MockMediaSessionPlayerObserver()); |
| 47 } | 47 } |
| 48 | 48 |
| 49 void TearDown() override { | 49 void TearDown() override { |
| 50 // Run pending tasks. | 50 // Run pending tasks. |
| 51 base::RunLoop().RunUntilIdle(); | 51 base::RunLoop().RunUntilIdle(); |
| 52 | 52 |
| (...skipping 400 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 ASSERT_EQ(media_session_3, GetAudioFocusedSession()); | 453 ASSERT_EQ(media_session_3, GetAudioFocusedSession()); |
| 454 ASSERT_TRUE(media_session_2->IsSuspended()); | 454 ASSERT_TRUE(media_session_2->IsSuspended()); |
| 455 ASSERT_TRUE(media_session_1->IsActive()); | 455 ASSERT_TRUE(media_session_1->IsActive()); |
| 456 ASSERT_TRUE(IsSessionDucking(media_session_1)); | 456 ASSERT_TRUE(IsSessionDucking(media_session_1)); |
| 457 | 457 |
| 458 AbandonAudioFocus(media_session_3); | 458 AbandonAudioFocus(media_session_3); |
| 459 ASSERT_EQ(media_session_1, GetAudioFocusedSession()); | 459 ASSERT_EQ(media_session_1, GetAudioFocusedSession()); |
| 460 } | 460 } |
| 461 | 461 |
| 462 } // namespace content | 462 } // namespace content |
| OLD | NEW |