OLD | NEW |
1 /* | 1 /* |
2 * libjingle | 2 * libjingle |
3 * Copyright 2008 Google Inc. | 3 * Copyright 2008 Google Inc. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions are met: | 6 * modification, are permitted provided that the following conditions are met: |
7 * | 7 * |
8 * 1. Redistributions of source code must retain the above copyright notice, | 8 * 1. Redistributions of source code must retain the above copyright notice, |
9 * this list of conditions and the following disclaimer. | 9 * this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright notice, | 10 * 2. Redistributions in binary form must reproduce the above copyright notice, |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 EXPECT_FALSE(cm_->set_worker_thread(rtc::Thread::Current())); | 112 EXPECT_FALSE(cm_->set_worker_thread(rtc::Thread::Current())); |
113 cm_->Terminate(); | 113 cm_->Terminate(); |
114 EXPECT_FALSE(cm_->initialized()); | 114 EXPECT_FALSE(cm_->initialized()); |
115 } | 115 } |
116 | 116 |
117 // Test that we can create and destroy a voice and video channel. | 117 // Test that we can create and destroy a voice and video channel. |
118 TEST_F(ChannelManagerTest, CreateDestroyChannels) { | 118 TEST_F(ChannelManagerTest, CreateDestroyChannels) { |
119 EXPECT_TRUE(cm_->Init()); | 119 EXPECT_TRUE(cm_->Init()); |
120 cricket::VoiceChannel* voice_channel = | 120 cricket::VoiceChannel* voice_channel = |
121 cm_->CreateVoiceChannel(&fake_mc_, transport_controller_, | 121 cm_->CreateVoiceChannel(&fake_mc_, transport_controller_, |
122 cricket::CN_AUDIO, false, AudioOptions()); | 122 cricket::CN_AUDIO, false, |
| 123 MediaChannelOptions(), AudioOptions()); |
123 EXPECT_TRUE(voice_channel != nullptr); | 124 EXPECT_TRUE(voice_channel != nullptr); |
124 cricket::VideoChannel* video_channel = | 125 cricket::VideoChannel* video_channel = |
125 cm_->CreateVideoChannel(&fake_mc_, transport_controller_, | 126 cm_->CreateVideoChannel(&fake_mc_, transport_controller_, |
126 cricket::CN_VIDEO, false, VideoOptions()); | 127 cricket::CN_VIDEO, false, |
| 128 MediaChannelOptions(), VideoOptions()); |
127 EXPECT_TRUE(video_channel != nullptr); | 129 EXPECT_TRUE(video_channel != nullptr); |
128 cricket::DataChannel* data_channel = cm_->CreateDataChannel( | 130 cricket::DataChannel* data_channel = cm_->CreateDataChannel( |
129 transport_controller_, cricket::CN_DATA, false, cricket::DCT_RTP); | 131 transport_controller_, cricket::CN_DATA, false, cricket::DCT_RTP); |
130 EXPECT_TRUE(data_channel != nullptr); | 132 EXPECT_TRUE(data_channel != nullptr); |
131 cm_->DestroyVideoChannel(video_channel); | 133 cm_->DestroyVideoChannel(video_channel); |
132 cm_->DestroyVoiceChannel(voice_channel); | 134 cm_->DestroyVoiceChannel(voice_channel); |
133 cm_->DestroyDataChannel(data_channel); | 135 cm_->DestroyDataChannel(data_channel); |
134 cm_->Terminate(); | 136 cm_->Terminate(); |
135 } | 137 } |
136 | 138 |
137 // Test that we can create and destroy a voice and video channel with a worker. | 139 // Test that we can create and destroy a voice and video channel with a worker. |
138 TEST_F(ChannelManagerTest, CreateDestroyChannelsOnThread) { | 140 TEST_F(ChannelManagerTest, CreateDestroyChannelsOnThread) { |
139 worker_.Start(); | 141 worker_.Start(); |
140 EXPECT_TRUE(cm_->set_worker_thread(&worker_)); | 142 EXPECT_TRUE(cm_->set_worker_thread(&worker_)); |
141 EXPECT_TRUE(cm_->Init()); | 143 EXPECT_TRUE(cm_->Init()); |
142 delete transport_controller_; | 144 delete transport_controller_; |
143 transport_controller_ = | 145 transport_controller_ = |
144 new cricket::FakeTransportController(&worker_, ICEROLE_CONTROLLING); | 146 new cricket::FakeTransportController(&worker_, ICEROLE_CONTROLLING); |
145 cricket::VoiceChannel* voice_channel = | 147 cricket::VoiceChannel* voice_channel = |
146 cm_->CreateVoiceChannel(&fake_mc_, transport_controller_, | 148 cm_->CreateVoiceChannel(&fake_mc_, transport_controller_, |
147 cricket::CN_AUDIO, false, AudioOptions()); | 149 cricket::CN_AUDIO, false, |
| 150 MediaChannelOptions(), AudioOptions()); |
148 EXPECT_TRUE(voice_channel != nullptr); | 151 EXPECT_TRUE(voice_channel != nullptr); |
149 cricket::VideoChannel* video_channel = | 152 cricket::VideoChannel* video_channel = |
150 cm_->CreateVideoChannel(&fake_mc_, transport_controller_, | 153 cm_->CreateVideoChannel(&fake_mc_, transport_controller_, |
151 cricket::CN_VIDEO, false, VideoOptions()); | 154 cricket::CN_VIDEO, false, |
| 155 MediaChannelOptions(), VideoOptions()); |
152 EXPECT_TRUE(video_channel != nullptr); | 156 EXPECT_TRUE(video_channel != nullptr); |
153 cricket::DataChannel* data_channel = cm_->CreateDataChannel( | 157 cricket::DataChannel* data_channel = cm_->CreateDataChannel( |
154 transport_controller_, cricket::CN_DATA, false, cricket::DCT_RTP); | 158 transport_controller_, cricket::CN_DATA, false, cricket::DCT_RTP); |
155 EXPECT_TRUE(data_channel != nullptr); | 159 EXPECT_TRUE(data_channel != nullptr); |
156 cm_->DestroyVideoChannel(video_channel); | 160 cm_->DestroyVideoChannel(video_channel); |
157 cm_->DestroyVoiceChannel(voice_channel); | 161 cm_->DestroyVoiceChannel(voice_channel); |
158 cm_->DestroyDataChannel(data_channel); | 162 cm_->DestroyDataChannel(data_channel); |
159 cm_->Terminate(); | 163 cm_->Terminate(); |
160 } | 164 } |
161 | 165 |
162 // Test that we fail to create a voice/video channel if the session is unable | 166 // Test that we fail to create a voice/video channel if the session is unable |
163 // to create a cricket::TransportChannel | 167 // to create a cricket::TransportChannel |
164 TEST_F(ChannelManagerTest, NoTransportChannelTest) { | 168 TEST_F(ChannelManagerTest, NoTransportChannelTest) { |
165 EXPECT_TRUE(cm_->Init()); | 169 EXPECT_TRUE(cm_->Init()); |
166 transport_controller_->set_fail_channel_creation(true); | 170 transport_controller_->set_fail_channel_creation(true); |
167 // The test is useless unless the session does not fail creating | 171 // The test is useless unless the session does not fail creating |
168 // cricket::TransportChannel. | 172 // cricket::TransportChannel. |
169 ASSERT_TRUE(transport_controller_->CreateTransportChannel_w( | 173 ASSERT_TRUE(transport_controller_->CreateTransportChannel_w( |
170 "audio", cricket::ICE_CANDIDATE_COMPONENT_RTP) == nullptr); | 174 "audio", cricket::ICE_CANDIDATE_COMPONENT_RTP) == nullptr); |
171 | 175 |
172 cricket::VoiceChannel* voice_channel = | 176 cricket::VoiceChannel* voice_channel = |
173 cm_->CreateVoiceChannel(&fake_mc_, transport_controller_, | 177 cm_->CreateVoiceChannel(&fake_mc_, transport_controller_, |
174 cricket::CN_AUDIO, false, AudioOptions()); | 178 cricket::CN_AUDIO, false, |
| 179 MediaChannelOptions(), AudioOptions()); |
175 EXPECT_TRUE(voice_channel == nullptr); | 180 EXPECT_TRUE(voice_channel == nullptr); |
176 cricket::VideoChannel* video_channel = | 181 cricket::VideoChannel* video_channel = |
177 cm_->CreateVideoChannel(&fake_mc_, transport_controller_, | 182 cm_->CreateVideoChannel(&fake_mc_, transport_controller_, |
178 cricket::CN_VIDEO, false, VideoOptions()); | 183 cricket::CN_VIDEO, false, |
| 184 MediaChannelOptions(), VideoOptions()); |
179 EXPECT_TRUE(video_channel == nullptr); | 185 EXPECT_TRUE(video_channel == nullptr); |
180 cricket::DataChannel* data_channel = cm_->CreateDataChannel( | 186 cricket::DataChannel* data_channel = cm_->CreateDataChannel( |
181 transport_controller_, cricket::CN_DATA, false, cricket::DCT_RTP); | 187 transport_controller_, cricket::CN_DATA, false, cricket::DCT_RTP); |
182 EXPECT_TRUE(data_channel == nullptr); | 188 EXPECT_TRUE(data_channel == nullptr); |
183 cm_->Terminate(); | 189 cm_->Terminate(); |
184 } | 190 } |
185 | 191 |
186 TEST_F(ChannelManagerTest, GetSetOutputVolumeBeforeInit) { | 192 TEST_F(ChannelManagerTest, GetSetOutputVolumeBeforeInit) { |
187 int level; | 193 int level; |
188 // Before init, SetOutputVolume() remembers the volume but does not change the | 194 // Before init, SetOutputVolume() remembers the volume but does not change the |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 EXPECT_FALSE(cm_->SetVideoRtxEnabled(false)); | 248 EXPECT_FALSE(cm_->SetVideoRtxEnabled(false)); |
243 | 249 |
244 // Can set again after terminate. | 250 // Can set again after terminate. |
245 cm_->Terminate(); | 251 cm_->Terminate(); |
246 EXPECT_TRUE(cm_->SetVideoRtxEnabled(true)); | 252 EXPECT_TRUE(cm_->SetVideoRtxEnabled(true)); |
247 cm_->GetSupportedVideoCodecs(&codecs); | 253 cm_->GetSupportedVideoCodecs(&codecs); |
248 EXPECT_TRUE(ContainsMatchingCodec(codecs, rtx_codec)); | 254 EXPECT_TRUE(ContainsMatchingCodec(codecs, rtx_codec)); |
249 } | 255 } |
250 | 256 |
251 } // namespace cricket | 257 } // namespace cricket |
OLD | NEW |