| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2008 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2008 The WebRTC project authors. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 &fake_mc_, transport_controller_, cricket::CN_VIDEO, nullptr, false, | 162 &fake_mc_, transport_controller_, cricket::CN_VIDEO, nullptr, false, |
| 163 VideoOptions()); | 163 VideoOptions()); |
| 164 EXPECT_TRUE(video_channel == nullptr); | 164 EXPECT_TRUE(video_channel == nullptr); |
| 165 cricket::DataChannel* data_channel = | 165 cricket::DataChannel* data_channel = |
| 166 cm_->CreateDataChannel(transport_controller_, cricket::CN_DATA, nullptr, | 166 cm_->CreateDataChannel(transport_controller_, cricket::CN_DATA, nullptr, |
| 167 false, cricket::DCT_RTP); | 167 false, cricket::DCT_RTP); |
| 168 EXPECT_TRUE(data_channel == nullptr); | 168 EXPECT_TRUE(data_channel == nullptr); |
| 169 cm_->Terminate(); | 169 cm_->Terminate(); |
| 170 } | 170 } |
| 171 | 171 |
| 172 TEST_F(ChannelManagerTest, GetSetOutputVolumeBeforeInit) { | |
| 173 int level; | |
| 174 // Before init, SetOutputVolume() remembers the volume but does not change the | |
| 175 // volume of the engine. GetOutputVolume() should fail. | |
| 176 EXPECT_EQ(-1, fme_->output_volume()); | |
| 177 EXPECT_FALSE(cm_->GetOutputVolume(&level)); | |
| 178 EXPECT_FALSE(cm_->SetOutputVolume(-1)); // Invalid volume. | |
| 179 EXPECT_TRUE(cm_->SetOutputVolume(99)); | |
| 180 EXPECT_EQ(-1, fme_->output_volume()); | |
| 181 | |
| 182 // Init() will apply the remembered volume. | |
| 183 EXPECT_TRUE(cm_->Init()); | |
| 184 EXPECT_TRUE(cm_->GetOutputVolume(&level)); | |
| 185 EXPECT_EQ(99, level); | |
| 186 EXPECT_EQ(level, fme_->output_volume()); | |
| 187 | |
| 188 EXPECT_TRUE(cm_->SetOutputVolume(60)); | |
| 189 EXPECT_TRUE(cm_->GetOutputVolume(&level)); | |
| 190 EXPECT_EQ(60, level); | |
| 191 EXPECT_EQ(level, fme_->output_volume()); | |
| 192 } | |
| 193 | |
| 194 TEST_F(ChannelManagerTest, GetSetOutputVolume) { | |
| 195 int level; | |
| 196 EXPECT_TRUE(cm_->Init()); | |
| 197 EXPECT_TRUE(cm_->GetOutputVolume(&level)); | |
| 198 EXPECT_EQ(level, fme_->output_volume()); | |
| 199 | |
| 200 EXPECT_FALSE(cm_->SetOutputVolume(-1)); // Invalid volume. | |
| 201 EXPECT_TRUE(cm_->SetOutputVolume(60)); | |
| 202 EXPECT_EQ(60, fme_->output_volume()); | |
| 203 EXPECT_TRUE(cm_->GetOutputVolume(&level)); | |
| 204 EXPECT_EQ(60, level); | |
| 205 } | |
| 206 | |
| 207 TEST_F(ChannelManagerTest, SetVideoRtxEnabled) { | 172 TEST_F(ChannelManagerTest, SetVideoRtxEnabled) { |
| 208 std::vector<VideoCodec> codecs; | 173 std::vector<VideoCodec> codecs; |
| 209 const VideoCodec rtx_codec(96, "rtx", 0, 0, 0); | 174 const VideoCodec rtx_codec(96, "rtx", 0, 0, 0); |
| 210 | 175 |
| 211 // By default RTX is disabled. | 176 // By default RTX is disabled. |
| 212 cm_->GetSupportedVideoCodecs(&codecs); | 177 cm_->GetSupportedVideoCodecs(&codecs); |
| 213 EXPECT_FALSE(ContainsMatchingCodec(codecs, rtx_codec)); | 178 EXPECT_FALSE(ContainsMatchingCodec(codecs, rtx_codec)); |
| 214 | 179 |
| 215 // Enable and check. | 180 // Enable and check. |
| 216 EXPECT_TRUE(cm_->SetVideoRtxEnabled(true)); | 181 EXPECT_TRUE(cm_->SetVideoRtxEnabled(true)); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 228 EXPECT_FALSE(cm_->SetVideoRtxEnabled(false)); | 193 EXPECT_FALSE(cm_->SetVideoRtxEnabled(false)); |
| 229 | 194 |
| 230 // Can set again after terminate. | 195 // Can set again after terminate. |
| 231 cm_->Terminate(); | 196 cm_->Terminate(); |
| 232 EXPECT_TRUE(cm_->SetVideoRtxEnabled(true)); | 197 EXPECT_TRUE(cm_->SetVideoRtxEnabled(true)); |
| 233 cm_->GetSupportedVideoCodecs(&codecs); | 198 cm_->GetSupportedVideoCodecs(&codecs); |
| 234 EXPECT_TRUE(ContainsMatchingCodec(codecs, rtx_codec)); | 199 EXPECT_TRUE(ContainsMatchingCodec(codecs, rtx_codec)); |
| 235 } | 200 } |
| 236 | 201 |
| 237 } // namespace cricket | 202 } // namespace cricket |
| OLD | NEW |