| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2013 The WebRTC project authors. All Rights Reserved. | 2 * Copyright 2013 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 } // namespace | 47 } // namespace |
| 48 | 48 |
| 49 class PeerConnectionEndToEndTest | 49 class PeerConnectionEndToEndTest |
| 50 : public sigslot::has_slots<>, | 50 : public sigslot::has_slots<>, |
| 51 public testing::Test { | 51 public testing::Test { |
| 52 public: | 52 public: |
| 53 typedef std::vector<rtc::scoped_refptr<DataChannelInterface> > | 53 typedef std::vector<rtc::scoped_refptr<DataChannelInterface> > |
| 54 DataChannelList; | 54 DataChannelList; |
| 55 | 55 |
| 56 PeerConnectionEndToEndTest() { | 56 PeerConnectionEndToEndTest() { |
| 57 network_thread_ = rtc::Thread::CreateWithSocketServer(); | 57 RTC_CHECK(network_thread_.Start()); |
| 58 worker_thread_ = rtc::Thread::Create(); | 58 RTC_CHECK(worker_thread_.Start()); |
| 59 RTC_CHECK(network_thread_->Start()); | |
| 60 RTC_CHECK(worker_thread_->Start()); | |
| 61 caller_ = new rtc::RefCountedObject<PeerConnectionTestWrapper>( | 59 caller_ = new rtc::RefCountedObject<PeerConnectionTestWrapper>( |
| 62 "caller", network_thread_.get(), worker_thread_.get()); | 60 "caller", &network_thread_, &worker_thread_); |
| 63 callee_ = new rtc::RefCountedObject<PeerConnectionTestWrapper>( | 61 callee_ = new rtc::RefCountedObject<PeerConnectionTestWrapper>( |
| 64 "callee", network_thread_.get(), worker_thread_.get()); | 62 "callee", &network_thread_, &worker_thread_); |
| 65 webrtc::PeerConnectionInterface::IceServer ice_server; | 63 webrtc::PeerConnectionInterface::IceServer ice_server; |
| 66 ice_server.uri = "stun:stun.l.google.com:19302"; | 64 ice_server.uri = "stun:stun.l.google.com:19302"; |
| 67 config_.servers.push_back(ice_server); | 65 config_.servers.push_back(ice_server); |
| 68 | 66 |
| 69 #ifdef WEBRTC_ANDROID | 67 #ifdef WEBRTC_ANDROID |
| 70 webrtc::InitializeAndroidObjects(); | 68 webrtc::InitializeAndroidObjects(); |
| 71 #endif | 69 #endif |
| 72 } | 70 } |
| 73 | 71 |
| 74 void CreatePcs( | 72 void CreatePcs( |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 const DataChannelList& remote_dc_list, | 158 const DataChannelList& remote_dc_list, |
| 161 size_t remote_dc_index) { | 159 size_t remote_dc_index) { |
| 162 local_dc->Close(); | 160 local_dc->Close(); |
| 163 EXPECT_EQ_WAIT(DataChannelInterface::kClosed, local_dc->state(), kMaxWait); | 161 EXPECT_EQ_WAIT(DataChannelInterface::kClosed, local_dc->state(), kMaxWait); |
| 164 EXPECT_EQ_WAIT(DataChannelInterface::kClosed, | 162 EXPECT_EQ_WAIT(DataChannelInterface::kClosed, |
| 165 remote_dc_list[remote_dc_index]->state(), | 163 remote_dc_list[remote_dc_index]->state(), |
| 166 kMaxWait); | 164 kMaxWait); |
| 167 } | 165 } |
| 168 | 166 |
| 169 protected: | 167 protected: |
| 170 std::unique_ptr<rtc::Thread> network_thread_; | 168 rtc::Thread network_thread_; |
| 171 std::unique_ptr<rtc::Thread> worker_thread_; | 169 rtc::Thread worker_thread_; |
| 172 rtc::scoped_refptr<PeerConnectionTestWrapper> caller_; | 170 rtc::scoped_refptr<PeerConnectionTestWrapper> caller_; |
| 173 rtc::scoped_refptr<PeerConnectionTestWrapper> callee_; | 171 rtc::scoped_refptr<PeerConnectionTestWrapper> callee_; |
| 174 DataChannelList caller_signaled_data_channels_; | 172 DataChannelList caller_signaled_data_channels_; |
| 175 DataChannelList callee_signaled_data_channels_; | 173 DataChannelList callee_signaled_data_channels_; |
| 176 webrtc::PeerConnectionInterface::RTCConfiguration config_; | 174 webrtc::PeerConnectionInterface::RTCConfiguration config_; |
| 177 }; | 175 }; |
| 178 | 176 |
| 179 std::unique_ptr<webrtc::AudioDecoder> CreateForwardingMockDecoder( | 177 std::unique_ptr<webrtc::AudioDecoder> CreateForwardingMockDecoder( |
| 180 std::unique_ptr<webrtc::AudioDecoder> real_decoder) { | 178 std::unique_ptr<webrtc::AudioDecoder> real_decoder) { |
| 181 class ForwardingMockDecoder : public StrictMock<webrtc::MockAudioDecoder> { | 179 class ForwardingMockDecoder : public StrictMock<webrtc::MockAudioDecoder> { |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 540 // This removes the reference to the remote data channel that we hold. | 538 // This removes the reference to the remote data channel that we hold. |
| 541 callee_signaled_data_channels_.clear(); | 539 callee_signaled_data_channels_.clear(); |
| 542 caller_dc->Close(); | 540 caller_dc->Close(); |
| 543 EXPECT_EQ_WAIT(DataChannelInterface::kClosed, caller_dc->state(), kMaxWait); | 541 EXPECT_EQ_WAIT(DataChannelInterface::kClosed, caller_dc->state(), kMaxWait); |
| 544 | 542 |
| 545 // Wait for a bit longer so the remote data channel will receive the | 543 // Wait for a bit longer so the remote data channel will receive the |
| 546 // close message and be destroyed. | 544 // close message and be destroyed. |
| 547 rtc::Thread::Current()->ProcessMessages(100); | 545 rtc::Thread::Current()->ProcessMessages(100); |
| 548 } | 546 } |
| 549 #endif // HAVE_SCTP | 547 #endif // HAVE_SCTP |
| OLD | NEW |