| 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/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
| 10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 capture_params.allow_resolution_change = false; | 351 capture_params.allow_resolution_change = false; |
| 352 device->AllocateAndStart(capture_params, client_.PassAs<Client>()); | 352 device->AllocateAndStart(capture_params, client_.PassAs<Client>()); |
| 353 // Get captured video frames. | 353 // Get captured video frames. |
| 354 WaitForCapturedFrame(); | 354 WaitForCapturedFrame(); |
| 355 // Verify we get MJPEG from the device. Not all devices can capture 1280x720 | 355 // Verify we get MJPEG from the device. Not all devices can capture 1280x720 |
| 356 // @ 30 fps, so we don't care about the exact resolution we get. | 356 // @ 30 fps, so we don't care about the exact resolution we get. |
| 357 EXPECT_EQ(last_format().pixel_format, PIXEL_FORMAT_MJPEG); | 357 EXPECT_EQ(last_format().pixel_format, PIXEL_FORMAT_MJPEG); |
| 358 device->StopAndDeAllocate(); | 358 device->StopAndDeAllocate(); |
| 359 } | 359 } |
| 360 | 360 |
| 361 #if defined(OS_ANDROID) | |
| 362 // TODO(mcasas): Reenable this test that is disabled in Android due to | |
| 363 // http://crbug.com/327043. | |
| 364 TEST_F(VideoCaptureDeviceTest, DISABLED_GetDeviceSupportedFormats) { | |
| 365 #else | |
| 366 TEST_F(VideoCaptureDeviceTest, GetDeviceSupportedFormats) { | 361 TEST_F(VideoCaptureDeviceTest, GetDeviceSupportedFormats) { |
| 367 #endif | |
| 368 VideoCaptureDevice::GetDeviceNames(&names_); | 362 VideoCaptureDevice::GetDeviceNames(&names_); |
| 369 if (!names_.size()) { | 363 if (!names_.size()) { |
| 370 DVLOG(1) << "No camera available. Exiting test."; | 364 DVLOG(1) << "No camera available. Exiting test."; |
| 371 return; | 365 return; |
| 372 } | 366 } |
| 373 VideoCaptureFormats supported_formats; | 367 VideoCaptureFormats supported_formats; |
| 374 VideoCaptureDevice::Names::iterator names_iterator; | 368 VideoCaptureDevice::Names::iterator names_iterator; |
| 375 for (names_iterator = names_.begin(); names_iterator != names_.end(); | 369 for (names_iterator = names_.begin(); names_iterator != names_.end(); |
| 376 ++names_iterator) { | 370 ++names_iterator) { |
| 377 VideoCaptureDevice::GetDeviceSupportedFormats(*names_iterator, | 371 VideoCaptureDevice::GetDeviceSupportedFormats(*names_iterator, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 427 EXPECT_EQ(supported_formats[0].pixel_format, media::PIXEL_FORMAT_I420); | 421 EXPECT_EQ(supported_formats[0].pixel_format, media::PIXEL_FORMAT_I420); |
| 428 EXPECT_GE(supported_formats[0].frame_rate, 20); | 422 EXPECT_GE(supported_formats[0].frame_rate, 20); |
| 429 EXPECT_EQ(supported_formats[1].frame_size.width(), 320); | 423 EXPECT_EQ(supported_formats[1].frame_size.width(), 320); |
| 430 EXPECT_EQ(supported_formats[1].frame_size.height(), 240); | 424 EXPECT_EQ(supported_formats[1].frame_size.height(), 240); |
| 431 EXPECT_EQ(supported_formats[1].pixel_format, media::PIXEL_FORMAT_I420); | 425 EXPECT_EQ(supported_formats[1].pixel_format, media::PIXEL_FORMAT_I420); |
| 432 EXPECT_GE(supported_formats[1].frame_rate, 20); | 426 EXPECT_GE(supported_formats[1].frame_rate, 20); |
| 433 } | 427 } |
| 434 } | 428 } |
| 435 | 429 |
| 436 }; // namespace media | 430 }; // namespace media |
| OLD | NEW |