| 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.h" | 6 #include "base/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 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 #if defined(OS_WIN) | 120 #if defined(OS_WIN) |
| 121 base::win::ScopedCOMInitializer initialize_com_; | 121 base::win::ScopedCOMInitializer initialize_com_; |
| 122 #endif | 122 #endif |
| 123 base::WaitableEvent wait_event_; | 123 base::WaitableEvent wait_event_; |
| 124 scoped_ptr<MockFrameObserver> frame_observer_; | 124 scoped_ptr<MockFrameObserver> frame_observer_; |
| 125 VideoCaptureDevice::Names names_; | 125 VideoCaptureDevice::Names names_; |
| 126 scoped_ptr<base::MessageLoop> loop_; | 126 scoped_ptr<base::MessageLoop> loop_; |
| 127 }; | 127 }; |
| 128 | 128 |
| 129 TEST_F(VideoCaptureDeviceTest, OpenInvalidDevice) { | 129 TEST_F(VideoCaptureDeviceTest, OpenInvalidDevice) { |
| 130 VideoCaptureDevice::Name device_name; | 130 VideoCaptureDevice::Name device_name("jibberish", "jibberish"); |
| 131 device_name.device_name = "jibberish"; | |
| 132 device_name.unique_id = "jibberish"; | |
| 133 VideoCaptureDevice* device = VideoCaptureDevice::Create(device_name); | 131 VideoCaptureDevice* device = VideoCaptureDevice::Create(device_name); |
| 134 EXPECT_TRUE(device == NULL); | 132 EXPECT_TRUE(device == NULL); |
| 135 } | 133 } |
| 136 | 134 |
| 137 TEST_F(VideoCaptureDeviceTest, CaptureVGA) { | 135 TEST_F(VideoCaptureDeviceTest, CaptureVGA) { |
| 138 VideoCaptureDevice::GetDeviceNames(&names_); | 136 VideoCaptureDevice::GetDeviceNames(&names_); |
| 139 if (!names_.size()) { | 137 if (!names_.size()) { |
| 140 DVLOG(1) << "No camera available. Exiting test."; | 138 DVLOG(1) << "No camera available. Exiting test."; |
| 141 return; | 139 return; |
| 142 } | 140 } |
| (...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 device->Allocate(1280, 720, 30, frame_observer_.get()); | 312 device->Allocate(1280, 720, 30, frame_observer_.get()); |
| 315 | 313 |
| 316 device->Start(); | 314 device->Start(); |
| 317 // Get captured video frames. | 315 // Get captured video frames. |
| 318 PostQuitTask(); | 316 PostQuitTask(); |
| 319 EXPECT_TRUE(wait_event_.TimedWait(TestTimeouts::action_max_timeout())); | 317 EXPECT_TRUE(wait_event_.TimedWait(TestTimeouts::action_max_timeout())); |
| 320 device->DeAllocate(); | 318 device->DeAllocate(); |
| 321 } | 319 } |
| 322 | 320 |
| 323 }; // namespace media | 321 }; // namespace media |
| OLD | NEW |