OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2004 Google Inc. | 3 * Copyright 2004 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 30 matching lines...) Expand all Loading... |
41 #include "talk/media/devices/v4llookup.h" | 41 #include "talk/media/devices/v4llookup.h" |
42 #include "webrtc/base/arraysize.h" | 42 #include "webrtc/base/arraysize.h" |
43 #include "webrtc/base/fileutils.h" | 43 #include "webrtc/base/fileutils.h" |
44 #include "webrtc/base/gunit.h" | 44 #include "webrtc/base/gunit.h" |
45 #include "webrtc/base/logging.h" | 45 #include "webrtc/base/logging.h" |
46 #include "webrtc/base/pathutils.h" | 46 #include "webrtc/base/pathutils.h" |
47 #include "webrtc/base/scoped_ptr.h" | 47 #include "webrtc/base/scoped_ptr.h" |
48 #include "webrtc/base/stream.h" | 48 #include "webrtc/base/stream.h" |
49 #include "webrtc/base/windowpickerfactory.h" | 49 #include "webrtc/base/windowpickerfactory.h" |
50 | 50 |
51 #ifdef LINUX | 51 #ifdef WEBRTC_LINUX |
52 // TODO(juberti): Figure out why this doesn't compile on Windows. | 52 // TODO(juberti): Figure out why this doesn't compile on Windows. |
53 #include "webrtc/base/fileutils_mock.h" | 53 #include "webrtc/base/fileutils_mock.h" |
54 #endif // LINUX | 54 #endif // WEBRTC_LINUX |
55 | 55 |
56 using rtc::Pathname; | 56 using rtc::Pathname; |
57 using rtc::FileTimeType; | 57 using rtc::FileTimeType; |
58 using rtc::scoped_ptr; | 58 using rtc::scoped_ptr; |
59 using cricket::Device; | 59 using cricket::Device; |
60 using cricket::DeviceManager; | 60 using cricket::DeviceManager; |
61 using cricket::DeviceManagerFactory; | 61 using cricket::DeviceManagerFactory; |
62 using cricket::DeviceManagerInterface; | 62 using cricket::DeviceManagerInterface; |
63 | 63 |
64 const cricket::VideoFormat kVgaFormat(640, 480, | 64 const cricket::VideoFormat kVgaFormat(640, 480, |
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 // Return false if given NULL as the exclusion list. | 278 // Return false if given NULL as the exclusion list. |
279 EXPECT_TRUE(DeviceManager::FilterDevices(&devices, NULL)); | 279 EXPECT_TRUE(DeviceManager::FilterDevices(&devices, NULL)); |
280 // The devices should not change. | 280 // The devices should not change. |
281 EXPECT_TRUE(CompareDeviceList(devices, kTotalDevicesName, | 281 EXPECT_TRUE(CompareDeviceList(devices, kTotalDevicesName, |
282 arraysize(kTotalDevicesName))); | 282 arraysize(kTotalDevicesName))); |
283 EXPECT_TRUE(DeviceManager::FilterDevices(&devices, kFilteredDevicesName)); | 283 EXPECT_TRUE(DeviceManager::FilterDevices(&devices, kFilteredDevicesName)); |
284 EXPECT_TRUE(CompareDeviceList(devices, kDevicesName, | 284 EXPECT_TRUE(CompareDeviceList(devices, kDevicesName, |
285 arraysize(kDevicesName))); | 285 arraysize(kDevicesName))); |
286 } | 286 } |
287 | 287 |
288 #ifdef LINUX | 288 #ifdef WEBRTC_LINUX |
289 class FakeV4LLookup : public cricket::V4LLookup { | 289 class FakeV4LLookup : public cricket::V4LLookup { |
290 public: | 290 public: |
291 explicit FakeV4LLookup(std::vector<std::string> device_paths) | 291 explicit FakeV4LLookup(std::vector<std::string> device_paths) |
292 : device_paths_(device_paths) {} | 292 : device_paths_(device_paths) {} |
293 | 293 |
294 protected: | 294 protected: |
295 bool CheckIsV4L2Device(const std::string& device) { | 295 bool CheckIsV4L2Device(const std::string& device) { |
296 return std::find(device_paths_.begin(), device_paths_.end(), device) | 296 return std::find(device_paths_.begin(), device_paths_.end(), device) |
297 != device_paths_.end(); | 297 != device_paths_.end(); |
298 } | 298 } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
370 rtc::FilesystemScope fs(new rtc::FakeFileSystem(files)); | 370 rtc::FilesystemScope fs(new rtc::FakeFileSystem(files)); |
371 | 371 |
372 scoped_ptr<DeviceManagerInterface> dm(DeviceManagerFactory::Create()); | 372 scoped_ptr<DeviceManagerInterface> dm(DeviceManagerFactory::Create()); |
373 std::vector<Device> video_ins; | 373 std::vector<Device> video_ins; |
374 EXPECT_TRUE(dm->Init()); | 374 EXPECT_TRUE(dm->Init()); |
375 EXPECT_TRUE(dm->GetVideoCaptureDevices(&video_ins)); | 375 EXPECT_TRUE(dm->GetVideoCaptureDevices(&video_ins)); |
376 EXPECT_EQ(2u, video_ins.size()); | 376 EXPECT_EQ(2u, video_ins.size()); |
377 EXPECT_EQ("/dev/video0", video_ins.at(0).name); | 377 EXPECT_EQ("/dev/video0", video_ins.at(0).name); |
378 EXPECT_EQ("/dev/video5", video_ins.at(1).name); | 378 EXPECT_EQ("/dev/video5", video_ins.at(1).name); |
379 } | 379 } |
380 #endif // LINUX | 380 #endif // WEBRTC_LINUX |
381 | 381 |
382 // TODO(noahric): These are flaky on windows on headless machines. | 382 // TODO(noahric): These are flaky on windows on headless machines. |
383 #ifndef WIN32 | 383 #ifndef WIN32 |
384 TEST(DeviceManagerTest, GetWindows) { | 384 TEST(DeviceManagerTest, GetWindows) { |
385 if (!rtc::WindowPickerFactory::IsSupported()) { | 385 if (!rtc::WindowPickerFactory::IsSupported()) { |
386 LOG(LS_INFO) << "skipping test: window capturing is not supported with " | 386 LOG(LS_INFO) << "skipping test: window capturing is not supported with " |
387 << "current configuration."; | 387 << "current configuration."; |
388 return; | 388 return; |
389 } | 389 } |
390 scoped_ptr<DeviceManagerInterface> dm(DeviceManagerFactory::Create()); | 390 scoped_ptr<DeviceManagerInterface> dm(DeviceManagerFactory::Create()); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 TEST_F(DeviceManagerTestFake, CaptureConstraintsWildcard) { | 462 TEST_F(DeviceManagerTestFake, CaptureConstraintsWildcard) { |
463 const Device device("any_device", "any_device"); | 463 const Device device("any_device", "any_device"); |
464 dm_->SetVideoCaptureDeviceMaxFormat("*", kHdFormat); | 464 dm_->SetVideoCaptureDeviceMaxFormat("*", kHdFormat); |
465 scoped_ptr<cricket::VideoCapturer> capturer( | 465 scoped_ptr<cricket::VideoCapturer> capturer( |
466 dm_->CreateVideoCapturer(device)); | 466 dm_->CreateVideoCapturer(device)); |
467 cricket::VideoFormat best_format; | 467 cricket::VideoFormat best_format; |
468 capturer->set_enable_camera_list(true); | 468 capturer->set_enable_camera_list(true); |
469 EXPECT_TRUE(capturer->GetBestCaptureFormat(kHdFormat, &best_format)); | 469 EXPECT_TRUE(capturer->GetBestCaptureFormat(kHdFormat, &best_format)); |
470 EXPECT_EQ(kHdFormat, best_format); | 470 EXPECT_EQ(kHdFormat, best_format); |
471 } | 471 } |
OLD | NEW |