| 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 <tuple> | 5 #include <tuple> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 media_session_state_callback_subscription_.reset(); | 89 media_session_state_callback_subscription_.reset(); |
| 90 } | 90 } |
| 91 | 91 |
| 92 void EnableDisableResumingBackgroundVideos(bool enable) { | 92 void EnableDisableResumingBackgroundVideos(bool enable) { |
| 93 if (enable) | 93 if (enable) |
| 94 scoped_feature_list_.InitAndEnableFeature(media::kResumeBackgroundVideo); | 94 scoped_feature_list_.InitAndEnableFeature(media::kResumeBackgroundVideo); |
| 95 else | 95 else |
| 96 scoped_feature_list_.InitAndDisableFeature(media::kResumeBackgroundVideo); | 96 scoped_feature_list_.InitAndDisableFeature(media::kResumeBackgroundVideo); |
| 97 } | 97 } |
| 98 | 98 |
| 99 void SetUp() override { |
| 100 VisibilityTestData params = GetVisibilityTestData(); |
| 101 EnableDisableResumingBackgroundVideos(params.background_resuming == |
| 102 BackgroundResuming::ENABLED); |
| 103 ContentBrowserTest::SetUp(); |
| 104 } |
| 105 |
| 99 void SetUpCommandLine(base::CommandLine* command_line) override { | 106 void SetUpCommandLine(base::CommandLine* command_line) override { |
| 100 command_line->AppendSwitch(switches::kIgnoreAutoplayRestrictionsForTests); | 107 command_line->AppendSwitch(switches::kIgnoreAutoplayRestrictionsForTests); |
| 101 #if !defined(OS_ANDROID) | 108 #if !defined(OS_ANDROID) |
| 102 command_line->AppendSwitch(switches::kEnableAudioFocus); | 109 command_line->AppendSwitch(switches::kEnableAudioFocus); |
| 103 #endif // !defined(OS_ANDROID) | 110 #endif // !defined(OS_ANDROID) |
| 104 | 111 |
| 105 VisibilityTestData params = GetVisibilityTestData(); | 112 VisibilityTestData params = GetVisibilityTestData(); |
| 106 | 113 |
| 107 if (params.media_suspend == MediaSuspend::ENABLED) | 114 if (params.media_suspend == MediaSuspend::ENABLED) |
| 108 command_line->AppendSwitch(switches::kEnableMediaSuspend); | 115 command_line->AppendSwitch(switches::kEnableMediaSuspend); |
| 109 else | 116 else |
| 110 command_line->AppendSwitch(switches::kDisableMediaSuspend); | 117 command_line->AppendSwitch(switches::kDisableMediaSuspend); |
| 111 | |
| 112 if (params.background_resuming == BackgroundResuming::ENABLED) { | |
| 113 command_line->AppendSwitchASCII(switches::kEnableFeatures, | |
| 114 media::kResumeBackgroundVideo.name); | |
| 115 } else { | |
| 116 command_line->AppendSwitchASCII(switches::kDisableFeatures, | |
| 117 media::kResumeBackgroundVideo.name); | |
| 118 } | |
| 119 } | 118 } |
| 120 | 119 |
| 121 const VisibilityTestData& GetVisibilityTestData() { | 120 const VisibilityTestData& GetVisibilityTestData() { |
| 122 return GetParam(); | 121 return GetParam(); |
| 123 } | 122 } |
| 124 | 123 |
| 125 void StartPlayer() { | 124 void StartPlayer() { |
| 126 LoadTestPage(); | 125 LoadTestPage(); |
| 127 | 126 |
| 128 LOG(INFO) << "Starting player"; | 127 LOG(INFO) << "Starting player"; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 MaybePausePlayer(); | 269 MaybePausePlayer(); |
| 271 HideTab(); | 270 HideTab(); |
| 272 CheckSessionStateAfterHide(); | 271 CheckSessionStateAfterHide(); |
| 273 } | 272 } |
| 274 | 273 |
| 275 INSTANTIATE_TEST_CASE_P(MediaSessionImplVisibilityBrowserTestInstances, | 274 INSTANTIATE_TEST_CASE_P(MediaSessionImplVisibilityBrowserTestInstances, |
| 276 MediaSessionImplVisibilityBrowserTest, | 275 MediaSessionImplVisibilityBrowserTest, |
| 277 ::testing::ValuesIn(kTestParams)); | 276 ::testing::ValuesIn(kTestParams)); |
| 278 | 277 |
| 279 } // namespace content | 278 } // namespace content |
| OLD | NEW |