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/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "base/synchronization/waitable_event.h" | 7 #include "base/synchronization/waitable_event.h" |
8 #include "base/test/test_timeouts.h" | 8 #include "base/test/test_timeouts.h" |
9 #include "base/threading/thread.h" | 9 #include "base/threading/thread.h" |
10 #include "media/video/capture/fake_video_capture_device.h" | 10 #include "media/video/capture/fake_video_capture_device.h" |
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
330 device->Start(); | 330 device->Start(); |
331 // Get captured video frames. | 331 // Get captured video frames. |
332 PostQuitTask(); | 332 PostQuitTask(); |
333 EXPECT_TRUE(wait_event_.TimedWait(TestTimeouts::action_max_timeout())); | 333 EXPECT_TRUE(wait_event_.TimedWait(TestTimeouts::action_max_timeout())); |
334 EXPECT_EQ(rx_capability.width, 640); | 334 EXPECT_EQ(rx_capability.width, 640); |
335 EXPECT_EQ(rx_capability.height, 480); | 335 EXPECT_EQ(rx_capability.height, 480); |
336 EXPECT_EQ(rx_capability.frame_rate, 30); | 336 EXPECT_EQ(rx_capability.frame_rate, 30); |
337 device->DeAllocate(); | 337 device->DeAllocate(); |
338 } | 338 } |
339 | 339 |
340 TEST_F(VideoCaptureDeviceTest, TestFakeCapture) { | 340 TEST_F(VideoCaptureDeviceTest, FakeCapture) { |
341 VideoCaptureDevice::Names names; | 341 VideoCaptureDevice::Names names; |
342 | 342 |
343 FakeVideoCaptureDevice::GetDeviceNames(&names); | 343 FakeVideoCaptureDevice::GetDeviceNames(&names); |
344 | 344 |
345 ASSERT_GT(static_cast<int>(names.size()), 0); | 345 ASSERT_GT(static_cast<int>(names.size()), 0); |
346 | 346 |
347 scoped_ptr<VideoCaptureDevice> device( | 347 scoped_ptr<VideoCaptureDevice> device( |
348 FakeVideoCaptureDevice::Create(names.front())); | 348 FakeVideoCaptureDevice::Create(names.front())); |
349 ASSERT_TRUE(device.get() != NULL); | 349 ASSERT_TRUE(device.get() != NULL); |
350 | 350 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 device->Allocate(capture_format, frame_observer_.get()); | 403 device->Allocate(capture_format, frame_observer_.get()); |
404 | 404 |
405 device->Start(); | 405 device->Start(); |
406 // Get captured video frames. | 406 // Get captured video frames. |
407 PostQuitTask(); | 407 PostQuitTask(); |
408 EXPECT_TRUE(wait_event_.TimedWait(TestTimeouts::action_max_timeout())); | 408 EXPECT_TRUE(wait_event_.TimedWait(TestTimeouts::action_max_timeout())); |
409 EXPECT_EQ(rx_capability.color, VideoCaptureCapability::kMJPEG); | 409 EXPECT_EQ(rx_capability.color, VideoCaptureCapability::kMJPEG); |
410 device->DeAllocate(); | 410 device->DeAllocate(); |
411 } | 411 } |
412 | 412 |
413 TEST_F(VideoCaptureDeviceTest, TestFakeCaptureVariableResolution) { | 413 TEST_F(VideoCaptureDeviceTest, FakeCaptureVariableResolution) { |
414 VideoCaptureDevice::Names names; | 414 VideoCaptureDevice::Names names; |
415 | 415 |
416 FakeVideoCaptureDevice::GetDeviceNames(&names); | 416 FakeVideoCaptureDevice::GetDeviceNames(&names); |
417 media::VideoCaptureCapability capture_format; | 417 media::VideoCaptureCapability capture_format; |
418 capture_format.width = 640; | 418 capture_format.width = 640; |
419 capture_format.height = 480; | 419 capture_format.height = 480; |
420 capture_format.frame_rate = 30; | 420 capture_format.frame_rate = 30; |
421 capture_format.frame_size_type = media::VariableResolutionVideoCaptureDevice; | 421 capture_format.frame_size_type = media::VariableResolutionVideoCaptureDevice; |
422 | 422 |
423 ASSERT_GT(static_cast<int>(names.size()), 0); | 423 ASSERT_GT(static_cast<int>(names.size()), 0); |
(...skipping 20 matching lines...) Expand all Loading... |
444 .Times(AtLeast(action_count / 30)); | 444 .Times(AtLeast(action_count / 30)); |
445 device->Start(); | 445 device->Start(); |
446 for (int i = 0; i < action_count; ++i) { | 446 for (int i = 0; i < action_count; ++i) { |
447 EXPECT_TRUE(wait_event_.TimedWait(TestTimeouts::action_timeout())); | 447 EXPECT_TRUE(wait_event_.TimedWait(TestTimeouts::action_timeout())); |
448 } | 448 } |
449 device->Stop(); | 449 device->Stop(); |
450 device->DeAllocate(); | 450 device->DeAllocate(); |
451 } | 451 } |
452 | 452 |
453 }; // namespace media | 453 }; // namespace media |
OLD | NEW |