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

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: Ilya comments addressed 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 video_capture_manager_->DisconnectClient(controller_.get(), stub_client_id_, 139 video_capture_manager_->DisconnectClient(controller_.get(), stub_client_id_,
139 &mock_controller_event_handler_, 140 &mock_controller_event_handler_,
140 false); 141 false);
141 142
142 EXPECT_CALL(mock_stream_provider_listener_, Closed(_, _)) 143 EXPECT_CALL(mock_stream_provider_listener_, Closed(_, _))
143 .WillOnce(InvokeWithoutArgs([continuation]() { continuation.Run(); })); 144 .WillOnce(InvokeWithoutArgs([continuation]() { continuation.Run(); }));
144 145
145 video_capture_manager_->Close(session_id_); 146 video_capture_manager_->Close(session_id_);
146 } 147 }
147 148
149 void SetUp() override {
150 if (params_.use_mojo_service) {
151 scoped_feature_list_.InitAndEnableFeature(
152 video_capture::kMojoVideoCapture);
153 }
154 ContentBrowserTest::SetUp();
155 }
156
148 protected: 157 protected:
149 void SetUpCommandLine(base::CommandLine* command_line) override { 158 void SetUpCommandLine(base::CommandLine* command_line) override {
150 command_line->AppendSwitchASCII(switches::kUseFakeDeviceForMediaStream, 159 command_line->AppendSwitchASCII(switches::kUseFakeDeviceForMediaStream,
151 kFakeDeviceFactoryConfigString); 160 kFakeDeviceFactoryConfigString);
152 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream); 161 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream);
153 if (params_.exercise_accelerated_jpeg_decoding) { 162 if (params_.exercise_accelerated_jpeg_decoding) {
154 base::CommandLine::ForCurrentProcess()->AppendSwitch( 163 base::CommandLine::ForCurrentProcess()->AppendSwitch(
155 switches::kUseFakeJpegDecodeAccelerator); 164 switches::kUseFakeJpegDecodeAccelerator);
156 } else { 165 } else {
157 base::CommandLine::ForCurrentProcess()->AppendSwitch( 166 base::CommandLine::ForCurrentProcess()->AppendSwitch(
158 switches::kDisableAcceleratedMjpegDecode); 167 switches::kDisableAcceleratedMjpegDecode);
159 } 168 }
160 if (params_.use_mojo_service) {
161 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
162 switches::kEnableFeatures, video_capture::kMojoVideoCapture.name);
163 }
164 } 169 }
165 170
166 // This cannot be part of an override of SetUp(), because at the time when 171 // This cannot be part of an override of SetUp(), because at the time when
167 // SetUp() is invoked, the BrowserMainLoop does not exist yet. 172 // SetUp() is invoked, the BrowserMainLoop does not exist yet.
168 void SetUpRequiringBrowserMainLoopOnMainThread() { 173 void SetUpRequiringBrowserMainLoopOnMainThread() {
169 BrowserMainLoop* browser_main_loop = BrowserMainLoop::GetInstance(); 174 BrowserMainLoop* browser_main_loop = BrowserMainLoop::GetInstance();
170 ASSERT_TRUE(browser_main_loop); 175 ASSERT_TRUE(browser_main_loop);
171 media_stream_manager_ = browser_main_loop->media_stream_manager(); 176 media_stream_manager_ = browser_main_loop->media_stream_manager();
172 ASSERT_TRUE(media_stream_manager_); 177 ASSERT_TRUE(media_stream_manager_);
173 } 178 }
(...skipping 30 matching lines...) Expand all
204 209
205 protected: 210 protected:
206 TestParams params_; 211 TestParams params_;
207 MediaStreamManager* media_stream_manager_ = nullptr; 212 MediaStreamManager* media_stream_manager_ = nullptr;
208 VideoCaptureManager* video_capture_manager_ = nullptr; 213 VideoCaptureManager* video_capture_manager_ = nullptr;
209 int session_id_ = 0; 214 int session_id_ = 0;
210 const VideoCaptureControllerID stub_client_id_ = 123; 215 const VideoCaptureControllerID stub_client_id_ = 123;
211 MockMediaStreamProviderListener mock_stream_provider_listener_; 216 MockMediaStreamProviderListener mock_stream_provider_listener_;
212 MockVideoCaptureControllerEventHandler mock_controller_event_handler_; 217 MockVideoCaptureControllerEventHandler mock_controller_event_handler_;
213 base::WeakPtr<VideoCaptureController> controller_; 218 base::WeakPtr<VideoCaptureController> controller_;
219 base::test::ScopedFeatureList scoped_feature_list_;
214 }; 220 };
215 221
216 IN_PROC_BROWSER_TEST_P(VideoCaptureBrowserTest, StartAndImmediatelyStop) { 222 IN_PROC_BROWSER_TEST_P(VideoCaptureBrowserTest, StartAndImmediatelyStop) {
217 #if defined(OS_ANDROID) 223 #if defined(OS_ANDROID)
218 // Mojo video capture is currently not supported on Android. 224 // Mojo video capture is currently not supported on Android.
219 // TODO(chfremer): Remove this as soon as https://crbug.com/720500 is 225 // TODO(chfremer): Remove this as soon as https://crbug.com/720500 is
220 // resolved. 226 // resolved.
221 if (params_.use_mojo_service) 227 if (params_.use_mojo_service)
222 return; 228 return;
223 #endif 229 #endif
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 355
350 INSTANTIATE_TEST_CASE_P(, 356 INSTANTIATE_TEST_CASE_P(,
351 VideoCaptureBrowserTest, 357 VideoCaptureBrowserTest,
352 Combine(Values(0, 1, 2), // DeviceIndex 358 Combine(Values(0, 1, 2), // DeviceIndex
353 Values(gfx::Size(640, 480), // Resolution 359 Values(gfx::Size(640, 480), // Resolution
354 gfx::Size(1280, 720)), 360 gfx::Size(1280, 720)),
355 Bool(), // ExerciseAcceleratedJpegDecoding 361 Bool(), // ExerciseAcceleratedJpegDecoding
356 Bool())); // UseMojoService 362 Bool())); // UseMojoService
357 363
358 } // namespace content 364 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698