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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
206 void(const tracked_objects::Location& from_here, | 206 void(const tracked_objects::Location& from_here, |
207 const std::string& reason)); | 207 const std::string& reason)); |
208 MOCK_CONST_METHOD0(GetBufferPoolUtilization, double(void)); | 208 MOCK_CONST_METHOD0(GetBufferPoolUtilization, double(void)); |
209 MOCK_METHOD0(OnStarted, void(void)); | 209 MOCK_METHOD0(OnStarted, void(void)); |
210 }; | 210 }; |
211 | 211 |
212 class V4L2CaptureDelegateTest : public ::testing::Test { | 212 class V4L2CaptureDelegateTest : public ::testing::Test { |
213 public: | 213 public: |
214 V4L2CaptureDelegateTest() | 214 V4L2CaptureDelegateTest() |
215 : device_descriptor_("Device 0", "/dev/video0"), | 215 : device_descriptor_("Device 0", "/dev/video0"), |
216 delegate_(new V4L2CaptureDelegate(device_descriptor_, | 216 delegate_(base::MakeUnique<V4L2CaptureDelegate>( |
217 base::ThreadTaskRunnerHandle::Get(), | 217 device_descriptor_, |
218 50)) {} | 218 base::ThreadTaskRunnerHandle::Get(), |
| 219 50)) {} |
219 ~V4L2CaptureDelegateTest() override = default; | 220 ~V4L2CaptureDelegateTest() override = default; |
220 | 221 |
221 base::MessageLoop loop_; | 222 base::MessageLoop loop_; |
222 VideoCaptureDeviceDescriptor device_descriptor_; | 223 VideoCaptureDeviceDescriptor device_descriptor_; |
223 scoped_refptr<V4L2CaptureDelegate> delegate_; | 224 std::unique_ptr<V4L2CaptureDelegate> delegate_; |
224 }; | 225 }; |
225 | 226 |
226 } // anonymous namespace | 227 } // anonymous namespace |
227 | 228 |
228 TEST_F(V4L2CaptureDelegateTest, CreateAndDestroyAndVerifyControls) { | 229 TEST_F(V4L2CaptureDelegateTest, CreateAndDestroyAndVerifyControls) { |
229 // Check that there is at least a video device, otherwise bail. | 230 // Check that there is at least a video device, otherwise bail. |
230 const base::FilePath path("/dev/"); | 231 const base::FilePath path("/dev/"); |
231 base::FileEnumerator enumerator(path, false, base::FileEnumerator::FILES, | 232 base::FileEnumerator enumerator(path, false, base::FileEnumerator::FILES, |
232 "video*"); | 233 "video*"); |
233 if (enumerator.Next().empty()) { | 234 if (enumerator.Next().empty()) { |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 // their |default_value|s. | 272 // their |default_value|s. |
272 { | 273 { |
273 base::ScopedFD device_fd( | 274 base::ScopedFD device_fd( |
274 HANDLE_EINTR(open(device_descriptor_.device_id.c_str(), O_RDWR))); | 275 HANDLE_EINTR(open(device_descriptor_.device_id.c_str(), O_RDWR))); |
275 ASSERT_TRUE(device_fd.is_valid()); | 276 ASSERT_TRUE(device_fd.is_valid()); |
276 VerifyUserControlsAreSetToDefaultValues(device_fd.get()); | 277 VerifyUserControlsAreSetToDefaultValues(device_fd.get()); |
277 } | 278 } |
278 } | 279 } |
279 | 280 |
280 }; // namespace media | 281 }; // namespace media |
OLD | NEW |