OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 run_loop_->QuitClosure().Run(); | 91 run_loop_->QuitClosure().Run(); |
92 } | 92 } |
93 | 93 |
94 void WaitForCapturedFrame() { | 94 void WaitForCapturedFrame() { |
95 run_loop_.reset(new base::RunLoop()); | 95 run_loop_.reset(new base::RunLoop()); |
96 run_loop_->Run(); | 96 run_loop_->Run(); |
97 } | 97 } |
98 | 98 |
99 scoped_ptr<media::VideoCaptureDevice::Names> EnumerateDevices() { | 99 scoped_ptr<media::VideoCaptureDevice::Names> EnumerateDevices() { |
100 media::VideoCaptureDevice::Names* names; | 100 media::VideoCaptureDevice::Names* names; |
101 EXPECT_CALL(*device_enumeration_listener_, | 101 EXPECT_CALL(*device_enumeration_listener_.get(), |
102 OnEnumeratedDevicesCallbackPtr(_)).WillOnce(SaveArg<0>(&names)); | 102 OnEnumeratedDevicesCallbackPtr(_)).WillOnce(SaveArg<0>(&names)); |
103 | 103 |
104 video_capture_device_factory_->EnumerateDeviceNames( | 104 video_capture_device_factory_->EnumerateDeviceNames( |
105 base::Bind(&DeviceEnumerationListener::OnEnumeratedDevicesCallback, | 105 base::Bind(&DeviceEnumerationListener::OnEnumeratedDevicesCallback, |
106 device_enumeration_listener_)); | 106 device_enumeration_listener_)); |
107 base::MessageLoop::current()->RunUntilIdle(); | 107 base::MessageLoop::current()->RunUntilIdle(); |
108 return scoped_ptr<media::VideoCaptureDevice::Names>(names); | 108 return scoped_ptr<media::VideoCaptureDevice::Names>(names); |
109 } | 109 } |
110 | 110 |
111 const VideoCaptureFormat& last_format() const { return last_format_; } | 111 const VideoCaptureFormat& last_format() const { return last_format_; } |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 | 200 |
201 // We set TimeWait to 200 action timeouts and this should be enough for at | 201 // We set TimeWait to 200 action timeouts and this should be enough for at |
202 // least action_count/kFakeCaptureCapabilityChangePeriod calls. | 202 // least action_count/kFakeCaptureCapabilityChangePeriod calls. |
203 for (int i = 0; i < action_count; ++i) { | 203 for (int i = 0; i < action_count; ++i) { |
204 WaitForCapturedFrame(); | 204 WaitForCapturedFrame(); |
205 } | 205 } |
206 device->StopAndDeAllocate(); | 206 device->StopAndDeAllocate(); |
207 } | 207 } |
208 | 208 |
209 }; // namespace media | 209 }; // namespace media |
OLD | NEW |