| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/message_loop/message_loop_proxy.h" |
| 8 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 9 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
| 10 #include "base/test/test_timeouts.h" | 11 #include "base/test/test_timeouts.h" |
| 11 #include "base/threading/thread.h" | 12 #include "base/threading/thread.h" |
| 12 #include "media/video/capture/fake_video_capture_device.h" | 13 #include "media/video/capture/fake_video_capture_device.h" |
| 13 #include "media/video/capture/fake_video_capture_device_factory.h" | 14 #include "media/video/capture/fake_video_capture_device_factory.h" |
| 14 #include "media/video/capture/video_capture_device.h" | 15 #include "media/video/capture/video_capture_device.h" |
| 15 #include "media/video/capture/video_capture_types.h" | 16 #include "media/video/capture/video_capture_types.h" |
| 16 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 TEST_F(VideoCaptureDeviceTest, OpenInvalidDevice) { | 171 TEST_F(VideoCaptureDeviceTest, OpenInvalidDevice) { |
| 171 #if defined(OS_WIN) | 172 #if defined(OS_WIN) |
| 172 VideoCaptureDevice::Name::CaptureApiType api_type = | 173 VideoCaptureDevice::Name::CaptureApiType api_type = |
| 173 VideoCaptureDeviceMFWin::PlatformSupported() | 174 VideoCaptureDeviceMFWin::PlatformSupported() |
| 174 ? VideoCaptureDevice::Name::MEDIA_FOUNDATION | 175 ? VideoCaptureDevice::Name::MEDIA_FOUNDATION |
| 175 : VideoCaptureDevice::Name::DIRECT_SHOW; | 176 : VideoCaptureDevice::Name::DIRECT_SHOW; |
| 176 VideoCaptureDevice::Name device_name("jibberish", "jibberish", api_type); | 177 VideoCaptureDevice::Name device_name("jibberish", "jibberish", api_type); |
| 177 #else | 178 #else |
| 178 VideoCaptureDevice::Name device_name("jibberish", "jibberish"); | 179 VideoCaptureDevice::Name device_name("jibberish", "jibberish"); |
| 179 #endif | 180 #endif |
| 180 VideoCaptureDevice* device = VideoCaptureDevice::Create(device_name); | 181 VideoCaptureDevice* device = VideoCaptureDevice::Create( |
| 182 base::MessageLoopProxy::current(), |
| 183 device_name); |
| 181 EXPECT_TRUE(device == NULL); | 184 EXPECT_TRUE(device == NULL); |
| 182 } | 185 } |
| 183 | 186 |
| 184 TEST_F(VideoCaptureDeviceTest, CaptureVGA) { | 187 TEST_F(VideoCaptureDeviceTest, CaptureVGA) { |
| 185 VideoCaptureDevice::GetDeviceNames(&names_); | 188 VideoCaptureDevice::GetDeviceNames(&names_); |
| 186 if (!names_.size()) { | 189 if (!names_.size()) { |
| 187 DVLOG(1) << "No camera available. Exiting test."; | 190 DVLOG(1) << "No camera available. Exiting test."; |
| 188 return; | 191 return; |
| 189 } | 192 } |
| 190 | 193 |
| 191 scoped_ptr<VideoCaptureDevice> device( | 194 scoped_ptr<VideoCaptureDevice> device( |
| 192 VideoCaptureDevice::Create(names_.front())); | 195 VideoCaptureDevice::Create( |
| 196 base::MessageLoopProxy::current(), |
| 197 names_.front())); |
| 193 ASSERT_TRUE(device); | 198 ASSERT_TRUE(device); |
| 194 DVLOG(1) << names_.front().id(); | 199 DVLOG(1) << names_.front().id(); |
| 195 | 200 |
| 196 EXPECT_CALL(*client_, OnErr()) | 201 EXPECT_CALL(*client_, OnErr()) |
| 197 .Times(0); | 202 .Times(0); |
| 198 | 203 |
| 199 VideoCaptureParams capture_params; | 204 VideoCaptureParams capture_params; |
| 200 capture_params.requested_format.frame_size.SetSize(640, 480); | 205 capture_params.requested_format.frame_size.SetSize(640, 480); |
| 201 capture_params.requested_format.frame_rate = 30; | 206 capture_params.requested_format.frame_rate = 30; |
| 202 capture_params.requested_format.pixel_format = PIXEL_FORMAT_I420; | 207 capture_params.requested_format.pixel_format = PIXEL_FORMAT_I420; |
| 203 capture_params.allow_resolution_change = false; | 208 capture_params.allow_resolution_change = false; |
| 204 device->AllocateAndStart(capture_params, client_.PassAs<Client>()); | 209 device->AllocateAndStart(capture_params, client_.PassAs<Client>()); |
| 205 // Get captured video frames. | 210 // Get captured video frames. |
| 206 WaitForCapturedFrame(); | 211 WaitForCapturedFrame(); |
| 207 EXPECT_EQ(last_format().frame_size.width(), 640); | 212 EXPECT_EQ(last_format().frame_size.width(), 640); |
| 208 EXPECT_EQ(last_format().frame_size.height(), 480); | 213 EXPECT_EQ(last_format().frame_size.height(), 480); |
| 209 device->StopAndDeAllocate(); | 214 device->StopAndDeAllocate(); |
| 210 } | 215 } |
| 211 | 216 |
| 212 TEST_F(VideoCaptureDeviceTest, Capture720p) { | 217 TEST_F(VideoCaptureDeviceTest, Capture720p) { |
| 213 VideoCaptureDevice::GetDeviceNames(&names_); | 218 VideoCaptureDevice::GetDeviceNames(&names_); |
| 214 if (!names_.size()) { | 219 if (!names_.size()) { |
| 215 DVLOG(1) << "No camera available. Exiting test."; | 220 DVLOG(1) << "No camera available. Exiting test."; |
| 216 return; | 221 return; |
| 217 } | 222 } |
| 218 | 223 |
| 219 scoped_ptr<VideoCaptureDevice> device( | 224 scoped_ptr<VideoCaptureDevice> device( |
| 220 VideoCaptureDevice::Create(names_.front())); | 225 VideoCaptureDevice::Create( |
| 226 base::MessageLoopProxy::current(), |
| 227 names_.front())); |
| 221 ASSERT_TRUE(device); | 228 ASSERT_TRUE(device); |
| 222 | 229 |
| 223 EXPECT_CALL(*client_, OnErr()) | 230 EXPECT_CALL(*client_, OnErr()) |
| 224 .Times(0); | 231 .Times(0); |
| 225 | 232 |
| 226 VideoCaptureParams capture_params; | 233 VideoCaptureParams capture_params; |
| 227 capture_params.requested_format.frame_size.SetSize(1280, 720); | 234 capture_params.requested_format.frame_size.SetSize(1280, 720); |
| 228 capture_params.requested_format.frame_rate = 30; | 235 capture_params.requested_format.frame_rate = 30; |
| 229 capture_params.requested_format.pixel_format = PIXEL_FORMAT_I420; | 236 capture_params.requested_format.pixel_format = PIXEL_FORMAT_I420; |
| 230 capture_params.allow_resolution_change = false; | 237 capture_params.allow_resolution_change = false; |
| 231 device->AllocateAndStart(capture_params, client_.PassAs<Client>()); | 238 device->AllocateAndStart(capture_params, client_.PassAs<Client>()); |
| 232 // Get captured video frames. | 239 // Get captured video frames. |
| 233 WaitForCapturedFrame(); | 240 WaitForCapturedFrame(); |
| 234 device->StopAndDeAllocate(); | 241 device->StopAndDeAllocate(); |
| 235 } | 242 } |
| 236 | 243 |
| 237 TEST_F(VideoCaptureDeviceTest, MAYBE_AllocateBadSize) { | 244 TEST_F(VideoCaptureDeviceTest, MAYBE_AllocateBadSize) { |
| 238 VideoCaptureDevice::GetDeviceNames(&names_); | 245 VideoCaptureDevice::GetDeviceNames(&names_); |
| 239 if (!names_.size()) { | 246 if (!names_.size()) { |
| 240 DVLOG(1) << "No camera available. Exiting test."; | 247 DVLOG(1) << "No camera available. Exiting test."; |
| 241 return; | 248 return; |
| 242 } | 249 } |
| 243 scoped_ptr<VideoCaptureDevice> device( | 250 scoped_ptr<VideoCaptureDevice> device( |
| 244 VideoCaptureDevice::Create(names_.front())); | 251 VideoCaptureDevice::Create(base::MessageLoopProxy::current(), |
| 252 names_.front())); |
| 245 ASSERT_TRUE(device); | 253 ASSERT_TRUE(device); |
| 246 | 254 |
| 247 EXPECT_CALL(*client_, OnErr()) | 255 EXPECT_CALL(*client_, OnErr()) |
| 248 .Times(0); | 256 .Times(0); |
| 249 | 257 |
| 250 VideoCaptureParams capture_params; | 258 VideoCaptureParams capture_params; |
| 251 capture_params.requested_format.frame_size.SetSize(637, 472); | 259 capture_params.requested_format.frame_size.SetSize(637, 472); |
| 252 capture_params.requested_format.frame_rate = 35; | 260 capture_params.requested_format.frame_rate = 35; |
| 253 capture_params.requested_format.pixel_format = PIXEL_FORMAT_I420; | 261 capture_params.requested_format.pixel_format = PIXEL_FORMAT_I420; |
| 254 capture_params.allow_resolution_change = false; | 262 capture_params.allow_resolution_change = false; |
| 255 device->AllocateAndStart(capture_params, client_.PassAs<Client>()); | 263 device->AllocateAndStart(capture_params, client_.PassAs<Client>()); |
| 256 WaitForCapturedFrame(); | 264 WaitForCapturedFrame(); |
| 257 device->StopAndDeAllocate(); | 265 device->StopAndDeAllocate(); |
| 258 EXPECT_EQ(last_format().frame_size.width(), 640); | 266 EXPECT_EQ(last_format().frame_size.width(), 640); |
| 259 EXPECT_EQ(last_format().frame_size.height(), 480); | 267 EXPECT_EQ(last_format().frame_size.height(), 480); |
| 260 } | 268 } |
| 261 | 269 |
| 262 TEST_F(VideoCaptureDeviceTest, ReAllocateCamera) { | 270 TEST_F(VideoCaptureDeviceTest, ReAllocateCamera) { |
| 263 VideoCaptureDevice::GetDeviceNames(&names_); | 271 VideoCaptureDevice::GetDeviceNames(&names_); |
| 264 if (!names_.size()) { | 272 if (!names_.size()) { |
| 265 DVLOG(1) << "No camera available. Exiting test."; | 273 DVLOG(1) << "No camera available. Exiting test."; |
| 266 return; | 274 return; |
| 267 } | 275 } |
| 268 | 276 |
| 269 // First, do a number of very fast device start/stops. | 277 // First, do a number of very fast device start/stops. |
| 270 for (int i = 0; i <= 5; i++) { | 278 for (int i = 0; i <= 5; i++) { |
| 271 ResetWithNewClient(); | 279 ResetWithNewClient(); |
| 272 scoped_ptr<VideoCaptureDevice> device( | 280 scoped_ptr<VideoCaptureDevice> device( |
| 273 VideoCaptureDevice::Create(names_.front())); | 281 VideoCaptureDevice::Create(base::MessageLoopProxy::current(), |
| 282 names_.front())); |
| 274 gfx::Size resolution; | 283 gfx::Size resolution; |
| 275 if (i % 2) { | 284 if (i % 2) { |
| 276 resolution = gfx::Size(640, 480); | 285 resolution = gfx::Size(640, 480); |
| 277 } else { | 286 } else { |
| 278 resolution = gfx::Size(1280, 1024); | 287 resolution = gfx::Size(1280, 1024); |
| 279 } | 288 } |
| 280 VideoCaptureParams capture_params; | 289 VideoCaptureParams capture_params; |
| 281 capture_params.requested_format.frame_size = resolution; | 290 capture_params.requested_format.frame_size = resolution; |
| 282 capture_params.requested_format.frame_rate = 30; | 291 capture_params.requested_format.frame_rate = 30; |
| 283 capture_params.requested_format.pixel_format = PIXEL_FORMAT_I420; | 292 capture_params.requested_format.pixel_format = PIXEL_FORMAT_I420; |
| 284 capture_params.allow_resolution_change = false; | 293 capture_params.allow_resolution_change = false; |
| 285 device->AllocateAndStart(capture_params, client_.PassAs<Client>()); | 294 device->AllocateAndStart(capture_params, client_.PassAs<Client>()); |
| 286 device->StopAndDeAllocate(); | 295 device->StopAndDeAllocate(); |
| 287 } | 296 } |
| 288 | 297 |
| 289 // Finally, do a device start and wait for it to finish. | 298 // Finally, do a device start and wait for it to finish. |
| 290 VideoCaptureParams capture_params; | 299 VideoCaptureParams capture_params; |
| 291 capture_params.requested_format.frame_size.SetSize(320, 240); | 300 capture_params.requested_format.frame_size.SetSize(320, 240); |
| 292 capture_params.requested_format.frame_rate = 30; | 301 capture_params.requested_format.frame_rate = 30; |
| 293 capture_params.requested_format.pixel_format = PIXEL_FORMAT_I420; | 302 capture_params.requested_format.pixel_format = PIXEL_FORMAT_I420; |
| 294 capture_params.allow_resolution_change = false; | 303 capture_params.allow_resolution_change = false; |
| 295 | 304 |
| 296 ResetWithNewClient(); | 305 ResetWithNewClient(); |
| 297 scoped_ptr<VideoCaptureDevice> device( | 306 scoped_ptr<VideoCaptureDevice> device( |
| 298 VideoCaptureDevice::Create(names_.front())); | 307 VideoCaptureDevice::Create(base::MessageLoopProxy::current(), |
| 308 names_.front())); |
| 299 | 309 |
| 300 device->AllocateAndStart(capture_params, client_.PassAs<Client>()); | 310 device->AllocateAndStart(capture_params, client_.PassAs<Client>()); |
| 301 WaitForCapturedFrame(); | 311 WaitForCapturedFrame(); |
| 302 device->StopAndDeAllocate(); | 312 device->StopAndDeAllocate(); |
| 303 device.reset(); | 313 device.reset(); |
| 304 EXPECT_EQ(last_format().frame_size.width(), 320); | 314 EXPECT_EQ(last_format().frame_size.width(), 320); |
| 305 EXPECT_EQ(last_format().frame_size.height(), 240); | 315 EXPECT_EQ(last_format().frame_size.height(), 240); |
| 306 } | 316 } |
| 307 | 317 |
| 308 TEST_F(VideoCaptureDeviceTest, DeAllocateCameraWhileRunning) { | 318 TEST_F(VideoCaptureDeviceTest, DeAllocateCameraWhileRunning) { |
| 309 VideoCaptureDevice::GetDeviceNames(&names_); | 319 VideoCaptureDevice::GetDeviceNames(&names_); |
| 310 if (!names_.size()) { | 320 if (!names_.size()) { |
| 311 DVLOG(1) << "No camera available. Exiting test."; | 321 DVLOG(1) << "No camera available. Exiting test."; |
| 312 return; | 322 return; |
| 313 } | 323 } |
| 314 scoped_ptr<VideoCaptureDevice> device( | 324 scoped_ptr<VideoCaptureDevice> device( |
| 315 VideoCaptureDevice::Create(names_.front())); | 325 VideoCaptureDevice::Create(base::MessageLoopProxy::current(), |
| 326 names_.front())); |
| 316 ASSERT_TRUE(device); | 327 ASSERT_TRUE(device); |
| 317 | 328 |
| 318 EXPECT_CALL(*client_, OnErr()) | 329 EXPECT_CALL(*client_, OnErr()) |
| 319 .Times(0); | 330 .Times(0); |
| 320 | 331 |
| 321 VideoCaptureParams capture_params; | 332 VideoCaptureParams capture_params; |
| 322 capture_params.requested_format.frame_size.SetSize(640, 480); | 333 capture_params.requested_format.frame_size.SetSize(640, 480); |
| 323 capture_params.requested_format.frame_rate = 30; | 334 capture_params.requested_format.frame_rate = 30; |
| 324 capture_params.requested_format.pixel_format = PIXEL_FORMAT_I420; | 335 capture_params.requested_format.pixel_format = PIXEL_FORMAT_I420; |
| 325 capture_params.allow_resolution_change = false; | 336 capture_params.allow_resolution_change = false; |
| 326 device->AllocateAndStart(capture_params, client_.PassAs<Client>()); | 337 device->AllocateAndStart(capture_params, client_.PassAs<Client>()); |
| 327 // Get captured video frames. | 338 // Get captured video frames. |
| 328 WaitForCapturedFrame(); | 339 WaitForCapturedFrame(); |
| 329 EXPECT_EQ(last_format().frame_size.width(), 640); | 340 EXPECT_EQ(last_format().frame_size.width(), 640); |
| 330 EXPECT_EQ(last_format().frame_size.height(), 480); | 341 EXPECT_EQ(last_format().frame_size.height(), 480); |
| 331 EXPECT_EQ(last_format().frame_rate, 30); | 342 EXPECT_EQ(last_format().frame_rate, 30); |
| 332 device->StopAndDeAllocate(); | 343 device->StopAndDeAllocate(); |
| 333 } | 344 } |
| 334 | 345 |
| 335 TEST_F(VideoCaptureDeviceTest, FakeCapture) { | 346 TEST_F(VideoCaptureDeviceTest, FakeCapture) { |
| 336 VideoCaptureDevice::Names names; | 347 VideoCaptureDevice::Names names; |
| 337 | 348 |
| 338 video_capture_device_factory_->GetDeviceNames(&names); | 349 video_capture_device_factory_->GetDeviceNames(&names); |
| 339 | 350 |
| 340 ASSERT_GT(static_cast<int>(names.size()), 0); | 351 ASSERT_GT(static_cast<int>(names.size()), 0); |
| 341 | 352 |
| 342 scoped_ptr<VideoCaptureDevice> device( | 353 scoped_ptr<VideoCaptureDevice> device( |
| 343 video_capture_device_factory_->Create(names.front())); | 354 video_capture_device_factory_->Create(base::MessageLoopProxy::current(), |
| 355 names.front())); |
| 344 ASSERT_TRUE(device); | 356 ASSERT_TRUE(device); |
| 345 | 357 |
| 346 EXPECT_CALL(*client_, OnErr()) | 358 EXPECT_CALL(*client_, OnErr()) |
| 347 .Times(0); | 359 .Times(0); |
| 348 | 360 |
| 349 VideoCaptureParams capture_params; | 361 VideoCaptureParams capture_params; |
| 350 capture_params.requested_format.frame_size.SetSize(640, 480); | 362 capture_params.requested_format.frame_size.SetSize(640, 480); |
| 351 capture_params.requested_format.frame_rate = 30; | 363 capture_params.requested_format.frame_rate = 30; |
| 352 capture_params.requested_format.pixel_format = PIXEL_FORMAT_I420; | 364 capture_params.requested_format.pixel_format = PIXEL_FORMAT_I420; |
| 353 capture_params.allow_resolution_change = false; | 365 capture_params.allow_resolution_change = false; |
| 354 device->AllocateAndStart(capture_params, client_.PassAs<Client>()); | 366 device->AllocateAndStart(capture_params, client_.PassAs<Client>()); |
| 355 WaitForCapturedFrame(); | 367 WaitForCapturedFrame(); |
| 356 EXPECT_EQ(last_format().frame_size.width(), 640); | 368 EXPECT_EQ(last_format().frame_size.width(), 640); |
| 357 EXPECT_EQ(last_format().frame_size.height(), 480); | 369 EXPECT_EQ(last_format().frame_size.height(), 480); |
| 358 EXPECT_EQ(last_format().frame_rate, 30); | 370 EXPECT_EQ(last_format().frame_rate, 30); |
| 359 device->StopAndDeAllocate(); | 371 device->StopAndDeAllocate(); |
| 360 } | 372 } |
| 361 | 373 |
| 362 // Start the camera in 720p to capture MJPEG instead of a raw format. | 374 // Start the camera in 720p to capture MJPEG instead of a raw format. |
| 363 TEST_F(VideoCaptureDeviceTest, MAYBE_CaptureMjpeg) { | 375 TEST_F(VideoCaptureDeviceTest, MAYBE_CaptureMjpeg) { |
| 364 scoped_ptr<VideoCaptureDevice::Name> name = | 376 scoped_ptr<VideoCaptureDevice::Name> name = |
| 365 GetFirstDeviceNameSupportingPixelFormat(PIXEL_FORMAT_MJPEG); | 377 GetFirstDeviceNameSupportingPixelFormat(PIXEL_FORMAT_MJPEG); |
| 366 if (!name) { | 378 if (!name) { |
| 367 DVLOG(1) << "No camera supports MJPEG format. Exiting test."; | 379 DVLOG(1) << "No camera supports MJPEG format. Exiting test."; |
| 368 return; | 380 return; |
| 369 } | 381 } |
| 370 scoped_ptr<VideoCaptureDevice> device(VideoCaptureDevice::Create(*name)); | 382 scoped_ptr<VideoCaptureDevice> device( |
| 383 VideoCaptureDevice::Create(base::MessageLoopProxy::current(), *name)); |
| 371 ASSERT_TRUE(device); | 384 ASSERT_TRUE(device); |
| 372 | 385 |
| 373 EXPECT_CALL(*client_, OnErr()) | 386 EXPECT_CALL(*client_, OnErr()) |
| 374 .Times(0); | 387 .Times(0); |
| 375 | 388 |
| 376 VideoCaptureParams capture_params; | 389 VideoCaptureParams capture_params; |
| 377 capture_params.requested_format.frame_size.SetSize(1280, 720); | 390 capture_params.requested_format.frame_size.SetSize(1280, 720); |
| 378 capture_params.requested_format.frame_rate = 30; | 391 capture_params.requested_format.frame_rate = 30; |
| 379 capture_params.requested_format.pixel_format = PIXEL_FORMAT_MJPEG; | 392 capture_params.requested_format.pixel_format = PIXEL_FORMAT_MJPEG; |
| 380 capture_params.allow_resolution_change = false; | 393 capture_params.allow_resolution_change = false; |
| (...skipping 22 matching lines...) Expand all Loading... |
| 403 video_capture_device_factory_->GetDeviceNames(&names); | 416 video_capture_device_factory_->GetDeviceNames(&names); |
| 404 VideoCaptureParams capture_params; | 417 VideoCaptureParams capture_params; |
| 405 capture_params.requested_format.frame_size.SetSize(640, 480); | 418 capture_params.requested_format.frame_size.SetSize(640, 480); |
| 406 capture_params.requested_format.frame_rate = 30; | 419 capture_params.requested_format.frame_rate = 30; |
| 407 capture_params.requested_format.pixel_format = PIXEL_FORMAT_I420; | 420 capture_params.requested_format.pixel_format = PIXEL_FORMAT_I420; |
| 408 capture_params.allow_resolution_change = true; | 421 capture_params.allow_resolution_change = true; |
| 409 | 422 |
| 410 ASSERT_GT(static_cast<int>(names.size()), 0); | 423 ASSERT_GT(static_cast<int>(names.size()), 0); |
| 411 | 424 |
| 412 scoped_ptr<VideoCaptureDevice> device( | 425 scoped_ptr<VideoCaptureDevice> device( |
| 413 video_capture_device_factory_->Create(names.front())); | 426 video_capture_device_factory_->Create(base::MessageLoopProxy::current(), |
| 427 names.front())); |
| 414 ASSERT_TRUE(device); | 428 ASSERT_TRUE(device); |
| 415 | 429 |
| 416 // Configure the FakeVideoCaptureDevice to use all its formats as roster. | 430 // Configure the FakeVideoCaptureDevice to use all its formats as roster. |
| 417 VideoCaptureFormats formats; | 431 VideoCaptureFormats formats; |
| 418 video_capture_device_factory_->GetDeviceSupportedFormats(names.front(), | 432 video_capture_device_factory_->GetDeviceSupportedFormats(names.front(), |
| 419 &formats); | 433 &formats); |
| 420 static_cast<FakeVideoCaptureDevice*>(device.get())-> | 434 static_cast<FakeVideoCaptureDevice*>(device.get())-> |
| 421 PopulateVariableFormatsRoster(formats); | 435 PopulateVariableFormatsRoster(formats); |
| 422 | 436 |
| 423 EXPECT_CALL(*client_, OnErr()) | 437 EXPECT_CALL(*client_, OnErr()) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 455 EXPECT_EQ(supported_formats[1].pixel_format, media::PIXEL_FORMAT_I420); | 469 EXPECT_EQ(supported_formats[1].pixel_format, media::PIXEL_FORMAT_I420); |
| 456 EXPECT_GE(supported_formats[1].frame_rate, 20); | 470 EXPECT_GE(supported_formats[1].frame_rate, 20); |
| 457 EXPECT_EQ(supported_formats[2].frame_size.width(), 1280); | 471 EXPECT_EQ(supported_formats[2].frame_size.width(), 1280); |
| 458 EXPECT_EQ(supported_formats[2].frame_size.height(), 720); | 472 EXPECT_EQ(supported_formats[2].frame_size.height(), 720); |
| 459 EXPECT_EQ(supported_formats[2].pixel_format, media::PIXEL_FORMAT_I420); | 473 EXPECT_EQ(supported_formats[2].pixel_format, media::PIXEL_FORMAT_I420); |
| 460 EXPECT_GE(supported_formats[2].frame_rate, 20); | 474 EXPECT_GE(supported_formats[2].frame_rate, 20); |
| 461 } | 475 } |
| 462 } | 476 } |
| 463 | 477 |
| 464 }; // namespace media | 478 }; // namespace media |
| OLD | NEW |