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

Side by Side Diff: content/browser/renderer_host/media/video_capture_browsertest.cc

Issue 2910843002: [Cleanup] Move all browsertests to use ScopedFeatureList to modify features
Patch Set: rebase update 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "base/test/scoped_feature_list.h"
7 #include "build/build_config.h" 8 #include "build/build_config.h"
8 #include "content/browser/browser_main_loop.h" 9 #include "content/browser/browser_main_loop.h"
9 #include "content/browser/renderer_host/media/media_stream_manager.h" 10 #include "content/browser/renderer_host/media/media_stream_manager.h"
10 #include "content/browser/renderer_host/media/video_capture_controller.h" 11 #include "content/browser/renderer_host/media/video_capture_controller.h"
11 #include "content/browser/renderer_host/media/video_capture_manager.h" 12 #include "content/browser/renderer_host/media/video_capture_manager.h"
12 #include "content/public/common/content_switches.h" 13 #include "content/public/common/content_switches.h"
13 #include "content/public/test/content_browser_test.h" 14 #include "content/public/test/content_browser_test.h"
14 #include "media/base/bind_to_current_loop.h" 15 #include "media/base/bind_to_current_loop.h"
15 #include "media/base/media_switches.h" 16 #include "media/base/media_switches.h"
16 #include "media/capture/video_capture_types.h" 17 #include "media/capture/video_capture_types.h"
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 kFakeDeviceFactoryConfigString); 152 kFakeDeviceFactoryConfigString);
152 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream); 153 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream);
153 if (params_.exercise_accelerated_jpeg_decoding) { 154 if (params_.exercise_accelerated_jpeg_decoding) {
154 base::CommandLine::ForCurrentProcess()->AppendSwitch( 155 base::CommandLine::ForCurrentProcess()->AppendSwitch(
155 switches::kUseFakeJpegDecodeAccelerator); 156 switches::kUseFakeJpegDecodeAccelerator);
156 } else { 157 } else {
157 base::CommandLine::ForCurrentProcess()->AppendSwitch( 158 base::CommandLine::ForCurrentProcess()->AppendSwitch(
158 switches::kDisableAcceleratedMjpegDecode); 159 switches::kDisableAcceleratedMjpegDecode);
159 } 160 }
160 if (params_.use_mojo_service) { 161 if (params_.use_mojo_service) {
161 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII( 162 scoped_feature_list_.InitAndEnableFeature(
162 switches::kEnableFeatures, video_capture::kMojoVideoCapture.name); 163 video_capture::kMojoVideoCapture);
163 } 164 }
164 } 165 }
165 166
166 // This cannot be part of an override of SetUp(), because at the time when 167 // This cannot be part of an override of SetUp(), because at the time when
167 // SetUp() is invoked, the BrowserMainLoop does not exist yet. 168 // SetUp() is invoked, the BrowserMainLoop does not exist yet.
168 void SetUpRequiringBrowserMainLoopOnMainThread() { 169 void SetUpRequiringBrowserMainLoopOnMainThread() {
169 BrowserMainLoop* browser_main_loop = BrowserMainLoop::GetInstance(); 170 BrowserMainLoop* browser_main_loop = BrowserMainLoop::GetInstance();
170 ASSERT_TRUE(browser_main_loop); 171 ASSERT_TRUE(browser_main_loop);
171 media_stream_manager_ = browser_main_loop->media_stream_manager(); 172 media_stream_manager_ = browser_main_loop->media_stream_manager();
172 ASSERT_TRUE(media_stream_manager_); 173 ASSERT_TRUE(media_stream_manager_);
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 205
205 protected: 206 protected:
206 TestParams params_; 207 TestParams params_;
207 MediaStreamManager* media_stream_manager_ = nullptr; 208 MediaStreamManager* media_stream_manager_ = nullptr;
208 VideoCaptureManager* video_capture_manager_ = nullptr; 209 VideoCaptureManager* video_capture_manager_ = nullptr;
209 int session_id_ = 0; 210 int session_id_ = 0;
210 const VideoCaptureControllerID stub_client_id_ = 123; 211 const VideoCaptureControllerID stub_client_id_ = 123;
211 MockMediaStreamProviderListener mock_stream_provider_listener_; 212 MockMediaStreamProviderListener mock_stream_provider_listener_;
212 MockVideoCaptureControllerEventHandler mock_controller_event_handler_; 213 MockVideoCaptureControllerEventHandler mock_controller_event_handler_;
213 base::WeakPtr<VideoCaptureController> controller_; 214 base::WeakPtr<VideoCaptureController> controller_;
215 base::test::ScopedFeatureList scoped_feature_list_;
214 }; 216 };
215 217
216 IN_PROC_BROWSER_TEST_P(VideoCaptureBrowserTest, StartAndImmediatelyStop) { 218 IN_PROC_BROWSER_TEST_P(VideoCaptureBrowserTest, StartAndImmediatelyStop) {
217 #if defined(OS_ANDROID) 219 #if defined(OS_ANDROID)
218 // Mojo video capture is currently not supported on Android. 220 // Mojo video capture is currently not supported on Android.
219 // TODO(chfremer): Remove this as soon as https://crbug.com/720500 is 221 // TODO(chfremer): Remove this as soon as https://crbug.com/720500 is
220 // resolved. 222 // resolved.
221 if (params_.use_mojo_service) 223 if (params_.use_mojo_service)
222 return; 224 return;
223 #endif 225 #endif
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 351
350 INSTANTIATE_TEST_CASE_P(, 352 INSTANTIATE_TEST_CASE_P(,
351 VideoCaptureBrowserTest, 353 VideoCaptureBrowserTest,
352 Combine(Values(0, 1, 2), // DeviceIndex 354 Combine(Values(0, 1, 2), // DeviceIndex
353 Values(gfx::Size(640, 480), // Resolution 355 Values(gfx::Size(640, 480), // Resolution
354 gfx::Size(1280, 720)), 356 gfx::Size(1280, 720)),
355 Bool(), // ExerciseAcceleratedJpegDecoding 357 Bool(), // ExerciseAcceleratedJpegDecoding
356 Bool())); // UseMojoService 358 Bool())); // UseMojoService
357 359
358 } // namespace content 360 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698