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

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: Move SFL calls to constructor Created 3 years, 5 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 104
104 // Integration test that exercises the VideoCaptureManager instance running in 105 // Integration test that exercises the VideoCaptureManager instance running in
105 // the Browser process. 106 // the Browser process.
106 class VideoCaptureBrowserTest : public ContentBrowserTest, 107 class VideoCaptureBrowserTest : public ContentBrowserTest,
107 public ::testing::WithParamInterface< 108 public ::testing::WithParamInterface<
108 std::tuple<DeviceIndex, 109 std::tuple<DeviceIndex,
109 Resolution, 110 Resolution,
110 ExerciseAcceleratedJpegDecoding, 111 ExerciseAcceleratedJpegDecoding,
111 UseMojoService>> { 112 UseMojoService>> {
112 public: 113 public:
113 VideoCaptureBrowserTest() { params_ = TestParams(GetParam()); } 114 VideoCaptureBrowserTest() {
115 params_ = TestParams(GetParam());
116 if (params_.use_mojo_service) {
117 scoped_feature_list_.InitAndEnableFeature(
118 video_capture::kMojoVideoCapture);
119 }
120 }
114 121
115 void SetUpAndStartCaptureDeviceOnIOThread(base::Closure continuation) { 122 void SetUpAndStartCaptureDeviceOnIOThread(base::Closure continuation) {
116 video_capture_manager_ = media_stream_manager_->video_capture_manager(); 123 video_capture_manager_ = media_stream_manager_->video_capture_manager();
117 ASSERT_TRUE(video_capture_manager_); 124 ASSERT_TRUE(video_capture_manager_);
118 video_capture_manager_->RegisterListener(&mock_stream_provider_listener_); 125 video_capture_manager_->RegisterListener(&mock_stream_provider_listener_);
119 video_capture_manager_->EnumerateDevices( 126 video_capture_manager_->EnumerateDevices(
120 base::Bind(&VideoCaptureBrowserTest::OnDeviceDescriptorsReceived, 127 base::Bind(&VideoCaptureBrowserTest::OnDeviceDescriptorsReceived,
121 base::Unretained(this), std::move(continuation))); 128 base::Unretained(this), std::move(continuation)));
122 } 129 }
123 130
(...skipping 26 matching lines...) Expand all
150 command_line->AppendSwitchASCII(switches::kUseFakeDeviceForMediaStream, 157 command_line->AppendSwitchASCII(switches::kUseFakeDeviceForMediaStream,
151 kFakeDeviceFactoryConfigString); 158 kFakeDeviceFactoryConfigString);
152 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream); 159 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream);
153 if (params_.exercise_accelerated_jpeg_decoding) { 160 if (params_.exercise_accelerated_jpeg_decoding) {
154 base::CommandLine::ForCurrentProcess()->AppendSwitch( 161 base::CommandLine::ForCurrentProcess()->AppendSwitch(
155 switches::kUseFakeJpegDecodeAccelerator); 162 switches::kUseFakeJpegDecodeAccelerator);
156 } else { 163 } else {
157 base::CommandLine::ForCurrentProcess()->AppendSwitch( 164 base::CommandLine::ForCurrentProcess()->AppendSwitch(
158 switches::kDisableAcceleratedMjpegDecode); 165 switches::kDisableAcceleratedMjpegDecode);
159 } 166 }
160 if (params_.use_mojo_service) {
161 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
162 switches::kEnableFeatures, video_capture::kMojoVideoCapture.name);
163 }
164 } 167 }
165 168
166 // This cannot be part of an override of SetUp(), because at the time when 169 // This cannot be part of an override of SetUp(), because at the time when
167 // SetUp() is invoked, the BrowserMainLoop does not exist yet. 170 // SetUp() is invoked, the BrowserMainLoop does not exist yet.
168 void SetUpRequiringBrowserMainLoopOnMainThread() { 171 void SetUpRequiringBrowserMainLoopOnMainThread() {
169 BrowserMainLoop* browser_main_loop = BrowserMainLoop::GetInstance(); 172 BrowserMainLoop* browser_main_loop = BrowserMainLoop::GetInstance();
170 ASSERT_TRUE(browser_main_loop); 173 ASSERT_TRUE(browser_main_loop);
171 media_stream_manager_ = browser_main_loop->media_stream_manager(); 174 media_stream_manager_ = browser_main_loop->media_stream_manager();
172 ASSERT_TRUE(media_stream_manager_); 175 ASSERT_TRUE(media_stream_manager_);
173 } 176 }
(...skipping 30 matching lines...) Expand all
204 207
205 protected: 208 protected:
206 TestParams params_; 209 TestParams params_;
207 MediaStreamManager* media_stream_manager_ = nullptr; 210 MediaStreamManager* media_stream_manager_ = nullptr;
208 VideoCaptureManager* video_capture_manager_ = nullptr; 211 VideoCaptureManager* video_capture_manager_ = nullptr;
209 int session_id_ = 0; 212 int session_id_ = 0;
210 const VideoCaptureControllerID stub_client_id_ = 123; 213 const VideoCaptureControllerID stub_client_id_ = 123;
211 MockMediaStreamProviderListener mock_stream_provider_listener_; 214 MockMediaStreamProviderListener mock_stream_provider_listener_;
212 MockVideoCaptureControllerEventHandler mock_controller_event_handler_; 215 MockVideoCaptureControllerEventHandler mock_controller_event_handler_;
213 base::WeakPtr<VideoCaptureController> controller_; 216 base::WeakPtr<VideoCaptureController> controller_;
217 base::test::ScopedFeatureList scoped_feature_list_;
214 }; 218 };
215 219
216 IN_PROC_BROWSER_TEST_P(VideoCaptureBrowserTest, StartAndImmediatelyStop) { 220 IN_PROC_BROWSER_TEST_P(VideoCaptureBrowserTest, StartAndImmediatelyStop) {
217 #if defined(OS_ANDROID) 221 #if defined(OS_ANDROID)
218 // Mojo video capture is currently not supported on Android. 222 // Mojo video capture is currently not supported on Android.
219 // TODO(chfremer): Remove this as soon as https://crbug.com/720500 is 223 // TODO(chfremer): Remove this as soon as https://crbug.com/720500 is
220 // resolved. 224 // resolved.
221 if (params_.use_mojo_service) 225 if (params_.use_mojo_service)
222 return; 226 return;
223 #endif 227 #endif
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 353
350 INSTANTIATE_TEST_CASE_P(, 354 INSTANTIATE_TEST_CASE_P(,
351 VideoCaptureBrowserTest, 355 VideoCaptureBrowserTest,
352 Combine(Values(0, 1, 2), // DeviceIndex 356 Combine(Values(0, 1, 2), // DeviceIndex
353 Values(gfx::Size(640, 480), // Resolution 357 Values(gfx::Size(640, 480), // Resolution
354 gfx::Size(1280, 720)), 358 gfx::Size(1280, 720)),
355 Bool(), // ExerciseAcceleratedJpegDecoding 359 Bool(), // ExerciseAcceleratedJpegDecoding
356 Bool())); // UseMojoService 360 Bool())); // UseMojoService
357 361
358 } // namespace content 362 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698