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

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

Issue 2900583002: Revert of [Mojo Video Capture] Hook up video capture service behind a feature flag (Closed)
Patch Set: Rebase Created 3 years, 7 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 "build/build_config.h" 7 #include "build/build_config.h"
8 #include "content/browser/browser_main_loop.h" 8 #include "content/browser/browser_main_loop.h"
9 #include "content/browser/renderer_host/media/media_stream_manager.h" 9 #include "content/browser/renderer_host/media/media_stream_manager.h"
10 #include "content/browser/renderer_host/media/video_capture_controller.h" 10 #include "content/browser/renderer_host/media/video_capture_controller.h"
11 #include "content/browser/renderer_host/media/video_capture_manager.h" 11 #include "content/browser/renderer_host/media/video_capture_manager.h"
12 #include "content/public/common/content_switches.h" 12 #include "content/public/common/content_switches.h"
13 #include "content/public/test/content_browser_test.h" 13 #include "content/public/test/content_browser_test.h"
14 #include "media/base/bind_to_current_loop.h" 14 #include "media/base/bind_to_current_loop.h"
15 #include "media/base/media_switches.h" 15 #include "media/base/media_switches.h"
16 #include "media/capture/video_capture_types.h" 16 #include "media/capture/video_capture_types.h"
17 #include "services/video_capture/public/cpp/constants.h"
18 #include "testing/gmock/include/gmock/gmock.h" 17 #include "testing/gmock/include/gmock/gmock.h"
19 18
20 using testing::_; 19 using testing::_;
21 using testing::AtLeast; 20 using testing::AtLeast;
22 using testing::Bool;
23 using testing::Combine;
24 using testing::Invoke; 21 using testing::Invoke;
25 using testing::InvokeWithoutArgs; 22 using testing::InvokeWithoutArgs;
26 using testing::Values; 23 using testing::Values;
27 24
28 namespace content { 25 namespace content {
29 26
30 static const char kFakeDeviceFactoryConfigString[] = "device-count=3";
31 static const float kFrameRateToRequest = 15.0f;
32
33 class MockVideoCaptureControllerEventHandler 27 class MockVideoCaptureControllerEventHandler
34 : public VideoCaptureControllerEventHandler { 28 : public VideoCaptureControllerEventHandler {
35 public: 29 public:
36 MOCK_METHOD4(DoOnBufferCreated, 30 MOCK_METHOD4(DoOnBufferCreated,
37 void(VideoCaptureControllerID id, 31 void(VideoCaptureControllerID id,
38 mojo::ScopedSharedBufferHandle* handle, 32 mojo::ScopedSharedBufferHandle* handle,
39 int length, 33 int length,
40 int buffer_id)); 34 int buffer_id));
41 MOCK_METHOD2(OnBufferDestroyed, 35 MOCK_METHOD2(OnBufferDestroyed,
42 void(VideoCaptureControllerID, int buffer_id)); 36 void(VideoCaptureControllerID, int buffer_id));
(...skipping 15 matching lines...) Expand all
58 } 52 }
59 }; 53 };
60 54
61 class MockMediaStreamProviderListener : public MediaStreamProviderListener { 55 class MockMediaStreamProviderListener : public MediaStreamProviderListener {
62 public: 56 public:
63 MOCK_METHOD2(Opened, void(MediaStreamType, int)); 57 MOCK_METHOD2(Opened, void(MediaStreamType, int));
64 MOCK_METHOD2(Closed, void(MediaStreamType, int)); 58 MOCK_METHOD2(Closed, void(MediaStreamType, int));
65 MOCK_METHOD2(Aborted, void(MediaStreamType, int)); 59 MOCK_METHOD2(Aborted, void(MediaStreamType, int));
66 }; 60 };
67 61
68 using DeviceIndex = size_t;
69 using Resolution = gfx::Size;
70 using ExerciseAcceleratedJpegDecoding = bool;
71 using UseMojoService = bool;
72
73 // For converting the std::tuple<> used as test parameters back to something
74 // human-readable.
75 struct TestParams { 62 struct TestParams {
76 TestParams() : device_index_to_use(0u) {} 63 std::string fake_device_factory_config_string;
77 TestParams(const std::tuple<DeviceIndex,
78 Resolution,
79 ExerciseAcceleratedJpegDecoding,
80 UseMojoService>& params)
81 : device_index_to_use(std::get<0>(params)),
82 resolution_to_use(std::get<1>(params)),
83 exercise_accelerated_jpeg_decoding(std::get<2>(params)),
84 use_mojo_service(std::get<3>(params)) {}
85
86 media::VideoPixelFormat GetPixelFormatToUse() {
87 return (device_index_to_use == 1u) ? media::PIXEL_FORMAT_Y16
88 : media::PIXEL_FORMAT_I420;
89 }
90
91 size_t device_index_to_use; 64 size_t device_index_to_use;
65 media::VideoPixelFormat pixel_format_to_use;
92 gfx::Size resolution_to_use; 66 gfx::Size resolution_to_use;
67 float frame_rate_to_use;
93 bool exercise_accelerated_jpeg_decoding; 68 bool exercise_accelerated_jpeg_decoding;
94 bool use_mojo_service;
95 }; 69 };
96 70
97 struct FrameInfo { 71 struct FrameInfo {
98 gfx::Size size; 72 gfx::Size size;
99 media::VideoPixelFormat pixel_format; 73 media::VideoPixelFormat pixel_format;
100 media::VideoPixelStorage storage_type; 74 media::VideoPixelStorage storage_type;
101 base::TimeDelta timestamp; 75 base::TimeDelta timestamp;
102 }; 76 };
103 77
104 // Integration test that exercises the VideoCaptureManager instance running in 78 class VideoCaptureBrowserTest
105 // the Browser process. 79 : public ContentBrowserTest,
106 class VideoCaptureBrowserTest : public ContentBrowserTest, 80 public ::testing::WithParamInterface<TestParams> {
107 public ::testing::WithParamInterface<
108 std::tuple<DeviceIndex,
109 Resolution,
110 ExerciseAcceleratedJpegDecoding,
111 UseMojoService>> {
112 public: 81 public:
113 VideoCaptureBrowserTest() { params_ = TestParams(GetParam()); }
114
115 void SetUpAndStartCaptureDeviceOnIOThread(base::Closure continuation) { 82 void SetUpAndStartCaptureDeviceOnIOThread(base::Closure continuation) {
116 video_capture_manager_ = media_stream_manager_->video_capture_manager(); 83 video_capture_manager_ = media_stream_manager_->video_capture_manager();
117 ASSERT_TRUE(video_capture_manager_); 84 ASSERT_TRUE(video_capture_manager_);
118 video_capture_manager_->RegisterListener(&mock_stream_provider_listener_); 85 video_capture_manager_->RegisterListener(&mock_stream_provider_listener_);
119 video_capture_manager_->EnumerateDevices( 86 video_capture_manager_->EnumerateDevices(
120 base::Bind(&VideoCaptureBrowserTest::OnDeviceDescriptorsReceived, 87 base::Bind(&VideoCaptureBrowserTest::OnDeviceDescriptorsReceived,
121 base::Unretained(this), std::move(continuation))); 88 base::Unretained(this), std::move(continuation)));
122 } 89 }
123 90
124 void TearDownCaptureDeviceOnIOThread(base::Closure continuation, 91 void TearDownCaptureDeviceOnIOThread(base::Closure continuation,
125 bool post_to_end_of_message_queue) { 92 bool post_to_end_of_message_queue) {
126 // DisconnectClient() must not be called synchronously from either the 93 // StopCaptureForClient must not be called synchronously from either the
127 // |done_cb| passed to StartCaptureForClient() nor any callback made to a 94 // |done_cb| passed to StartCaptureForClient() nor any callback made to a
128 // VideoCaptureControllerEventHandler. To satisfy this, we have to post our 95 // VideoCaptureControllerEventHandler. To satisfy this, we have to post our
129 // invocation to the end of the IO message queue. 96 // invocation to the end of the IO message queue.
130 if (post_to_end_of_message_queue) { 97 if (post_to_end_of_message_queue) {
131 base::ThreadTaskRunnerHandle::Get()->PostTask( 98 base::ThreadTaskRunnerHandle::Get()->PostTask(
132 FROM_HERE, 99 FROM_HERE,
133 base::Bind(&VideoCaptureBrowserTest::TearDownCaptureDeviceOnIOThread, 100 base::Bind(&VideoCaptureBrowserTest::TearDownCaptureDeviceOnIOThread,
134 base::Unretained(this), continuation, false)); 101 base::Unretained(this), continuation, false));
135 return; 102 return;
136 } 103 }
137 104
138 video_capture_manager_->DisconnectClient(controller_.get(), stub_client_id_, 105 video_capture_manager_->DisconnectClient(controller_.get(), stub_client_id_,
139 &mock_controller_event_handler_, 106 &mock_controller_event_handler_,
140 false); 107 false);
141 108
142 EXPECT_CALL(mock_stream_provider_listener_, Closed(_, _)) 109 EXPECT_CALL(mock_stream_provider_listener_, Closed(_, _))
143 .WillOnce(InvokeWithoutArgs([continuation]() { continuation.Run(); })); 110 .WillOnce(InvokeWithoutArgs([continuation]() { continuation.Run(); }));
144 111
145 video_capture_manager_->Close(session_id_); 112 video_capture_manager_->Close(session_id_);
146 } 113 }
147 114
148 protected: 115 protected:
149 void SetUpCommandLine(base::CommandLine* command_line) override { 116 void SetUpCommandLine(base::CommandLine* command_line) override {
150 command_line->AppendSwitchASCII(switches::kUseFakeDeviceForMediaStream, 117 command_line->AppendSwitchASCII(
151 kFakeDeviceFactoryConfigString); 118 switches::kUseFakeDeviceForMediaStream,
119 GetParam().fake_device_factory_config_string);
152 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream); 120 command_line->AppendSwitch(switches::kUseFakeUIForMediaStream);
153 if (params_.exercise_accelerated_jpeg_decoding) { 121 if (GetParam().exercise_accelerated_jpeg_decoding) {
154 base::CommandLine::ForCurrentProcess()->AppendSwitch( 122 base::CommandLine::ForCurrentProcess()->AppendSwitch(
155 switches::kUseFakeJpegDecodeAccelerator); 123 switches::kUseFakeJpegDecodeAccelerator);
156 } else { 124 } else {
157 base::CommandLine::ForCurrentProcess()->AppendSwitch( 125 base::CommandLine::ForCurrentProcess()->AppendSwitch(
158 switches::kDisableAcceleratedMjpegDecode); 126 switches::kDisableAcceleratedMjpegDecode);
159 } 127 }
160 if (params_.use_mojo_service) {
161 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
162 switches::kEnableFeatures, video_capture::kMojoVideoCapture.name);
163 }
164 } 128 }
165 129
166 // This cannot be part of an override of SetUp(), because at the time when 130 // This cannot be part of an override of SetUp(), because at the time when
167 // SetUp() is invoked, the BrowserMainLoop does not exist yet. 131 // SetUp() is invoked, the BrowserMainLoop does not exist yet.
168 void SetUpRequiringBrowserMainLoopOnMainThread() { 132 void SetUpRequiringBrowserMainLoopOnMainThread() {
169 BrowserMainLoop* browser_main_loop = BrowserMainLoop::GetInstance(); 133 BrowserMainLoop* browser_main_loop = BrowserMainLoop::GetInstance();
170 ASSERT_TRUE(browser_main_loop); 134 ASSERT_TRUE(browser_main_loop);
171 media_stream_manager_ = browser_main_loop->media_stream_manager(); 135 media_stream_manager_ = browser_main_loop->media_stream_manager();
172 ASSERT_TRUE(media_stream_manager_); 136 ASSERT_TRUE(media_stream_manager_);
173 } 137 }
174 138
175 void OnDeviceDescriptorsReceived( 139 void OnDeviceDescriptorsReceived(
176 base::Closure continuation, 140 base::Closure continuation,
177 const media::VideoCaptureDeviceDescriptors& descriptors) { 141 const media::VideoCaptureDeviceDescriptors& descriptors) {
178 ASSERT_TRUE(params_.device_index_to_use < descriptors.size()); 142 ASSERT_TRUE(GetParam().device_index_to_use < descriptors.size());
179 const auto& descriptor = descriptors[params_.device_index_to_use]; 143 const auto& descriptor = descriptors[GetParam().device_index_to_use];
180 MediaStreamDevice media_stream_device( 144 MediaStreamDevice media_stream_device(
181 MEDIA_DEVICE_VIDEO_CAPTURE, descriptor.device_id, 145 MEDIA_DEVICE_VIDEO_CAPTURE, descriptor.device_id,
182 descriptor.display_name, descriptor.facing); 146 descriptor.display_name, descriptor.facing);
183 session_id_ = video_capture_manager_->Open(media_stream_device); 147 session_id_ = video_capture_manager_->Open(media_stream_device);
184 media::VideoCaptureParams capture_params; 148 media::VideoCaptureParams capture_params;
185 capture_params.requested_format = media::VideoCaptureFormat( 149 capture_params.requested_format = media::VideoCaptureFormat(
186 params_.resolution_to_use, kFrameRateToRequest, 150 GetParam().resolution_to_use, GetParam().frame_rate_to_use,
187 params_.GetPixelFormatToUse()); 151 GetParam().pixel_format_to_use);
188 video_capture_manager_->ConnectClient( 152 video_capture_manager_->ConnectClient(
189 session_id_, capture_params, stub_client_id_, 153 session_id_, capture_params, stub_client_id_,
190 &mock_controller_event_handler_, 154 &mock_controller_event_handler_,
191 base::Bind(&VideoCaptureBrowserTest::OnConnectClientToControllerAnswer, 155 base::Bind(&VideoCaptureBrowserTest::OnConnectClientToControllerAnswer,
192 base::Unretained(this), std::move(continuation))); 156 base::Unretained(this), std::move(continuation)));
193 } 157 }
194 158
195 void OnConnectClientToControllerAnswer( 159 void OnConnectClientToControllerAnswer(
196 base::Closure continuation, 160 base::Closure continuation,
197 const base::WeakPtr<VideoCaptureController>& controller) { 161 const base::WeakPtr<VideoCaptureController>& controller) {
198 ASSERT_TRUE(controller.get()); 162 ASSERT_TRUE(controller.get());
199 controller_ = controller; 163 controller_ = controller;
200 if (!continuation) 164 if (!continuation)
201 return; 165 return;
202 continuation.Run(); 166 continuation.Run();
203 } 167 }
204 168
205 protected: 169 protected:
206 TestParams params_;
207 MediaStreamManager* media_stream_manager_ = nullptr; 170 MediaStreamManager* media_stream_manager_ = nullptr;
208 VideoCaptureManager* video_capture_manager_ = nullptr; 171 VideoCaptureManager* video_capture_manager_ = nullptr;
209 int session_id_ = 0; 172 int session_id_ = 0;
210 const VideoCaptureControllerID stub_client_id_ = 123; 173 const VideoCaptureControllerID stub_client_id_ = 123;
211 MockMediaStreamProviderListener mock_stream_provider_listener_; 174 MockMediaStreamProviderListener mock_stream_provider_listener_;
212 MockVideoCaptureControllerEventHandler mock_controller_event_handler_; 175 MockVideoCaptureControllerEventHandler mock_controller_event_handler_;
213 base::WeakPtr<VideoCaptureController> controller_; 176 base::WeakPtr<VideoCaptureController> controller_;
214 }; 177 };
215 178
216 IN_PROC_BROWSER_TEST_P(VideoCaptureBrowserTest, StartAndImmediatelyStop) { 179 IN_PROC_BROWSER_TEST_P(VideoCaptureBrowserTest, StartAndImmediatelyStop) {
217 #if defined(OS_ANDROID)
218 // Mojo video capture is currently not supported on Android.
219 // TODO(chfremer): Remove this as soon as https://crbug.com/720500 is
220 // resolved.
221 if (params_.use_mojo_service)
222 return;
223 #endif
224 // Mojo video capture currently does not support accelerated jpeg decoding.
225 // TODO(chfremer): Remove this as soon as https://crbug.com/720604 is
226 // resolved.
227 if (params_.use_mojo_service && params_.exercise_accelerated_jpeg_decoding)
228 return;
229
230 SetUpRequiringBrowserMainLoopOnMainThread(); 180 SetUpRequiringBrowserMainLoopOnMainThread();
231 base::RunLoop run_loop; 181 base::RunLoop run_loop;
232 auto quit_run_loop_on_current_thread_cb = 182 auto quit_run_loop_on_current_thread_cb =
233 media::BindToCurrentLoop(run_loop.QuitClosure()); 183 media::BindToCurrentLoop(run_loop.QuitClosure());
234 auto after_start_continuation = 184 auto after_start_continuation =
235 base::Bind(&VideoCaptureBrowserTest::TearDownCaptureDeviceOnIOThread, 185 base::Bind(&VideoCaptureBrowserTest::TearDownCaptureDeviceOnIOThread,
236 base::Unretained(this), 186 base::Unretained(this),
237 std::move(quit_run_loop_on_current_thread_cb), true); 187 std::move(quit_run_loop_on_current_thread_cb), true);
238 BrowserThread::PostTask( 188 BrowserThread::PostTask(
239 content::BrowserThread::IO, FROM_HERE, 189 content::BrowserThread::IO, FROM_HERE,
240 base::Bind(&VideoCaptureBrowserTest::SetUpAndStartCaptureDeviceOnIOThread, 190 base::Bind(&VideoCaptureBrowserTest::SetUpAndStartCaptureDeviceOnIOThread,
241 base::Unretained(this), std::move(after_start_continuation))); 191 base::Unretained(this), std::move(after_start_continuation)));
242 run_loop.Run(); 192 run_loop.Run();
243 } 193 }
244 194
245 IN_PROC_BROWSER_TEST_P(VideoCaptureBrowserTest, 195 IN_PROC_BROWSER_TEST_P(VideoCaptureBrowserTest,
246 ReceiveFramesFromFakeCaptureDevice) { 196 ReceiveFramesFromFakeCaptureDevice) {
197 // TODO(chfremer): This test case is flaky on Android. Find out cause of
198 // flakiness and then re-enable. See crbug.com/709039.
247 #if defined(OS_ANDROID) 199 #if defined(OS_ANDROID)
248 // TODO(chfremer): This test case is flaky on Android. Find out cause of 200 if (GetParam().exercise_accelerated_jpeg_decoding)
249 // flakiness and then re-enable. See https://crbug.com/709039.
250 if (params_.exercise_accelerated_jpeg_decoding)
251 return;
252 // Mojo video capture is currently not supported on Android
253 // TODO(chfremer): Remove this as soon as https://crbug.com/720500 is
254 // resolved.
255 if (params_.use_mojo_service)
256 return; 201 return;
257 #endif 202 #endif
258 // Mojo video capture currently does not support accelerated jpeg decoding.
259 // TODO(chfremer): Remove this as soon as https://crbug.com/720604 is
260 // resolved.
261 if (params_.use_mojo_service && params_.exercise_accelerated_jpeg_decoding)
262 return;
263 // Only fake device with index 2 delivers MJPEG.
264 if (params_.exercise_accelerated_jpeg_decoding &&
265 params_.device_index_to_use != 2)
266 return;
267 203
268 SetUpRequiringBrowserMainLoopOnMainThread(); 204 SetUpRequiringBrowserMainLoopOnMainThread();
269 205
270 std::vector<FrameInfo> received_frame_infos; 206 std::vector<FrameInfo> received_frame_infos;
271 static const size_t kMinFramesToReceive = 5; 207 static const size_t kMinFramesToReceive = 5;
272 static const size_t kMaxFramesToReceive = 300; 208 static const size_t kMaxFramesToReceive = 300;
273 base::RunLoop run_loop; 209 base::RunLoop run_loop;
274 210
275 auto quit_run_loop_on_current_thread_cb = 211 auto quit_run_loop_on_current_thread_cb =
276 media::BindToCurrentLoop(run_loop.QuitClosure()); 212 media::BindToCurrentLoop(run_loop.QuitClosure());
277 auto finish_test_cb = 213 auto finish_test_cb =
278 base::Bind(&VideoCaptureBrowserTest::TearDownCaptureDeviceOnIOThread, 214 base::Bind(&VideoCaptureBrowserTest::TearDownCaptureDeviceOnIOThread,
279 base::Unretained(this), 215 base::Unretained(this),
280 std::move(quit_run_loop_on_current_thread_cb), true); 216 std::move(quit_run_loop_on_current_thread_cb), true);
281 217
282 bool must_wait_for_gpu_decode_to_start = false; 218 bool must_wait_for_gpu_decode_to_start = false;
283 if (params_.exercise_accelerated_jpeg_decoding) { 219 if (GetParam().exercise_accelerated_jpeg_decoding) {
284 // Since the GPU jpeg decoder is created asynchronously while decoding 220 // Since the GPU jpeg decoder is created asynchronously while decoding
285 // in software is ongoing, we have to keep pushing frames until a message 221 // in software is ongoing, we have to keep pushing frames until a message
286 // arrives that tells us that the GPU decoder is being used. Otherwise, 222 // arrives that tells us that the GPU decoder is being used. Otherwise,
287 // it may happen that all test frames are decoded using the non-GPU 223 // it may happen that all test frames are decoded using the non-GPU
288 // decoding path before the GPU decoder has started getting used. 224 // decoding path before the GPU decoder has started getting used.
289 must_wait_for_gpu_decode_to_start = true; 225 must_wait_for_gpu_decode_to_start = true;
290 EXPECT_CALL(mock_controller_event_handler_, OnStartedUsingGpuDecode(_)) 226 EXPECT_CALL(mock_controller_event_handler_, OnStartedUsingGpuDecode(_))
291 .WillOnce(InvokeWithoutArgs([&must_wait_for_gpu_decode_to_start]() { 227 .WillOnce(InvokeWithoutArgs([&must_wait_for_gpu_decode_to_start]() {
292 must_wait_for_gpu_decode_to_start = false; 228 must_wait_for_gpu_decode_to_start = false;
293 })); 229 }));
(...skipping 29 matching lines...) Expand all
323 base::Bind(&VideoCaptureBrowserTest::SetUpAndStartCaptureDeviceOnIOThread, 259 base::Bind(&VideoCaptureBrowserTest::SetUpAndStartCaptureDeviceOnIOThread,
324 base::Unretained(this), std::move(do_nothing))); 260 base::Unretained(this), std::move(do_nothing)));
325 run_loop.Run(); 261 run_loop.Run();
326 262
327 EXPECT_FALSE(must_wait_for_gpu_decode_to_start); 263 EXPECT_FALSE(must_wait_for_gpu_decode_to_start);
328 EXPECT_GE(received_frame_infos.size(), kMinFramesToReceive); 264 EXPECT_GE(received_frame_infos.size(), kMinFramesToReceive);
329 EXPECT_LT(received_frame_infos.size(), kMaxFramesToReceive); 265 EXPECT_LT(received_frame_infos.size(), kMaxFramesToReceive);
330 base::TimeDelta previous_timestamp; 266 base::TimeDelta previous_timestamp;
331 bool first_frame = true; 267 bool first_frame = true;
332 for (const auto& frame_info : received_frame_infos) { 268 for (const auto& frame_info : received_frame_infos) {
333 EXPECT_EQ(params_.GetPixelFormatToUse(), frame_info.pixel_format); 269 EXPECT_EQ(GetParam().pixel_format_to_use, frame_info.pixel_format);
334 EXPECT_EQ(media::PIXEL_STORAGE_CPU, frame_info.storage_type); 270 EXPECT_EQ(media::PIXEL_STORAGE_CPU, frame_info.storage_type);
335 EXPECT_EQ(params_.resolution_to_use, frame_info.size); 271 EXPECT_EQ(GetParam().resolution_to_use, frame_info.size);
336 // Timestamps are expected to increase 272 // Timestamps are expected to increase
337 if (!first_frame) 273 if (!first_frame)
338 EXPECT_GT(frame_info.timestamp, previous_timestamp); 274 EXPECT_GT(frame_info.timestamp, previous_timestamp);
339 first_frame = false; 275 first_frame = false;
340 previous_timestamp = frame_info.timestamp; 276 previous_timestamp = frame_info.timestamp;
341 } 277 }
342 } 278 }
343 279
344 INSTANTIATE_TEST_CASE_P(, 280 INSTANTIATE_TEST_CASE_P(
345 VideoCaptureBrowserTest, 281 ,
346 Combine(Values(0, 1, 2), // DeviceIndex 282 VideoCaptureBrowserTest,
347 Values(gfx::Size(640, 480), // Resolution 283 Values(TestParams{"fps=25,device-count=2", 0, media::PIXEL_FORMAT_I420,
348 gfx::Size(1280, 720)), 284 gfx::Size(1280, 720), 25.0f, false},
349 Bool(), // ExerciseAcceleratedJpegDecoding 285 // The 2nd device outputs Y16
350 Bool())); // UseMojoService 286 TestParams{"fps=25,device-count=2", 1, media::PIXEL_FORMAT_Y16,
287 gfx::Size(1280, 720), 25.0f, false},
288 TestParams{"fps=15,device-count=2", 1, media::PIXEL_FORMAT_Y16,
289 gfx::Size(640, 480), 15.0f, false},
290 // The 3rd device outputs MJPEG, which is converted to I420.
291 TestParams{"fps=15,device-count=3", 2, media::PIXEL_FORMAT_I420,
292 gfx::Size(640, 480), 25.0f, false},
293 TestParams{"fps=6,device-count=3", 2, media::PIXEL_FORMAT_I420,
294 gfx::Size(640, 480), 6.0f, true}));
351 295
352 } // namespace content 296 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698