| 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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 95   // Setting the network or worker thread while initialized should fail. | 95   // Setting the network or worker thread while initialized should fail. | 
| 96   EXPECT_FALSE(cm_->set_network_thread(rtc::Thread::Current())); | 96   EXPECT_FALSE(cm_->set_network_thread(rtc::Thread::Current())); | 
| 97   EXPECT_FALSE(cm_->set_worker_thread(rtc::Thread::Current())); | 97   EXPECT_FALSE(cm_->set_worker_thread(rtc::Thread::Current())); | 
| 98   cm_->Terminate(); | 98   cm_->Terminate(); | 
| 99   EXPECT_FALSE(cm_->initialized()); | 99   EXPECT_FALSE(cm_->initialized()); | 
| 100 } | 100 } | 
| 101 | 101 | 
| 102 // Test that we can create and destroy a voice and video channel. | 102 // Test that we can create and destroy a voice and video channel. | 
| 103 TEST_F(ChannelManagerTest, CreateDestroyChannels) { | 103 TEST_F(ChannelManagerTest, CreateDestroyChannels) { | 
| 104   EXPECT_TRUE(cm_->Init()); | 104   EXPECT_TRUE(cm_->Init()); | 
|  | 105   cricket::TransportChannel* rtp_transport = | 
|  | 106       transport_controller_->CreateTransportChannel( | 
|  | 107           cricket::CN_AUDIO, cricket::ICE_CANDIDATE_COMPONENT_RTP); | 
| 105   cricket::VoiceChannel* voice_channel = cm_->CreateVoiceChannel( | 108   cricket::VoiceChannel* voice_channel = cm_->CreateVoiceChannel( | 
| 106       &fake_mc_, transport_controller_, cricket::CN_AUDIO, nullptr, | 109       &fake_mc_, rtp_transport, nullptr /*rtcp_transport*/, | 
| 107       kDefaultRtcpEnabled, kDefaultSrtpRequired, AudioOptions()); | 110       rtc::Thread::Current(), cricket::CN_AUDIO, nullptr, kDefaultRtcpEnabled, | 
|  | 111       kDefaultSrtpRequired, AudioOptions()); | 
| 108   EXPECT_TRUE(voice_channel != nullptr); | 112   EXPECT_TRUE(voice_channel != nullptr); | 
| 109   cricket::VideoChannel* video_channel = cm_->CreateVideoChannel( | 113   cricket::VideoChannel* video_channel = cm_->CreateVideoChannel( | 
| 110       &fake_mc_, transport_controller_, cricket::CN_VIDEO, nullptr, | 114       &fake_mc_, rtp_transport, nullptr /*rtcp_transport*/, | 
| 111       kDefaultRtcpEnabled, kDefaultSrtpRequired, VideoOptions()); | 115       rtc::Thread::Current(), cricket::CN_VIDEO, nullptr, kDefaultRtcpEnabled, | 
|  | 116       kDefaultSrtpRequired, VideoOptions()); | 
| 112   EXPECT_TRUE(video_channel != nullptr); | 117   EXPECT_TRUE(video_channel != nullptr); | 
| 113   cricket::RtpDataChannel* rtp_data_channel = cm_->CreateRtpDataChannel( | 118   cricket::RtpDataChannel* rtp_data_channel = cm_->CreateRtpDataChannel( | 
| 114       &fake_mc_, transport_controller_, cricket::CN_DATA, nullptr, | 119       &fake_mc_, rtp_transport, nullptr /*rtcp_transport*/, | 
| 115       kDefaultRtcpEnabled, kDefaultSrtpRequired); | 120       rtc::Thread::Current(), cricket::CN_DATA, nullptr, kDefaultRtcpEnabled, | 
|  | 121       kDefaultSrtpRequired); | 
| 116   EXPECT_TRUE(rtp_data_channel != nullptr); | 122   EXPECT_TRUE(rtp_data_channel != nullptr); | 
| 117   cm_->DestroyVideoChannel(video_channel); | 123   cm_->DestroyVideoChannel(video_channel); | 
| 118   cm_->DestroyVoiceChannel(voice_channel); | 124   cm_->DestroyVoiceChannel(voice_channel); | 
| 119   cm_->DestroyRtpDataChannel(rtp_data_channel); | 125   cm_->DestroyRtpDataChannel(rtp_data_channel); | 
| 120   cm_->Terminate(); | 126   cm_->Terminate(); | 
| 121 } | 127 } | 
| 122 | 128 | 
| 123 // Test that we can create and destroy a voice and video channel with a worker. | 129 // Test that we can create and destroy a voice and video channel with a worker. | 
| 124 TEST_F(ChannelManagerTest, CreateDestroyChannelsOnThread) { | 130 TEST_F(ChannelManagerTest, CreateDestroyChannelsOnThread) { | 
| 125   network_.Start(); | 131   network_.Start(); | 
| 126   worker_.Start(); | 132   worker_.Start(); | 
| 127   EXPECT_TRUE(cm_->set_worker_thread(&worker_)); | 133   EXPECT_TRUE(cm_->set_worker_thread(&worker_)); | 
| 128   EXPECT_TRUE(cm_->set_network_thread(&network_)); | 134   EXPECT_TRUE(cm_->set_network_thread(&network_)); | 
| 129   EXPECT_TRUE(cm_->Init()); | 135   EXPECT_TRUE(cm_->Init()); | 
| 130   delete transport_controller_; | 136   delete transport_controller_; | 
| 131   transport_controller_ = | 137   transport_controller_ = | 
| 132       new cricket::FakeTransportController(&network_, ICEROLE_CONTROLLING); | 138       new cricket::FakeTransportController(&network_, ICEROLE_CONTROLLING); | 
|  | 139   cricket::TransportChannel* rtp_transport = | 
|  | 140       transport_controller_->CreateTransportChannel( | 
|  | 141           cricket::CN_AUDIO, cricket::ICE_CANDIDATE_COMPONENT_RTP); | 
| 133   cricket::VoiceChannel* voice_channel = cm_->CreateVoiceChannel( | 142   cricket::VoiceChannel* voice_channel = cm_->CreateVoiceChannel( | 
| 134       &fake_mc_, transport_controller_, cricket::CN_AUDIO, nullptr, | 143       &fake_mc_, rtp_transport, nullptr /*rtcp_transport*/, | 
| 135       kDefaultRtcpEnabled, kDefaultSrtpRequired, AudioOptions()); | 144       rtc::Thread::Current(), cricket::CN_AUDIO, nullptr, kDefaultRtcpEnabled, | 
|  | 145       kDefaultSrtpRequired, AudioOptions()); | 
| 136   EXPECT_TRUE(voice_channel != nullptr); | 146   EXPECT_TRUE(voice_channel != nullptr); | 
| 137   cricket::VideoChannel* video_channel = cm_->CreateVideoChannel( | 147   cricket::VideoChannel* video_channel = cm_->CreateVideoChannel( | 
| 138       &fake_mc_, transport_controller_, cricket::CN_VIDEO, nullptr, | 148       &fake_mc_, rtp_transport, nullptr /*rtcp_transport*/, | 
| 139       kDefaultRtcpEnabled, kDefaultSrtpRequired, VideoOptions()); | 149       rtc::Thread::Current(), cricket::CN_VIDEO, nullptr, kDefaultRtcpEnabled, | 
|  | 150       kDefaultSrtpRequired, VideoOptions()); | 
| 140   EXPECT_TRUE(video_channel != nullptr); | 151   EXPECT_TRUE(video_channel != nullptr); | 
| 141   cricket::RtpDataChannel* rtp_data_channel = cm_->CreateRtpDataChannel( | 152   cricket::RtpDataChannel* rtp_data_channel = cm_->CreateRtpDataChannel( | 
| 142       &fake_mc_, transport_controller_, cricket::CN_DATA, nullptr, | 153       &fake_mc_, rtp_transport, nullptr /*rtcp_transport*/, | 
| 143       kDefaultRtcpEnabled, kDefaultSrtpRequired); | 154       rtc::Thread::Current(), cricket::CN_DATA, nullptr, kDefaultRtcpEnabled, | 
|  | 155       kDefaultSrtpRequired); | 
| 144   EXPECT_TRUE(rtp_data_channel != nullptr); | 156   EXPECT_TRUE(rtp_data_channel != nullptr); | 
| 145   cm_->DestroyVideoChannel(video_channel); | 157   cm_->DestroyVideoChannel(video_channel); | 
| 146   cm_->DestroyVoiceChannel(voice_channel); | 158   cm_->DestroyVoiceChannel(voice_channel); | 
| 147   cm_->DestroyRtpDataChannel(rtp_data_channel); | 159   cm_->DestroyRtpDataChannel(rtp_data_channel); | 
| 148   cm_->Terminate(); | 160   cm_->Terminate(); | 
| 149 } | 161 } | 
| 150 | 162 | 
| 151 TEST_F(ChannelManagerTest, SetVideoRtxEnabled) { | 163 TEST_F(ChannelManagerTest, SetVideoRtxEnabled) { | 
| 152   std::vector<VideoCodec> codecs; | 164   std::vector<VideoCodec> codecs; | 
| 153   const VideoCodec rtx_codec(96, "rtx"); | 165   const VideoCodec rtx_codec(96, "rtx"); | 
| (...skipping 18 matching lines...) Expand all  Loading... | 
| 172   EXPECT_FALSE(cm_->SetVideoRtxEnabled(false)); | 184   EXPECT_FALSE(cm_->SetVideoRtxEnabled(false)); | 
| 173 | 185 | 
| 174   // Can set again after terminate. | 186   // Can set again after terminate. | 
| 175   cm_->Terminate(); | 187   cm_->Terminate(); | 
| 176   EXPECT_TRUE(cm_->SetVideoRtxEnabled(true)); | 188   EXPECT_TRUE(cm_->SetVideoRtxEnabled(true)); | 
| 177   cm_->GetSupportedVideoCodecs(&codecs); | 189   cm_->GetSupportedVideoCodecs(&codecs); | 
| 178   EXPECT_TRUE(ContainsMatchingCodec(codecs, rtx_codec)); | 190   EXPECT_TRUE(ContainsMatchingCodec(codecs, rtx_codec)); | 
| 179 } | 191 } | 
| 180 | 192 | 
| 181 }  // namespace cricket | 193 }  // namespace cricket | 
| OLD | NEW | 
|---|