| 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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 106 EXPECT_TRUE(data_channel != nullptr); | 106 EXPECT_TRUE(data_channel != nullptr); |
| 107 cm_->DestroyVideoChannel(video_channel); | 107 cm_->DestroyVideoChannel(video_channel); |
| 108 cm_->DestroyVoiceChannel(voice_channel); | 108 cm_->DestroyVoiceChannel(voice_channel); |
| 109 cm_->DestroyDataChannel(data_channel); | 109 cm_->DestroyDataChannel(data_channel); |
| 110 cm_->Terminate(); | 110 cm_->Terminate(); |
| 111 } | 111 } |
| 112 | 112 |
| 113 // Test that we can create and destroy a voice and video channel with a worker. | 113 // Test that we can create and destroy a voice and video channel with a worker. |
| 114 TEST_F(ChannelManagerTest, CreateDestroyChannelsOnThread) { | 114 TEST_F(ChannelManagerTest, CreateDestroyChannelsOnThread) { |
| 115 worker_.Start(); | 115 worker_.Start(); |
| 116 EXPECT_TRUE(cm_->set_worker_thread(&worker_)); | 116 EXPECT_TRUE(cm_->set_network_thread(&worker_)); |
| 117 EXPECT_TRUE(cm_->Init()); | 117 EXPECT_TRUE(cm_->Init()); |
| 118 delete transport_controller_; | 118 delete transport_controller_; |
| 119 transport_controller_ = | 119 transport_controller_ = |
| 120 new cricket::FakeTransportController(&worker_, ICEROLE_CONTROLLING); | 120 new cricket::FakeTransportController(&worker_, ICEROLE_CONTROLLING); |
| 121 cricket::VoiceChannel* voice_channel = | 121 cricket::VoiceChannel* voice_channel = |
| 122 cm_->CreateVoiceChannel(&fake_mc_, transport_controller_, | 122 cm_->CreateVoiceChannel(&fake_mc_, transport_controller_, |
| 123 cricket::CN_AUDIO, false, AudioOptions()); | 123 cricket::CN_AUDIO, false, AudioOptions()); |
| 124 EXPECT_TRUE(voice_channel != nullptr); | 124 EXPECT_TRUE(voice_channel != nullptr); |
| 125 cricket::VideoChannel* video_channel = | 125 cricket::VideoChannel* video_channel = |
| 126 cm_->CreateVideoChannel(&fake_mc_, transport_controller_, | 126 cm_->CreateVideoChannel(&fake_mc_, transport_controller_, |
| 127 cricket::CN_VIDEO, false, VideoOptions()); | 127 cricket::CN_VIDEO, false, VideoOptions()); |
| 128 EXPECT_TRUE(video_channel != nullptr); | 128 EXPECT_TRUE(video_channel != nullptr); |
| 129 cricket::DataChannel* data_channel = cm_->CreateDataChannel( | 129 cricket::DataChannel* data_channel = cm_->CreateDataChannel( |
| 130 transport_controller_, cricket::CN_DATA, false, cricket::DCT_RTP); | 130 transport_controller_, cricket::CN_DATA, false, cricket::DCT_RTP); |
| 131 EXPECT_TRUE(data_channel != nullptr); | 131 EXPECT_TRUE(data_channel != nullptr); |
| 132 cm_->DestroyVideoChannel(video_channel); | 132 cm_->DestroyVideoChannel(video_channel); |
| 133 cm_->DestroyVoiceChannel(voice_channel); | 133 cm_->DestroyVoiceChannel(voice_channel); |
| 134 cm_->DestroyDataChannel(data_channel); | 134 cm_->DestroyDataChannel(data_channel); |
| 135 cm_->Terminate(); | 135 cm_->Terminate(); |
| 136 } | 136 } |
| 137 | 137 |
| 138 // Test that we fail to create a voice/video channel if the session is unable | 138 // Test that we fail to create a voice/video channel if the session is unable |
| 139 // to create a cricket::TransportChannel | 139 // to create a cricket::TransportChannel |
| 140 TEST_F(ChannelManagerTest, NoTransportChannelTest) { | 140 TEST_F(ChannelManagerTest, NoTransportChannelTest) { |
| 141 EXPECT_TRUE(cm_->Init()); | 141 EXPECT_TRUE(cm_->Init()); |
| 142 transport_controller_->set_fail_channel_creation(true); | 142 transport_controller_->set_fail_channel_creation(true); |
| 143 // The test is useless unless the session does not fail creating | 143 // The test is useless unless the session does not fail creating |
| 144 // cricket::TransportChannel. | 144 // cricket::TransportChannel. |
| 145 ASSERT_TRUE(transport_controller_->CreateTransportChannel_w( | 145 ASSERT_TRUE(transport_controller_->CreateTransportChannel_n( |
| 146 "audio", cricket::ICE_CANDIDATE_COMPONENT_RTP) == nullptr); | 146 "audio", cricket::ICE_CANDIDATE_COMPONENT_RTP) == nullptr); |
| 147 | 147 |
| 148 cricket::VoiceChannel* voice_channel = | 148 cricket::VoiceChannel* voice_channel = |
| 149 cm_->CreateVoiceChannel(&fake_mc_, transport_controller_, | 149 cm_->CreateVoiceChannel(&fake_mc_, transport_controller_, |
| 150 cricket::CN_AUDIO, false, AudioOptions()); | 150 cricket::CN_AUDIO, false, AudioOptions()); |
| 151 EXPECT_TRUE(voice_channel == nullptr); | 151 EXPECT_TRUE(voice_channel == nullptr); |
| 152 cricket::VideoChannel* video_channel = | 152 cricket::VideoChannel* video_channel = |
| 153 cm_->CreateVideoChannel(&fake_mc_, transport_controller_, | 153 cm_->CreateVideoChannel(&fake_mc_, transport_controller_, |
| 154 cricket::CN_VIDEO, false, VideoOptions()); | 154 cricket::CN_VIDEO, false, VideoOptions()); |
| 155 EXPECT_TRUE(video_channel == nullptr); | 155 EXPECT_TRUE(video_channel == nullptr); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 EXPECT_FALSE(cm_->SetVideoRtxEnabled(false)); | 218 EXPECT_FALSE(cm_->SetVideoRtxEnabled(false)); |
| 219 | 219 |
| 220 // Can set again after terminate. | 220 // Can set again after terminate. |
| 221 cm_->Terminate(); | 221 cm_->Terminate(); |
| 222 EXPECT_TRUE(cm_->SetVideoRtxEnabled(true)); | 222 EXPECT_TRUE(cm_->SetVideoRtxEnabled(true)); |
| 223 cm_->GetSupportedVideoCodecs(&codecs); | 223 cm_->GetSupportedVideoCodecs(&codecs); |
| 224 EXPECT_TRUE(ContainsMatchingCodec(codecs, rtx_codec)); | 224 EXPECT_TRUE(ContainsMatchingCodec(codecs, rtx_codec)); |
| 225 } | 225 } |
| 226 | 226 |
| 227 } // namespace cricket | 227 } // namespace cricket |
| OLD | NEW |