| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 virtual void OnFrameInfo( | 49 virtual void OnFrameInfo( |
| 50 const VideoCaptureDevice::Capability& info) OVERRIDE { | 50 const VideoCaptureDevice::Capability& info) OVERRIDE { |
| 51 OnFrameInfo(info.width, info.height, info.frame_rate); | 51 OnFrameInfo(info.width, info.height, info.frame_rate); |
| 52 } | 52 } |
| 53 | 53 |
| 54 virtual void OnIncomingCapturedFrame(const uint8* data, int length, | 54 virtual void OnIncomingCapturedFrame(const uint8* data, int length, |
| 55 base::Time timestamp) OVERRIDE { | 55 base::Time timestamp) OVERRIDE { |
| 56 wait_event_->Signal(); | 56 wait_event_->Signal(); |
| 57 } | 57 } |
| 58 | 58 |
| 59 virtual void OnDeviceState(bool in_use) OVERRIDE {} |
| 60 |
| 59 private: | 61 private: |
| 60 base::WaitableEvent* wait_event_; | 62 base::WaitableEvent* wait_event_; |
| 61 }; | 63 }; |
| 62 | 64 |
| 63 class VideoCaptureDeviceTest : public testing::Test { | 65 class VideoCaptureDeviceTest : public testing::Test { |
| 64 public: | 66 public: |
| 65 VideoCaptureDeviceTest(): wait_event_(false, false) { } | 67 VideoCaptureDeviceTest(): wait_event_(false, false) { } |
| 66 | 68 |
| 67 void PostQuitTask() { | 69 void PostQuitTask() { |
| 68 loop_->PostTask(FROM_HERE, new MessageLoop::QuitTask); | 70 loop_->PostTask(FROM_HERE, new MessageLoop::QuitTask); |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 device->Allocate(640, 480, 30, frame_observer_.get()); | 279 device->Allocate(640, 480, 30, frame_observer_.get()); |
| 278 | 280 |
| 279 device->Start(); | 281 device->Start(); |
| 280 EXPECT_TRUE(wait_event_.TimedWait(base::TimeDelta::FromMilliseconds( | 282 EXPECT_TRUE(wait_event_.TimedWait(base::TimeDelta::FromMilliseconds( |
| 281 TestTimeouts::action_max_timeout_ms()))); | 283 TestTimeouts::action_max_timeout_ms()))); |
| 282 device->Stop(); | 284 device->Stop(); |
| 283 device->DeAllocate(); | 285 device->DeAllocate(); |
| 284 } | 286 } |
| 285 | 287 |
| 286 }; // namespace media | 288 }; // namespace media |
| OLD | NEW |