| OLD | NEW |
| 1 /* | 1 /* |
| 2 * libjingle | 2 * libjingle |
| 3 * Copyright 2013 Google Inc. | 3 * Copyright 2013 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 25 matching lines...) Expand all Loading... |
| 36 #include "talk/media/devices/fakedevicemanager.h" | 36 #include "talk/media/devices/fakedevicemanager.h" |
| 37 #include "webrtc/base/gunit.h" | 37 #include "webrtc/base/gunit.h" |
| 38 | 38 |
| 39 using webrtc::LocalAudioSource; | 39 using webrtc::LocalAudioSource; |
| 40 using webrtc::MediaConstraintsInterface; | 40 using webrtc::MediaConstraintsInterface; |
| 41 using webrtc::MediaSourceInterface; | 41 using webrtc::MediaSourceInterface; |
| 42 using webrtc::PeerConnectionFactoryInterface; | 42 using webrtc::PeerConnectionFactoryInterface; |
| 43 | 43 |
| 44 TEST(LocalAudioSourceTest, SetValidOptions) { | 44 TEST(LocalAudioSourceTest, SetValidOptions) { |
| 45 webrtc::FakeConstraints constraints; | 45 webrtc::FakeConstraints constraints; |
| 46 constraints.AddMandatory(MediaConstraintsInterface::kEchoCancellation, false); | 46 constraints.AddMandatory( |
| 47 MediaConstraintsInterface::kGoogEchoCancellation, false); |
| 47 constraints.AddOptional( | 48 constraints.AddOptional( |
| 48 MediaConstraintsInterface::kExtendedFilterEchoCancellation, true); | 49 MediaConstraintsInterface::kExtendedFilterEchoCancellation, true); |
| 49 constraints.AddOptional(MediaConstraintsInterface::kDAEchoCancellation, true); | 50 constraints.AddOptional(MediaConstraintsInterface::kDAEchoCancellation, true); |
| 50 constraints.AddOptional(MediaConstraintsInterface::kAutoGainControl, true); | 51 constraints.AddOptional(MediaConstraintsInterface::kAutoGainControl, true); |
| 51 constraints.AddOptional( | 52 constraints.AddOptional( |
| 52 MediaConstraintsInterface::kExperimentalAutoGainControl, true); | 53 MediaConstraintsInterface::kExperimentalAutoGainControl, true); |
| 53 constraints.AddMandatory(MediaConstraintsInterface::kNoiseSuppression, false); | 54 constraints.AddMandatory(MediaConstraintsInterface::kNoiseSuppression, false); |
| 54 constraints.AddOptional(MediaConstraintsInterface::kHighpassFilter, true); | 55 constraints.AddOptional(MediaConstraintsInterface::kHighpassFilter, true); |
| 55 constraints.AddOptional(MediaConstraintsInterface::kAecDump, true); | 56 constraints.AddOptional(MediaConstraintsInterface::kAecDump, true); |
| 56 | 57 |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 webrtc::FakeConstraints constraints; | 127 webrtc::FakeConstraints constraints; |
| 127 rtc::scoped_refptr<LocalAudioSource> source = | 128 rtc::scoped_refptr<LocalAudioSource> source = |
| 128 LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(), | 129 LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(), |
| 129 &constraints); | 130 &constraints); |
| 130 bool value; | 131 bool value; |
| 131 EXPECT_FALSE(source->options().highpass_filter.Get(&value)); | 132 EXPECT_FALSE(source->options().highpass_filter.Get(&value)); |
| 132 } | 133 } |
| 133 | 134 |
| 134 TEST(LocalAudioSourceTest, MandatoryOverridesOptional) { | 135 TEST(LocalAudioSourceTest, MandatoryOverridesOptional) { |
| 135 webrtc::FakeConstraints constraints; | 136 webrtc::FakeConstraints constraints; |
| 136 constraints.AddMandatory(MediaConstraintsInterface::kEchoCancellation, false); | 137 constraints.AddMandatory( |
| 137 constraints.AddOptional(MediaConstraintsInterface::kEchoCancellation, true); | 138 MediaConstraintsInterface::kGoogEchoCancellation, false); |
| 139 constraints.AddOptional( |
| 140 MediaConstraintsInterface::kGoogEchoCancellation, true); |
| 138 | 141 |
| 139 rtc::scoped_refptr<LocalAudioSource> source = | 142 rtc::scoped_refptr<LocalAudioSource> source = |
| 140 LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(), | 143 LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(), |
| 141 &constraints); | 144 &constraints); |
| 142 | 145 |
| 143 bool value; | 146 bool value; |
| 144 EXPECT_TRUE(source->options().echo_cancellation.Get(&value)); | 147 EXPECT_TRUE(source->options().echo_cancellation.Get(&value)); |
| 145 EXPECT_FALSE(value); | 148 EXPECT_FALSE(value); |
| 146 } | 149 } |
| 147 | 150 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 167 | 170 |
| 168 rtc::scoped_refptr<LocalAudioSource> source = | 171 rtc::scoped_refptr<LocalAudioSource> source = |
| 169 LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(), | 172 LocalAudioSource::Create(PeerConnectionFactoryInterface::Options(), |
| 170 &constraints); | 173 &constraints); |
| 171 | 174 |
| 172 EXPECT_EQ(MediaSourceInterface::kLive, source->state()); | 175 EXPECT_EQ(MediaSourceInterface::kLive, source->state()); |
| 173 bool value; | 176 bool value; |
| 174 EXPECT_TRUE(source->options().highpass_filter.Get(&value)); | 177 EXPECT_TRUE(source->options().highpass_filter.Get(&value)); |
| 175 EXPECT_FALSE(value); | 178 EXPECT_FALSE(value); |
| 176 } | 179 } |
| OLD | NEW |