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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 cricket::DataChannel* data_channel = | 136 cricket::DataChannel* data_channel = |
137 cm_->CreateDataChannel(transport_controller_, cricket::CN_DATA, nullptr, | 137 cm_->CreateDataChannel(transport_controller_, cricket::CN_DATA, nullptr, |
138 false, cricket::DCT_RTP); | 138 false, cricket::DCT_RTP); |
139 EXPECT_TRUE(data_channel != nullptr); | 139 EXPECT_TRUE(data_channel != nullptr); |
140 cm_->DestroyVideoChannel(video_channel); | 140 cm_->DestroyVideoChannel(video_channel); |
141 cm_->DestroyVoiceChannel(voice_channel); | 141 cm_->DestroyVoiceChannel(voice_channel); |
142 cm_->DestroyDataChannel(data_channel); | 142 cm_->DestroyDataChannel(data_channel); |
143 cm_->Terminate(); | 143 cm_->Terminate(); |
144 } | 144 } |
145 | 145 |
| 146 // Test that we fail to create a voice/video channel if the session is unable |
| 147 // to create a cricket::TransportChannel |
| 148 TEST_F(ChannelManagerTest, NoTransportChannelTest) { |
| 149 EXPECT_TRUE(cm_->Init()); |
| 150 transport_controller_->set_fail_channel_creation(true); |
| 151 // The test is useless unless the session does not fail creating |
| 152 // cricket::TransportChannel. |
| 153 ASSERT_TRUE(transport_controller_->CreateTransportChannel_n( |
| 154 "audio", cricket::ICE_CANDIDATE_COMPONENT_RTP) == nullptr); |
| 155 |
| 156 cricket::VoiceChannel* voice_channel = cm_->CreateVoiceChannel( |
| 157 &fake_mc_, transport_controller_, cricket::CN_AUDIO, nullptr, false, |
| 158 AudioOptions()); |
| 159 EXPECT_TRUE(voice_channel == nullptr); |
| 160 cricket::VideoChannel* video_channel = cm_->CreateVideoChannel( |
| 161 &fake_mc_, transport_controller_, cricket::CN_VIDEO, nullptr, false, |
| 162 VideoOptions()); |
| 163 EXPECT_TRUE(video_channel == nullptr); |
| 164 cricket::DataChannel* data_channel = |
| 165 cm_->CreateDataChannel(transport_controller_, cricket::CN_DATA, nullptr, |
| 166 false, cricket::DCT_RTP); |
| 167 EXPECT_TRUE(data_channel == nullptr); |
| 168 cm_->Terminate(); |
| 169 } |
| 170 |
146 TEST_F(ChannelManagerTest, SetVideoRtxEnabled) { | 171 TEST_F(ChannelManagerTest, SetVideoRtxEnabled) { |
147 std::vector<VideoCodec> codecs; | 172 std::vector<VideoCodec> codecs; |
148 const VideoCodec rtx_codec(96, "rtx"); | 173 const VideoCodec rtx_codec(96, "rtx"); |
149 | 174 |
150 // By default RTX is disabled. | 175 // By default RTX is disabled. |
151 cm_->GetSupportedVideoCodecs(&codecs); | 176 cm_->GetSupportedVideoCodecs(&codecs); |
152 EXPECT_FALSE(ContainsMatchingCodec(codecs, rtx_codec)); | 177 EXPECT_FALSE(ContainsMatchingCodec(codecs, rtx_codec)); |
153 | 178 |
154 // Enable and check. | 179 // Enable and check. |
155 EXPECT_TRUE(cm_->SetVideoRtxEnabled(true)); | 180 EXPECT_TRUE(cm_->SetVideoRtxEnabled(true)); |
(...skipping 11 matching lines...) Expand all Loading... |
167 EXPECT_FALSE(cm_->SetVideoRtxEnabled(false)); | 192 EXPECT_FALSE(cm_->SetVideoRtxEnabled(false)); |
168 | 193 |
169 // Can set again after terminate. | 194 // Can set again after terminate. |
170 cm_->Terminate(); | 195 cm_->Terminate(); |
171 EXPECT_TRUE(cm_->SetVideoRtxEnabled(true)); | 196 EXPECT_TRUE(cm_->SetVideoRtxEnabled(true)); |
172 cm_->GetSupportedVideoCodecs(&codecs); | 197 cm_->GetSupportedVideoCodecs(&codecs); |
173 EXPECT_TRUE(ContainsMatchingCodec(codecs, rtx_codec)); | 198 EXPECT_TRUE(ContainsMatchingCodec(codecs, rtx_codec)); |
174 } | 199 } |
175 | 200 |
176 } // namespace cricket | 201 } // namespace cricket |
OLD | NEW |