| 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 21 matching lines...) Expand all Loading... |
| 32 #include "webrtc/base/win32.h" | 32 #include "webrtc/base/win32.h" |
| 33 #endif | 33 #endif |
| 34 #include <string> | 34 #include <string> |
| 35 | 35 |
| 36 #include "talk/media/base/fakevideocapturer.h" | 36 #include "talk/media/base/fakevideocapturer.h" |
| 37 #include "talk/media/base/screencastid.h" | 37 #include "talk/media/base/screencastid.h" |
| 38 #include "talk/media/base/testutils.h" | 38 #include "talk/media/base/testutils.h" |
| 39 #include "talk/media/base/videocapturerfactory.h" | 39 #include "talk/media/base/videocapturerfactory.h" |
| 40 #include "talk/media/devices/filevideocapturer.h" | 40 #include "talk/media/devices/filevideocapturer.h" |
| 41 #include "talk/media/devices/v4llookup.h" | 41 #include "talk/media/devices/v4llookup.h" |
| 42 #include "webrtc/base/arraysize.h" |
| 42 #include "webrtc/base/fileutils.h" | 43 #include "webrtc/base/fileutils.h" |
| 43 #include "webrtc/base/gunit.h" | 44 #include "webrtc/base/gunit.h" |
| 44 #include "webrtc/base/logging.h" | 45 #include "webrtc/base/logging.h" |
| 45 #include "webrtc/base/pathutils.h" | 46 #include "webrtc/base/pathutils.h" |
| 46 #include "webrtc/base/scoped_ptr.h" | 47 #include "webrtc/base/scoped_ptr.h" |
| 47 #include "webrtc/base/stream.h" | 48 #include "webrtc/base/stream.h" |
| 48 #include "webrtc/base/windowpickerfactory.h" | 49 #include "webrtc/base/windowpickerfactory.h" |
| 49 | 50 |
| 50 #ifdef LINUX | 51 #ifdef LINUX |
| 51 // TODO(juberti): Figure out why this doesn't compile on Windows. | 52 // TODO(juberti): Figure out why this doesn't compile on Windows. |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 "device4", | 263 "device4", |
| 263 "Google Camera Adapter", | 264 "Google Camera Adapter", |
| 264 NULL, | 265 NULL, |
| 265 }; | 266 }; |
| 266 static const char* const kDevicesName[] = { | 267 static const char* const kDevicesName[] = { |
| 267 "device1", | 268 "device1", |
| 268 "device3", | 269 "device3", |
| 269 "device5", | 270 "device5", |
| 270 }; | 271 }; |
| 271 std::vector<Device> devices; | 272 std::vector<Device> devices; |
| 272 for (int i = 0; i < ARRAY_SIZE(kTotalDevicesName); ++i) { | 273 for (int i = 0; i < arraysize(kTotalDevicesName); ++i) { |
| 273 devices.push_back(Device(kTotalDevicesName[i], i)); | 274 devices.push_back(Device(kTotalDevicesName[i], i)); |
| 274 } | 275 } |
| 275 EXPECT_TRUE(CompareDeviceList(devices, kTotalDevicesName, | 276 EXPECT_TRUE(CompareDeviceList(devices, kTotalDevicesName, |
| 276 ARRAY_SIZE(kTotalDevicesName))); | 277 arraysize(kTotalDevicesName))); |
| 277 // Return false if given NULL as the exclusion list. | 278 // Return false if given NULL as the exclusion list. |
| 278 EXPECT_TRUE(DeviceManager::FilterDevices(&devices, NULL)); | 279 EXPECT_TRUE(DeviceManager::FilterDevices(&devices, NULL)); |
| 279 // The devices should not change. | 280 // The devices should not change. |
| 280 EXPECT_TRUE(CompareDeviceList(devices, kTotalDevicesName, | 281 EXPECT_TRUE(CompareDeviceList(devices, kTotalDevicesName, |
| 281 ARRAY_SIZE(kTotalDevicesName))); | 282 arraysize(kTotalDevicesName))); |
| 282 EXPECT_TRUE(DeviceManager::FilterDevices(&devices, kFilteredDevicesName)); | 283 EXPECT_TRUE(DeviceManager::FilterDevices(&devices, kFilteredDevicesName)); |
| 283 EXPECT_TRUE(CompareDeviceList(devices, kDevicesName, | 284 EXPECT_TRUE(CompareDeviceList(devices, kDevicesName, |
| 284 ARRAY_SIZE(kDevicesName))); | 285 arraysize(kDevicesName))); |
| 285 } | 286 } |
| 286 | 287 |
| 287 #ifdef LINUX | 288 #ifdef LINUX |
| 288 class FakeV4LLookup : public cricket::V4LLookup { | 289 class FakeV4LLookup : public cricket::V4LLookup { |
| 289 public: | 290 public: |
| 290 explicit FakeV4LLookup(std::vector<std::string> device_paths) | 291 explicit FakeV4LLookup(std::vector<std::string> device_paths) |
| 291 : device_paths_(device_paths) {} | 292 : device_paths_(device_paths) {} |
| 292 | 293 |
| 293 protected: | 294 protected: |
| 294 bool CheckIsV4L2Device(const std::string& device) { | 295 bool CheckIsV4L2Device(const std::string& device) { |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 TEST_F(DeviceManagerTestFake, CaptureConstraintsWildcard) { | 462 TEST_F(DeviceManagerTestFake, CaptureConstraintsWildcard) { |
| 462 const Device device("any_device", "any_device"); | 463 const Device device("any_device", "any_device"); |
| 463 dm_->SetVideoCaptureDeviceMaxFormat("*", kHdFormat); | 464 dm_->SetVideoCaptureDeviceMaxFormat("*", kHdFormat); |
| 464 scoped_ptr<cricket::VideoCapturer> capturer( | 465 scoped_ptr<cricket::VideoCapturer> capturer( |
| 465 dm_->CreateVideoCapturer(device)); | 466 dm_->CreateVideoCapturer(device)); |
| 466 cricket::VideoFormat best_format; | 467 cricket::VideoFormat best_format; |
| 467 capturer->set_enable_camera_list(true); | 468 capturer->set_enable_camera_list(true); |
| 468 EXPECT_TRUE(capturer->GetBestCaptureFormat(kHdFormat, &best_format)); | 469 EXPECT_TRUE(capturer->GetBestCaptureFormat(kHdFormat, &best_format)); |
| 469 EXPECT_EQ(kHdFormat, best_format); | 470 EXPECT_EQ(kHdFormat, best_format); |
| 470 } | 471 } |
| OLD | NEW |