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