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

Side by Side Diff: webrtc/p2p/base/transportcontroller_unittest.cc

Issue 1369773003: Add a continual_gathering_policy in PeerConnection RTCConfiguration (Closed) Base URL: https://chromium.googlesource.com/external/webrtc@master
Patch Set: Rebase to master Created 5 years, 2 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
« no previous file with comments | « webrtc/p2p/base/transportcontroller.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 2015 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2015 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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 channel1->SetConnectionCount(2); 127 channel1->SetConnectionCount(2);
128 channel2->SetConnectionCount(2); 128 channel2->SetConnectionCount(2);
129 channel1->SetReceiving(true); 129 channel1->SetReceiving(true);
130 channel2->SetReceiving(true); 130 channel2->SetReceiving(true);
131 channel1->SetWritable(true); 131 channel1->SetWritable(true);
132 channel2->SetWritable(true); 132 channel2->SetWritable(true);
133 channel1->SetConnectionCount(1); 133 channel1->SetConnectionCount(1);
134 channel2->SetConnectionCount(1); 134 channel2->SetConnectionCount(1);
135 } 135 }
136 136
137 cricket::IceConfig CreateIceConfig(int receiving_timeout_ms,
138 bool gather_continually) {
139 cricket::IceConfig config;
140 config.receiving_timeout_ms = receiving_timeout_ms;
141 config.gather_continually = gather_continually;
142 return config;
143 }
144
137 protected: 145 protected:
138 void OnConnectionState(IceConnectionState state) { 146 void OnConnectionState(IceConnectionState state) {
139 if (!signaling_thread_->IsCurrent()) { 147 if (!signaling_thread_->IsCurrent()) {
140 signaled_on_non_signaling_thread_ = true; 148 signaled_on_non_signaling_thread_ = true;
141 } 149 }
142 connection_state_ = state; 150 connection_state_ = state;
143 ++connection_state_signal_count_; 151 ++connection_state_signal_count_;
144 } 152 }
145 153
146 void OnReceiving(bool receiving) { 154 void OnReceiving(bool receiving) {
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 int connection_state_signal_count_ = 0; 190 int connection_state_signal_count_ = 0;
183 int receiving_signal_count_ = 0; 191 int receiving_signal_count_ = 0;
184 int gathering_state_signal_count_ = 0; 192 int gathering_state_signal_count_ = 0;
185 int candidates_signal_count_ = 0; 193 int candidates_signal_count_ = 0;
186 194
187 // Used to make sure signals only come on signaling thread. 195 // Used to make sure signals only come on signaling thread.
188 rtc::Thread* const signaling_thread_ = nullptr; 196 rtc::Thread* const signaling_thread_ = nullptr;
189 bool signaled_on_non_signaling_thread_ = false; 197 bool signaled_on_non_signaling_thread_ = false;
190 }; 198 };
191 199
192 TEST_F(TransportControllerTest, TestSetIceReceivingTimeout) { 200 TEST_F(TransportControllerTest, TestSetIceConfig) {
193 FakeTransportChannel* channel1 = CreateChannel("audio", 1); 201 FakeTransportChannel* channel1 = CreateChannel("audio", 1);
194 ASSERT_NE(nullptr, channel1); 202 ASSERT_NE(nullptr, channel1);
195 203
196 transport_controller_->SetIceConnectionReceivingTimeout(1000); 204 transport_controller_->SetIceConfig(CreateIceConfig(1000, true));
197 EXPECT_EQ(1000, channel1->receiving_timeout()); 205 EXPECT_EQ(1000, channel1->receiving_timeout());
206 EXPECT_TRUE(channel1->gather_continually());
198 207
199 // Test that value stored in controller is applied to new channels. 208 // Test that value stored in controller is applied to new channels.
200 FakeTransportChannel* channel2 = CreateChannel("video", 1); 209 FakeTransportChannel* channel2 = CreateChannel("video", 1);
201 ASSERT_NE(nullptr, channel2); 210 ASSERT_NE(nullptr, channel2);
202 EXPECT_EQ(1000, channel2->receiving_timeout()); 211 EXPECT_EQ(1000, channel2->receiving_timeout());
212 EXPECT_TRUE(channel2->gather_continually());
203 } 213 }
204 214
205 TEST_F(TransportControllerTest, TestSetSslMaxProtocolVersion) { 215 TEST_F(TransportControllerTest, TestSetSslMaxProtocolVersion) {
206 EXPECT_TRUE(transport_controller_->SetSslMaxProtocolVersion( 216 EXPECT_TRUE(transport_controller_->SetSslMaxProtocolVersion(
207 rtc::SSL_PROTOCOL_DTLS_12)); 217 rtc::SSL_PROTOCOL_DTLS_12));
208 FakeTransportChannel* channel = CreateChannel("audio", 1); 218 FakeTransportChannel* channel = CreateChannel("audio", 1);
209 219
210 ASSERT_NE(nullptr, channel); 220 ASSERT_NE(nullptr, channel);
211 EXPECT_EQ(rtc::SSL_PROTOCOL_DTLS_12, channel->ssl_max_protocol_version()); 221 EXPECT_EQ(rtc::SSL_PROTOCOL_DTLS_12, channel->ssl_max_protocol_version());
212 222
(...skipping 457 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 // new --> gathering --> complete 680 // new --> gathering --> complete
671 EXPECT_EQ_WAIT(cricket::kIceGatheringComplete, gathering_state_, kTimeout); 681 EXPECT_EQ_WAIT(cricket::kIceGatheringComplete, gathering_state_, kTimeout);
672 EXPECT_EQ(2, gathering_state_signal_count_); 682 EXPECT_EQ(2, gathering_state_signal_count_);
673 683
674 EXPECT_EQ_WAIT(1U, candidates_["audio"].size(), kTimeout); 684 EXPECT_EQ_WAIT(1U, candidates_["audio"].size(), kTimeout);
675 EXPECT_EQ_WAIT(1U, candidates_["video"].size(), kTimeout); 685 EXPECT_EQ_WAIT(1U, candidates_["video"].size(), kTimeout);
676 EXPECT_EQ(2, candidates_signal_count_); 686 EXPECT_EQ(2, candidates_signal_count_);
677 687
678 EXPECT_TRUE(!signaled_on_non_signaling_thread_); 688 EXPECT_TRUE(!signaled_on_non_signaling_thread_);
679 } 689 }
OLDNEW
« no previous file with comments | « webrtc/p2p/base/transportcontroller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698