| 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 27 matching lines...) Expand all Loading... |
| 38 #include "webrtc/base/gunit.h" | 38 #include "webrtc/base/gunit.h" |
| 39 #include "webrtc/base/logging.h" | 39 #include "webrtc/base/logging.h" |
| 40 #include "webrtc/base/pathutils.h" | 40 #include "webrtc/base/pathutils.h" |
| 41 #include "webrtc/base/scoped_ptr.h" | 41 #include "webrtc/base/scoped_ptr.h" |
| 42 #include "webrtc/base/stream.h" | 42 #include "webrtc/base/stream.h" |
| 43 #include "webrtc/base/windowpickerfactory.h" | 43 #include "webrtc/base/windowpickerfactory.h" |
| 44 #include "webrtc/media/base/fakevideocapturer.h" | 44 #include "webrtc/media/base/fakevideocapturer.h" |
| 45 #include "webrtc/media/base/screencastid.h" | 45 #include "webrtc/media/base/screencastid.h" |
| 46 #include "webrtc/media/base/testutils.h" | 46 #include "webrtc/media/base/testutils.h" |
| 47 #include "webrtc/media/base/videocapturerfactory.h" | 47 #include "webrtc/media/base/videocapturerfactory.h" |
| 48 #include "webrtc/media/devices/filevideocapturer.h" | |
| 49 #include "webrtc/media/devices/v4llookup.h" | 48 #include "webrtc/media/devices/v4llookup.h" |
| 50 | 49 |
| 51 #ifdef WEBRTC_LINUX | 50 #ifdef WEBRTC_LINUX |
| 52 // TODO(juberti): Figure out why this doesn't compile on Windows. | 51 // TODO(juberti): Figure out why this doesn't compile on Windows. |
| 53 #include "webrtc/base/fileutils_mock.h" | 52 #include "webrtc/base/fileutils_mock.h" |
| 54 #endif // WEBRTC_LINUX | 53 #endif // WEBRTC_LINUX |
| 55 | 54 |
| 56 using rtc::Pathname; | 55 using rtc::Pathname; |
| 57 using rtc::FileTimeType; | 56 using rtc::FileTimeType; |
| 58 using rtc::scoped_ptr; | 57 using rtc::scoped_ptr; |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 EXPECT_TRUE(dm->GetVideoCaptureDevice( | 194 EXPECT_TRUE(dm->GetVideoCaptureDevice( |
| 196 cricket::DeviceManagerInterface::kDefaultDeviceName, &device)); | 195 cricket::DeviceManagerInterface::kDefaultDeviceName, &device)); |
| 197 | 196 |
| 198 // Get the first device with the parameter video_ins[0].name. | 197 // Get the first device with the parameter video_ins[0].name. |
| 199 EXPECT_TRUE(dm->GetVideoCaptureDevice(video_ins[0].name, &device)); | 198 EXPECT_TRUE(dm->GetVideoCaptureDevice(video_ins[0].name, &device)); |
| 200 EXPECT_EQ(device.name, video_ins[0].name); | 199 EXPECT_EQ(device.name, video_ins[0].name); |
| 201 EXPECT_EQ(device.id, video_ins[0].id); | 200 EXPECT_EQ(device.id, video_ins[0].id); |
| 202 } | 201 } |
| 203 } | 202 } |
| 204 | 203 |
| 205 TEST(DeviceManagerTest, GetVideoDeviceIds_File) { | |
| 206 scoped_ptr<DeviceManagerInterface> dm(DeviceManagerFactory::Create()); | |
| 207 EXPECT_TRUE(dm->Init()); | |
| 208 Device device; | |
| 209 const std::string test_file = | |
| 210 cricket::GetTestFilePath("captured-320x240-2s-48.frames"); | |
| 211 EXPECT_TRUE(dm->GetVideoCaptureDevice(test_file, &device)); | |
| 212 EXPECT_TRUE(cricket::FileVideoCapturer::IsFileVideoCapturerDevice(device)); | |
| 213 } | |
| 214 | |
| 215 TEST(DeviceManagerTest, VerifyDevicesListsAreCleared) { | 204 TEST(DeviceManagerTest, VerifyDevicesListsAreCleared) { |
| 216 const std::string imaginary("_NOT A REAL DEVICE_"); | 205 const std::string imaginary("_NOT A REAL DEVICE_"); |
| 217 scoped_ptr<DeviceManagerInterface> dm(DeviceManagerFactory::Create()); | 206 scoped_ptr<DeviceManagerInterface> dm(DeviceManagerFactory::Create()); |
| 218 std::vector<Device> audio_ins, audio_outs, video_ins; | 207 std::vector<Device> audio_ins, audio_outs, video_ins; |
| 219 audio_ins.push_back(Device(imaginary, imaginary)); | 208 audio_ins.push_back(Device(imaginary, imaginary)); |
| 220 audio_outs.push_back(Device(imaginary, imaginary)); | 209 audio_outs.push_back(Device(imaginary, imaginary)); |
| 221 video_ins.push_back(Device(imaginary, imaginary)); | 210 video_ins.push_back(Device(imaginary, imaginary)); |
| 222 EXPECT_TRUE(dm->Init()); | 211 EXPECT_TRUE(dm->Init()); |
| 223 EXPECT_TRUE(dm->GetAudioInputDevices(&audio_ins)); | 212 EXPECT_TRUE(dm->GetAudioInputDevices(&audio_ins)); |
| 224 EXPECT_TRUE(dm->GetAudioOutputDevices(&audio_outs)); | 213 EXPECT_TRUE(dm->GetAudioOutputDevices(&audio_outs)); |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 TEST_F(DeviceManagerTestFake, CaptureConstraintsWildcard) { | 451 TEST_F(DeviceManagerTestFake, CaptureConstraintsWildcard) { |
| 463 const Device device("any_device", "any_device"); | 452 const Device device("any_device", "any_device"); |
| 464 dm_->SetVideoCaptureDeviceMaxFormat("*", kHdFormat); | 453 dm_->SetVideoCaptureDeviceMaxFormat("*", kHdFormat); |
| 465 scoped_ptr<cricket::VideoCapturer> capturer( | 454 scoped_ptr<cricket::VideoCapturer> capturer( |
| 466 dm_->CreateVideoCapturer(device)); | 455 dm_->CreateVideoCapturer(device)); |
| 467 cricket::VideoFormat best_format; | 456 cricket::VideoFormat best_format; |
| 468 capturer->set_enable_camera_list(true); | 457 capturer->set_enable_camera_list(true); |
| 469 EXPECT_TRUE(capturer->GetBestCaptureFormat(kHdFormat, &best_format)); | 458 EXPECT_TRUE(capturer->GetBestCaptureFormat(kHdFormat, &best_format)); |
| 470 EXPECT_EQ(kHdFormat, best_format); | 459 EXPECT_EQ(kHdFormat, best_format); |
| 471 } | 460 } |
| OLD | NEW |