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 std::unique_ptr<Buffer>(const gfx::Size&, | 162 Buffer(const gfx::Size&, |
163 media::VideoPixelFormat, | 163 media::VideoPixelFormat, |
164 media::VideoPixelStorage, | 164 media::VideoPixelStorage, |
165 int)); | 165 int)); |
166 void OnIncomingCapturedBuffer(std::unique_ptr<Buffer> buffer, | 166 void OnIncomingCapturedBuffer(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 std::unique_ptr<Buffer> buffer, | 174 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(ResurrectLastOutputBuffer, | 183 MOCK_METHOD4( |
184 std::unique_ptr<Buffer>(const gfx::Size&, | 184 ResurrectLastOutputBuffer, |
185 VideoPixelFormat, | 185 Buffer(const gfx::Size&, VideoPixelFormat, VideoPixelStorage, int)); |
186 VideoPixelStorage, | |
187 int)); | |
188 MOCK_METHOD2(OnError, | 186 MOCK_METHOD2(OnError, |
189 void(const tracked_objects::Location& from_here, | 187 void(const tracked_objects::Location& from_here, |
190 const std::string& reason)); | 188 const std::string& reason)); |
191 MOCK_CONST_METHOD0(GetBufferPoolUtilization, double(void)); | 189 MOCK_CONST_METHOD0(GetBufferPoolUtilization, double(void)); |
192 }; | 190 }; |
193 | 191 |
194 class V4L2CaptureDelegateTest : public ::testing::Test { | 192 class V4L2CaptureDelegateTest : public ::testing::Test { |
195 public: | 193 public: |
196 V4L2CaptureDelegateTest() | 194 V4L2CaptureDelegateTest() |
197 : device_descriptor_("Device 0", "/dev/video0"), | 195 : device_descriptor_("Device 0", "/dev/video0"), |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 // their |default_value|s. | 250 // their |default_value|s. |
253 { | 251 { |
254 base::ScopedFD device_fd( | 252 base::ScopedFD device_fd( |
255 HANDLE_EINTR(open(device_descriptor_.device_id.c_str(), O_RDWR))); | 253 HANDLE_EINTR(open(device_descriptor_.device_id.c_str(), O_RDWR))); |
256 ASSERT_TRUE(device_fd.is_valid()); | 254 ASSERT_TRUE(device_fd.is_valid()); |
257 VerifyUserControlsAreSetToDefaultValues(device_fd.get()); | 255 VerifyUserControlsAreSetToDefaultValues(device_fd.get()); |
258 } | 256 } |
259 } | 257 } |
260 | 258 |
261 }; // namespace media | 259 }; // namespace media |
OLD | NEW |