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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 TEST_F(ChannelManagerTest, CreateDestroyChannels) { | 103 TEST_F(ChannelManagerTest, CreateDestroyChannels) { |
104 EXPECT_TRUE(cm_->Init()); | 104 EXPECT_TRUE(cm_->Init()); |
105 cricket::VoiceChannel* voice_channel = cm_->CreateVoiceChannel( | 105 cricket::VoiceChannel* voice_channel = cm_->CreateVoiceChannel( |
106 &fake_mc_, transport_controller_, cricket::CN_AUDIO, nullptr, | 106 &fake_mc_, transport_controller_, cricket::CN_AUDIO, nullptr, |
107 kDefaultRtcpEnabled, kDefaultSrtpRequired, AudioOptions()); | 107 kDefaultRtcpEnabled, kDefaultSrtpRequired, AudioOptions()); |
108 EXPECT_TRUE(voice_channel != nullptr); | 108 EXPECT_TRUE(voice_channel != nullptr); |
109 cricket::VideoChannel* video_channel = cm_->CreateVideoChannel( | 109 cricket::VideoChannel* video_channel = cm_->CreateVideoChannel( |
110 &fake_mc_, transport_controller_, cricket::CN_VIDEO, nullptr, | 110 &fake_mc_, transport_controller_, cricket::CN_VIDEO, nullptr, |
111 kDefaultRtcpEnabled, kDefaultSrtpRequired, VideoOptions()); | 111 kDefaultRtcpEnabled, kDefaultSrtpRequired, VideoOptions()); |
112 EXPECT_TRUE(video_channel != nullptr); | 112 EXPECT_TRUE(video_channel != nullptr); |
113 cricket::RtpDataChannel* rtp_data_channel = cm_->CreateRtpDataChannel( | 113 cricket::DataChannel* data_channel = cm_->CreateDataChannel( |
114 &fake_mc_, transport_controller_, cricket::CN_DATA, nullptr, | 114 &fake_mc_, transport_controller_, cricket::CN_DATA, nullptr, |
115 kDefaultRtcpEnabled, kDefaultSrtpRequired); | 115 kDefaultRtcpEnabled, kDefaultSrtpRequired, cricket::DCT_RTP); |
116 EXPECT_TRUE(rtp_data_channel != nullptr); | 116 EXPECT_TRUE(data_channel != nullptr); |
117 cm_->DestroyVideoChannel(video_channel); | 117 cm_->DestroyVideoChannel(video_channel); |
118 cm_->DestroyVoiceChannel(voice_channel); | 118 cm_->DestroyVoiceChannel(voice_channel); |
119 cm_->DestroyRtpDataChannel(rtp_data_channel); | 119 cm_->DestroyDataChannel(data_channel); |
120 cm_->Terminate(); | 120 cm_->Terminate(); |
121 } | 121 } |
122 | 122 |
123 // Test that we can create and destroy a voice and video channel with a worker. | 123 // Test that we can create and destroy a voice and video channel with a worker. |
124 TEST_F(ChannelManagerTest, CreateDestroyChannelsOnThread) { | 124 TEST_F(ChannelManagerTest, CreateDestroyChannelsOnThread) { |
125 network_.Start(); | 125 network_.Start(); |
126 worker_.Start(); | 126 worker_.Start(); |
127 EXPECT_TRUE(cm_->set_worker_thread(&worker_)); | 127 EXPECT_TRUE(cm_->set_worker_thread(&worker_)); |
128 EXPECT_TRUE(cm_->set_network_thread(&network_)); | 128 EXPECT_TRUE(cm_->set_network_thread(&network_)); |
129 EXPECT_TRUE(cm_->Init()); | 129 EXPECT_TRUE(cm_->Init()); |
130 delete transport_controller_; | 130 delete transport_controller_; |
131 transport_controller_ = | 131 transport_controller_ = |
132 new cricket::FakeTransportController(&network_, ICEROLE_CONTROLLING); | 132 new cricket::FakeTransportController(&network_, ICEROLE_CONTROLLING); |
133 cricket::VoiceChannel* voice_channel = cm_->CreateVoiceChannel( | 133 cricket::VoiceChannel* voice_channel = cm_->CreateVoiceChannel( |
134 &fake_mc_, transport_controller_, cricket::CN_AUDIO, nullptr, | 134 &fake_mc_, transport_controller_, cricket::CN_AUDIO, nullptr, |
135 kDefaultRtcpEnabled, kDefaultSrtpRequired, AudioOptions()); | 135 kDefaultRtcpEnabled, kDefaultSrtpRequired, AudioOptions()); |
136 EXPECT_TRUE(voice_channel != nullptr); | 136 EXPECT_TRUE(voice_channel != nullptr); |
137 cricket::VideoChannel* video_channel = cm_->CreateVideoChannel( | 137 cricket::VideoChannel* video_channel = cm_->CreateVideoChannel( |
138 &fake_mc_, transport_controller_, cricket::CN_VIDEO, nullptr, | 138 &fake_mc_, transport_controller_, cricket::CN_VIDEO, nullptr, |
139 kDefaultRtcpEnabled, kDefaultSrtpRequired, VideoOptions()); | 139 kDefaultRtcpEnabled, kDefaultSrtpRequired, VideoOptions()); |
140 EXPECT_TRUE(video_channel != nullptr); | 140 EXPECT_TRUE(video_channel != nullptr); |
141 cricket::RtpDataChannel* rtp_data_channel = cm_->CreateRtpDataChannel( | 141 cricket::DataChannel* data_channel = cm_->CreateDataChannel( |
142 &fake_mc_, transport_controller_, cricket::CN_DATA, nullptr, | 142 &fake_mc_, transport_controller_, cricket::CN_DATA, nullptr, |
143 kDefaultRtcpEnabled, kDefaultSrtpRequired); | 143 kDefaultRtcpEnabled, kDefaultSrtpRequired, cricket::DCT_RTP); |
144 EXPECT_TRUE(rtp_data_channel != nullptr); | 144 EXPECT_TRUE(data_channel != nullptr); |
145 cm_->DestroyVideoChannel(video_channel); | 145 cm_->DestroyVideoChannel(video_channel); |
146 cm_->DestroyVoiceChannel(voice_channel); | 146 cm_->DestroyVoiceChannel(voice_channel); |
147 cm_->DestroyRtpDataChannel(rtp_data_channel); | 147 cm_->DestroyDataChannel(data_channel); |
148 cm_->Terminate(); | 148 cm_->Terminate(); |
149 } | 149 } |
150 | 150 |
151 TEST_F(ChannelManagerTest, SetVideoRtxEnabled) { | 151 TEST_F(ChannelManagerTest, SetVideoRtxEnabled) { |
152 std::vector<VideoCodec> codecs; | 152 std::vector<VideoCodec> codecs; |
153 const VideoCodec rtx_codec(96, "rtx"); | 153 const VideoCodec rtx_codec(96, "rtx"); |
154 | 154 |
155 // By default RTX is disabled. | 155 // By default RTX is disabled. |
156 cm_->GetSupportedVideoCodecs(&codecs); | 156 cm_->GetSupportedVideoCodecs(&codecs); |
157 EXPECT_FALSE(ContainsMatchingCodec(codecs, rtx_codec)); | 157 EXPECT_FALSE(ContainsMatchingCodec(codecs, rtx_codec)); |
(...skipping 14 matching lines...) Expand all Loading... |
172 EXPECT_FALSE(cm_->SetVideoRtxEnabled(false)); | 172 EXPECT_FALSE(cm_->SetVideoRtxEnabled(false)); |
173 | 173 |
174 // Can set again after terminate. | 174 // Can set again after terminate. |
175 cm_->Terminate(); | 175 cm_->Terminate(); |
176 EXPECT_TRUE(cm_->SetVideoRtxEnabled(true)); | 176 EXPECT_TRUE(cm_->SetVideoRtxEnabled(true)); |
177 cm_->GetSupportedVideoCodecs(&codecs); | 177 cm_->GetSupportedVideoCodecs(&codecs); |
178 EXPECT_TRUE(ContainsMatchingCodec(codecs, rtx_codec)); | 178 EXPECT_TRUE(ContainsMatchingCodec(codecs, rtx_codec)); |
179 } | 179 } |
180 | 180 |
181 } // namespace cricket | 181 } // namespace cricket |
OLD | NEW |