| 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 21 matching lines...) Expand all Loading... |
| 32 MOCK_METHOD3(OnFrameInfo, void(int width, int height, int frame_rate)); | 32 MOCK_METHOD3(OnFrameInfo, void(int width, int height, int frame_rate)); |
| 33 | 33 |
| 34 explicit MockFrameObserver(base::WaitableEvent* wait_event) | 34 explicit MockFrameObserver(base::WaitableEvent* wait_event) |
| 35 : wait_event_(wait_event) {} | 35 : wait_event_(wait_event) {} |
| 36 | 36 |
| 37 virtual void OnError() OVERRIDE { | 37 virtual void OnError() OVERRIDE { |
| 38 OnErr(); | 38 OnErr(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 virtual void OnFrameInfo( | 41 virtual void OnFrameInfo( |
| 42 const VideoCaptureDevice::Capability& info) OVERRIDE { | 42 const VideoCaptureCapability& info) OVERRIDE { |
| 43 OnFrameInfo(info.width, info.height, info.frame_rate); | 43 OnFrameInfo(info.width, info.height, info.frame_rate); |
| 44 } | 44 } |
| 45 | 45 |
| 46 virtual void OnIncomingCapturedFrame(const uint8* data, int length, | 46 virtual void OnIncomingCapturedFrame(const uint8* data, int length, |
| 47 base::Time timestamp) OVERRIDE { | 47 base::Time timestamp) OVERRIDE { |
| 48 wait_event_->Signal(); | 48 wait_event_->Signal(); |
| 49 } | 49 } |
| 50 | 50 |
| 51 private: | 51 private: |
| 52 base::WaitableEvent* wait_event_; | 52 base::WaitableEvent* wait_event_; |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 device->Allocate(640, 480, 30, frame_observer_.get()); | 242 device->Allocate(640, 480, 30, frame_observer_.get()); |
| 243 | 243 |
| 244 device->Start(); | 244 device->Start(); |
| 245 EXPECT_TRUE(wait_event_.TimedWait(base::TimeDelta::FromMilliseconds( | 245 EXPECT_TRUE(wait_event_.TimedWait(base::TimeDelta::FromMilliseconds( |
| 246 TestTimeouts::action_max_timeout_ms()))); | 246 TestTimeouts::action_max_timeout_ms()))); |
| 247 device->Stop(); | 247 device->Stop(); |
| 248 device->DeAllocate(); | 248 device->DeAllocate(); |
| 249 } | 249 } |
| 250 | 250 |
| 251 }; // namespace media | 251 }; // namespace media |
| OLD | NEW |