| 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/test/scoped_task_environment.h" | 10 #include "base/test/scoped_task_environment.h" |
| 11 #include "base/threading/thread_task_runner_handle.h" | 11 #include "base/threading/thread_task_runner_handle.h" |
| 12 #include "build/build_config.h" |
| 12 #include "media/capture/video/linux/v4l2_capture_delegate.h" | 13 #include "media/capture/video/linux/v4l2_capture_delegate.h" |
| 13 #include "media/capture/video/video_capture_device.h" | 14 #include "media/capture/video/video_capture_device.h" |
| 14 #include "media/capture/video/video_capture_device_descriptor.h" | 15 #include "media/capture/video/video_capture_device_descriptor.h" |
| 15 #include "media/capture/video_capture_types.h" | 16 #include "media/capture/video_capture_types.h" |
| 16 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 19 |
| 19 using ::testing::_; | 20 using ::testing::_; |
| 20 | 21 |
| 21 namespace media { | 22 namespace media { |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 223 50)) {} | 224 50)) {} |
| 224 ~V4L2CaptureDelegateTest() override = default; | 225 ~V4L2CaptureDelegateTest() override = default; |
| 225 | 226 |
| 226 base::test::ScopedTaskEnvironment scoped_task_environment_; | 227 base::test::ScopedTaskEnvironment scoped_task_environment_; |
| 227 VideoCaptureDeviceDescriptor device_descriptor_; | 228 VideoCaptureDeviceDescriptor device_descriptor_; |
| 228 std::unique_ptr<V4L2CaptureDelegate> delegate_; | 229 std::unique_ptr<V4L2CaptureDelegate> delegate_; |
| 229 }; | 230 }; |
| 230 | 231 |
| 231 } // anonymous namespace | 232 } // anonymous namespace |
| 232 | 233 |
| 233 TEST_F(V4L2CaptureDelegateTest, CreateAndDestroyAndVerifyControls) { | 234 // Fails on Linux, see crbug/732355 |
| 235 #if defined(OS_LINUX) |
| 236 #define MAYBE_CreateAndDestroyAndVerifyControls \ |
| 237 DISABLED_CreateAndDestroyAndVerifyControls |
| 238 #else |
| 239 #define MAYBE_CrashingTest CreateAndDestroyAndVerifyControls |
| 240 #endif |
| 241 TEST_F(V4L2CaptureDelegateTest, MAYBE_CreateAndDestroyAndVerifyControls) { |
| 234 // Check that there is at least a video device, otherwise bail. | 242 // Check that there is at least a video device, otherwise bail. |
| 235 const base::FilePath path("/dev/"); | 243 const base::FilePath path("/dev/"); |
| 236 base::FileEnumerator enumerator(path, false, base::FileEnumerator::FILES, | 244 base::FileEnumerator enumerator(path, false, base::FileEnumerator::FILES, |
| 237 "video*"); | 245 "video*"); |
| 238 if (enumerator.Next().empty()) { | 246 if (enumerator.Next().empty()) { |
| 239 DLOG(INFO) << " No devices found, skipping test"; | 247 DLOG(INFO) << " No devices found, skipping test"; |
| 240 return; | 248 return; |
| 241 } | 249 } |
| 242 | 250 |
| 243 // Open device, manipulate user and camera controls, and close it. | 251 // Open device, manipulate user and camera controls, and close it. |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 // their |default_value|s. | 284 // their |default_value|s. |
| 277 { | 285 { |
| 278 base::ScopedFD device_fd( | 286 base::ScopedFD device_fd( |
| 279 HANDLE_EINTR(open(device_descriptor_.device_id.c_str(), O_RDWR))); | 287 HANDLE_EINTR(open(device_descriptor_.device_id.c_str(), O_RDWR))); |
| 280 ASSERT_TRUE(device_fd.is_valid()); | 288 ASSERT_TRUE(device_fd.is_valid()); |
| 281 VerifyUserControlsAreSetToDefaultValues(device_fd.get()); | 289 VerifyUserControlsAreSetToDefaultValues(device_fd.get()); |
| 282 } | 290 } |
| 283 } | 291 } |
| 284 | 292 |
| 285 }; // namespace media | 293 }; // namespace media |
| OLD | NEW |