Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(455)

Side by Side Diff: webrtc/api/webrtcsession_unittest.cc

Issue 1975453002: Add PeerConnection IsClosed check. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Change the webrtcsession constructor. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« webrtc/api/webrtcsession.cc ('K') | « webrtc/api/webrtcsession.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 size_t num_candidates_removed_ = 0; 210 size_t num_candidates_removed_ = 0;
211 }; 211 };
212 212
213 class WebRtcSessionForTest : public webrtc::WebRtcSession { 213 class WebRtcSessionForTest : public webrtc::WebRtcSession {
214 public: 214 public:
215 WebRtcSessionForTest(webrtc::MediaControllerInterface* media_controller, 215 WebRtcSessionForTest(webrtc::MediaControllerInterface* media_controller,
216 rtc::Thread* network_thread, 216 rtc::Thread* network_thread,
217 rtc::Thread* worker_thread, 217 rtc::Thread* worker_thread,
218 rtc::Thread* signaling_thread, 218 rtc::Thread* signaling_thread,
219 cricket::PortAllocator* port_allocator, 219 cricket::PortAllocator* port_allocator,
220 webrtc::IceObserver* ice_observer) 220 webrtc::IceObserver* ice_observer,
221 cricket::TransportController* transport_controller)
221 : WebRtcSession(media_controller, 222 : WebRtcSession(media_controller,
222 network_thread, 223 network_thread,
223 worker_thread, 224 worker_thread,
224 signaling_thread, 225 signaling_thread,
225 port_allocator) { 226 port_allocator,
227 transport_controller) {
226 RegisterIceObserver(ice_observer); 228 RegisterIceObserver(ice_observer);
227 } 229 }
228 virtual ~WebRtcSessionForTest() {} 230 virtual ~WebRtcSessionForTest() {}
229 231
230 // Note that these methods are only safe to use if the signaling thread 232 // Note that these methods are only safe to use if the signaling thread
231 // is the same as the worker thread 233 // is the same as the worker thread
232 cricket::TransportChannel* voice_rtp_transport_channel() { 234 cricket::TransportChannel* voice_rtp_transport_channel() {
233 return rtp_transport_channel(voice_channel()); 235 return rtp_transport_channel(voice_channel());
234 } 236 }
235 237
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 381
380 // If |cert_generator| != null or |rtc_configuration| contains |certificates| 382 // If |cert_generator| != null or |rtc_configuration| contains |certificates|
381 // then DTLS will be enabled unless explicitly disabled by |rtc_configuration| 383 // then DTLS will be enabled unless explicitly disabled by |rtc_configuration|
382 // options. When DTLS is enabled a certificate will be used if provided, 384 // options. When DTLS is enabled a certificate will be used if provided,
383 // otherwise one will be generated using the |cert_generator|. 385 // otherwise one will be generated using the |cert_generator|.
384 void Init( 386 void Init(
385 std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator) { 387 std::unique_ptr<rtc::RTCCertificateGeneratorInterface> cert_generator) {
386 ASSERT_TRUE(session_.get() == NULL); 388 ASSERT_TRUE(session_.get() == NULL);
387 session_.reset(new WebRtcSessionForTest( 389 session_.reset(new WebRtcSessionForTest(
388 media_controller_.get(), rtc::Thread::Current(), rtc::Thread::Current(), 390 media_controller_.get(), rtc::Thread::Current(), rtc::Thread::Current(),
389 rtc::Thread::Current(), allocator_.get(), &observer_)); 391 rtc::Thread::Current(), allocator_.get(), &observer_,
392 new cricket::TransportController(
393 rtc::Thread::Current(), rtc::Thread::Current(), allocator_.get())));
390 session_->SignalDataChannelOpenMessage.connect( 394 session_->SignalDataChannelOpenMessage.connect(
391 this, &WebRtcSessionTest::OnDataChannelOpenMessage); 395 this, &WebRtcSessionTest::OnDataChannelOpenMessage);
392 session_->GetOnDestroyedSignal()->connect( 396 session_->GetOnDestroyedSignal()->connect(
393 this, &WebRtcSessionTest::OnSessionDestroyed); 397 this, &WebRtcSessionTest::OnSessionDestroyed);
394 398
395 EXPECT_EQ(PeerConnectionInterface::kIceConnectionNew, 399 EXPECT_EQ(PeerConnectionInterface::kIceConnectionNew,
396 observer_.ice_connection_state_); 400 observer_.ice_connection_state_);
397 EXPECT_EQ(PeerConnectionInterface::kIceGatheringNew, 401 EXPECT_EQ(PeerConnectionInterface::kIceGatheringNew,
398 observer_.ice_gathering_state_); 402 observer_.ice_gathering_state_);
399 403
(...skipping 4019 matching lines...) Expand 10 before | Expand all | Expand 10 after
4419 } 4423 }
4420 4424
4421 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test 4425 // TODO(bemasc): Add a TestIceStatesBundle with BUNDLE enabled. That test
4422 // currently fails because upon disconnection and reconnection OnIceComplete is 4426 // currently fails because upon disconnection and reconnection OnIceComplete is
4423 // called more than once without returning to IceGatheringGathering. 4427 // called more than once without returning to IceGatheringGathering.
4424 4428
4425 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests, 4429 INSTANTIATE_TEST_CASE_P(WebRtcSessionTests,
4426 WebRtcSessionTest, 4430 WebRtcSessionTest,
4427 testing::Values(ALREADY_GENERATED, 4431 testing::Values(ALREADY_GENERATED,
4428 DTLS_IDENTITY_STORE)); 4432 DTLS_IDENTITY_STORE));
OLDNEW
« webrtc/api/webrtcsession.cc ('K') | « webrtc/api/webrtcsession.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698