| 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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 virtual void OnFrameInfo( | 55 virtual void OnFrameInfo( |
| 56 const VideoCaptureCapability& info) OVERRIDE { | 56 const VideoCaptureCapability& info) OVERRIDE { |
| 57 OnFrameInfo(info.width, info.height, info.frame_rate, info.color); | 57 OnFrameInfo(info.width, info.height, info.frame_rate, info.color); |
| 58 } | 58 } |
| 59 | 59 |
| 60 virtual void OnIncomingCapturedFrame(const uint8* data, int length, | 60 virtual void OnIncomingCapturedFrame(const uint8* data, int length, |
| 61 base::Time timestamp) OVERRIDE { | 61 base::Time timestamp) OVERRIDE { |
| 62 wait_event_->Signal(); | 62 wait_event_->Signal(); |
| 63 } | 63 } |
| 64 | 64 |
| 65 virtual void OnIncomingCapturedVideoFrame(media::VideoFrame* frame, |
| 66 base::Time timestamp) OVERRIDE { |
| 67 wait_event_->Signal(); |
| 68 } |
| 69 |
| 65 private: | 70 private: |
| 66 base::WaitableEvent* wait_event_; | 71 base::WaitableEvent* wait_event_; |
| 67 }; | 72 }; |
| 68 | 73 |
| 69 class VideoCaptureDeviceTest : public testing::Test { | 74 class VideoCaptureDeviceTest : public testing::Test { |
| 70 public: | 75 public: |
| 71 VideoCaptureDeviceTest(): wait_event_(false, false) { } | 76 VideoCaptureDeviceTest(): wait_event_(false, false) { } |
| 72 | 77 |
| 73 void PostQuitTask() { | 78 void PostQuitTask() { |
| 74 loop_->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 79 loop_->PostTask(FROM_HERE, MessageLoop::QuitClosure()); |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 281 device->Allocate(1280, 720, 30, frame_observer_.get()); | 286 device->Allocate(1280, 720, 30, frame_observer_.get()); |
| 282 | 287 |
| 283 device->Start(); | 288 device->Start(); |
| 284 // Get captured video frames. | 289 // Get captured video frames. |
| 285 PostQuitTask(); | 290 PostQuitTask(); |
| 286 EXPECT_TRUE(wait_event_.TimedWait(TestTimeouts::action_max_timeout())); | 291 EXPECT_TRUE(wait_event_.TimedWait(TestTimeouts::action_max_timeout())); |
| 287 device->DeAllocate(); | 292 device->DeAllocate(); |
| 288 } | 293 } |
| 289 | 294 |
| 290 }; // namespace media | 295 }; // namespace media |
| OLD | NEW |