OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2012 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2012 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 | 195 |
196 bool oncandidatesready_; | 196 bool oncandidatesready_; |
197 std::vector<cricket::Candidate> mline_0_candidates_; | 197 std::vector<cricket::Candidate> mline_0_candidates_; |
198 std::vector<cricket::Candidate> mline_1_candidates_; | 198 std::vector<cricket::Candidate> mline_1_candidates_; |
199 PeerConnectionInterface::IceConnectionState ice_connection_state_; | 199 PeerConnectionInterface::IceConnectionState ice_connection_state_; |
200 PeerConnectionInterface::IceGatheringState ice_gathering_state_; | 200 PeerConnectionInterface::IceGatheringState ice_gathering_state_; |
201 }; | 201 }; |
202 | 202 |
203 class WebRtcSessionForTest : public webrtc::WebRtcSession { | 203 class WebRtcSessionForTest : public webrtc::WebRtcSession { |
204 public: | 204 public: |
205 WebRtcSessionForTest(webrtc::MediaControllerInterface* media_controller, | 205 WebRtcSessionForTest(rtc::Thread* signaling_thread, |
206 rtc::Thread* signaling_thread, | |
207 rtc::Thread* worker_thread, | 206 rtc::Thread* worker_thread, |
208 cricket::PortAllocator* port_allocator, | 207 cricket::PortAllocator* port_allocator, |
209 webrtc::IceObserver* ice_observer) | 208 webrtc::IceObserver* ice_observer) |
210 : WebRtcSession(media_controller, | 209 : WebRtcSession(signaling_thread, |
211 signaling_thread, | |
212 worker_thread, | 210 worker_thread, |
213 port_allocator) { | 211 port_allocator) { |
214 RegisterIceObserver(ice_observer); | 212 RegisterIceObserver(ice_observer); |
215 } | 213 } |
216 virtual ~WebRtcSessionForTest() {} | 214 virtual ~WebRtcSessionForTest() {} |
217 | 215 |
218 // Note that these methods are only safe to use if the signaling thread | 216 // Note that these methods are only safe to use if the signaling thread |
219 // is the same as the worker thread | 217 // is the same as the worker thread |
220 cricket::TransportChannel* voice_rtp_transport_channel() { | 218 cricket::TransportChannel* voice_rtp_transport_channel() { |
221 return rtp_transport_channel(voice_channel()); | 219 return rtp_transport_channel(voice_channel()); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 // If |dtls_identity_store| != null or |rtc_configuration| contains | 364 // If |dtls_identity_store| != null or |rtc_configuration| contains |
367 // |certificates| then DTLS will be enabled unless explicitly disabled by | 365 // |certificates| then DTLS will be enabled unless explicitly disabled by |
368 // |rtc_configuration| options. When DTLS is enabled a certificate will be | 366 // |rtc_configuration| options. When DTLS is enabled a certificate will be |
369 // used if provided, otherwise one will be generated using the | 367 // used if provided, otherwise one will be generated using the |
370 // |dtls_identity_store|. | 368 // |dtls_identity_store|. |
371 void Init( | 369 void Init( |
372 rtc::scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store, | 370 rtc::scoped_ptr<webrtc::DtlsIdentityStoreInterface> dtls_identity_store, |
373 const PeerConnectionInterface::RTCConfiguration& rtc_configuration) { | 371 const PeerConnectionInterface::RTCConfiguration& rtc_configuration) { |
374 ASSERT_TRUE(session_.get() == NULL); | 372 ASSERT_TRUE(session_.get() == NULL); |
375 session_.reset(new WebRtcSessionForTest( | 373 session_.reset(new WebRtcSessionForTest( |
376 media_controller_.get(), rtc::Thread::Current(), rtc::Thread::Current(), | 374 rtc::Thread::Current(), rtc::Thread::Current(), allocator_.get(), |
377 allocator_.get(), &observer_)); | 375 &observer_)); |
378 session_->SignalDataChannelOpenMessage.connect( | 376 session_->SignalDataChannelOpenMessage.connect( |
379 this, &WebRtcSessionTest::OnDataChannelOpenMessage); | 377 this, &WebRtcSessionTest::OnDataChannelOpenMessage); |
380 session_->GetOnDestroyedSignal()->connect( | 378 session_->GetOnDestroyedSignal()->connect( |
381 this, &WebRtcSessionTest::OnSessionDestroyed); | 379 this, &WebRtcSessionTest::OnSessionDestroyed); |
382 | 380 |
383 EXPECT_EQ(PeerConnectionInterface::kIceConnectionNew, | 381 EXPECT_EQ(PeerConnectionInterface::kIceConnectionNew, |
384 observer_.ice_connection_state_); | 382 observer_.ice_connection_state_); |
385 EXPECT_EQ(PeerConnectionInterface::kIceGatheringNew, | 383 EXPECT_EQ(PeerConnectionInterface::kIceGatheringNew, |
386 observer_.ice_gathering_state_); | 384 observer_.ice_gathering_state_); |
387 | 385 |
388 EXPECT_TRUE(session_->Initialize(options_, constraints_.get(), | 386 EXPECT_TRUE(session_->Initialize(options_, constraints_.get(), |
389 std::move(dtls_identity_store), | 387 std::move(dtls_identity_store), |
390 rtc_configuration)); | 388 rtc_configuration)); |
| 389 session_->LateInitialize(media_controller_.get()); |
391 session_->set_metrics_observer(metrics_observer_); | 390 session_->set_metrics_observer(metrics_observer_); |
392 } | 391 } |
393 | 392 |
394 void OnDataChannelOpenMessage(const std::string& label, | 393 void OnDataChannelOpenMessage(const std::string& label, |
395 const InternalDataChannelInit& config) { | 394 const InternalDataChannelInit& config) { |
396 last_data_channel_label_ = label; | 395 last_data_channel_label_ = label; |
397 last_data_channel_config_ = config; | 396 last_data_channel_config_ = config; |
398 } | 397 } |
399 | 398 |
400 void OnSessionDestroyed() { session_destroyed_ = true; } | 399 void OnSessionDestroyed() { session_destroyed_ = true; } |
(...skipping 3854 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4255 } | 4254 } |
4256 | 4255 |
4257 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test | 4256 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test |
4258 // currently fails because upon disconnection and reconnection OnIceComplete is | 4257 // currently fails because upon disconnection and reconnection OnIceComplete is |
4259 // called more than once without returning to IceGatheringGathering. | 4258 // called more than once without returning to IceGatheringGathering. |
4260 | 4259 |
4261 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, | 4260 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, |
4262 WebRtcSessionTest, | 4261 WebRtcSessionTest, |
4263 testing::Values(ALREADY_GENERATED, | 4262 testing::Values(ALREADY_GENERATED, |
4264 DTLS_IDENTITY_STORE)); | 4263 DTLS_IDENTITY_STORE)); |
OLD | NEW |