OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <sys/fcntl.h> | 5 #include <sys/fcntl.h> |
6 #include <sys/ioctl.h> | 6 #include <sys/ioctl.h> |
7 | 7 |
8 #include "base/files/file_enumerator.h" | 8 #include "base/files/file_enumerator.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 public: | 152 public: |
153 MOCK_METHOD7(OnIncomingCapturedData, | 153 MOCK_METHOD7(OnIncomingCapturedData, |
154 void(const uint8_t*, | 154 void(const uint8_t*, |
155 int, | 155 int, |
156 const VideoCaptureFormat&, | 156 const VideoCaptureFormat&, |
157 int, | 157 int, |
158 base::TimeTicks, | 158 base::TimeTicks, |
159 base::TimeDelta, | 159 base::TimeDelta, |
160 int)); | 160 int)); |
161 MOCK_METHOD4(ReserveOutputBuffer, | 161 MOCK_METHOD4(ReserveOutputBuffer, |
162 Buffer(const gfx::Size&, | 162 std::unique_ptr<Buffer>(const gfx::Size&, |
163 media::VideoPixelFormat, | 163 media::VideoPixelFormat, |
164 media::VideoPixelStorage, | 164 media::VideoPixelStorage, |
165 int)); | 165 int)); |
166 void OnIncomingCapturedBuffer(Buffer buffer, | 166 void OnIncomingCapturedBuffer(std::unique_ptr<Buffer> buffer, |
167 const VideoCaptureFormat& frame_format, | 167 const VideoCaptureFormat& frame_format, |
168 base::TimeTicks reference_time, | 168 base::TimeTicks reference_time, |
169 base::TimeDelta timestamp) override { | 169 base::TimeDelta timestamp) override { |
170 DoOnIncomingCapturedBuffer(); | 170 DoOnIncomingCapturedBuffer(); |
171 } | 171 } |
172 MOCK_METHOD0(DoOnIncomingCapturedBuffer, void(void)); | 172 MOCK_METHOD0(DoOnIncomingCapturedBuffer, void(void)); |
173 void OnIncomingCapturedBufferExt( | 173 void OnIncomingCapturedBufferExt( |
174 Buffer buffer, | 174 std::unique_ptr<Buffer> buffer, |
175 const VideoCaptureFormat& format, | 175 const VideoCaptureFormat& format, |
176 base::TimeTicks reference_time, | 176 base::TimeTicks reference_time, |
177 base::TimeDelta timestamp, | 177 base::TimeDelta timestamp, |
178 gfx::Rect visible_rect, | 178 gfx::Rect visible_rect, |
179 const VideoFrameMetadata& additional_metadata) override { | 179 const VideoFrameMetadata& additional_metadata) override { |
180 DoOnIncomingCapturedVideoFrame(); | 180 DoOnIncomingCapturedVideoFrame(); |
181 } | 181 } |
182 MOCK_METHOD0(DoOnIncomingCapturedVideoFrame, void(void)); | 182 MOCK_METHOD0(DoOnIncomingCapturedVideoFrame, void(void)); |
183 MOCK_METHOD4( | 183 MOCK_METHOD4(ResurrectLastOutputBuffer, |
184 ResurrectLastOutputBuffer, | 184 std::unique_ptr<Buffer>(const gfx::Size&, |
185 Buffer(const gfx::Size&, VideoPixelFormat, VideoPixelStorage, int)); | 185 VideoPixelFormat, |
| 186 VideoPixelStorage, |
| 187 int)); |
186 MOCK_METHOD2(OnError, | 188 MOCK_METHOD2(OnError, |
187 void(const tracked_objects::Location& from_here, | 189 void(const tracked_objects::Location& from_here, |
188 const std::string& reason)); | 190 const std::string& reason)); |
189 MOCK_CONST_METHOD0(GetBufferPoolUtilization, double(void)); | 191 MOCK_CONST_METHOD0(GetBufferPoolUtilization, double(void)); |
190 }; | 192 }; |
191 | 193 |
192 class V4L2CaptureDelegateTest : public ::testing::Test { | 194 class V4L2CaptureDelegateTest : public ::testing::Test { |
193 public: | 195 public: |
194 V4L2CaptureDelegateTest() | 196 V4L2CaptureDelegateTest() |
195 : device_descriptor_("Device 0", "/dev/video0"), | 197 : device_descriptor_("Device 0", "/dev/video0"), |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 // their |default_value|s. | 252 // their |default_value|s. |
251 { | 253 { |
252 base::ScopedFD device_fd( | 254 base::ScopedFD device_fd( |
253 HANDLE_EINTR(open(device_descriptor_.device_id.c_str(), O_RDWR))); | 255 HANDLE_EINTR(open(device_descriptor_.device_id.c_str(), O_RDWR))); |
254 ASSERT_TRUE(device_fd.is_valid()); | 256 ASSERT_TRUE(device_fd.is_valid()); |
255 VerifyUserControlsAreSetToDefaultValues(device_fd.get()); | 257 VerifyUserControlsAreSetToDefaultValues(device_fd.get()); |
256 } | 258 } |
257 } | 259 } |
258 | 260 |
259 }; // namespace media | 261 }; // namespace media |
OLD | NEW |