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

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

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

Powered by Google App Engine
This is Rietveld 408576698