| OLD | NEW |
| 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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 channel1->SetConnectionCount(2); | 130 channel1->SetConnectionCount(2); |
| 131 channel2->SetConnectionCount(2); | 131 channel2->SetConnectionCount(2); |
| 132 channel1->SetReceiving(true); | 132 channel1->SetReceiving(true); |
| 133 channel2->SetReceiving(true); | 133 channel2->SetReceiving(true); |
| 134 channel1->SetWritable(true); | 134 channel1->SetWritable(true); |
| 135 channel2->SetWritable(true); | 135 channel2->SetWritable(true); |
| 136 channel1->SetConnectionCount(1); | 136 channel1->SetConnectionCount(1); |
| 137 channel2->SetConnectionCount(1); | 137 channel2->SetConnectionCount(1); |
| 138 } | 138 } |
| 139 | 139 |
| 140 cricket::IceConfig CreateIceConfig(int receiving_timeout, | 140 cricket::IceConfig CreateIceConfig( |
| 141 bool gather_continually) { | 141 int receiving_timeout, |
| 142 cricket::ContinualGatheringPolicy continual_gathering_policy) { |
| 142 cricket::IceConfig config; | 143 cricket::IceConfig config; |
| 143 config.receiving_timeout = receiving_timeout; | 144 config.receiving_timeout = receiving_timeout; |
| 144 config.gather_continually = gather_continually; | 145 config.continual_gathering_policy = continual_gathering_policy; |
| 145 return config; | 146 return config; |
| 146 } | 147 } |
| 147 | 148 |
| 148 protected: | 149 protected: |
| 149 void OnConnectionState(IceConnectionState state) { | 150 void OnConnectionState(IceConnectionState state) { |
| 150 if (!signaling_thread_->IsCurrent()) { | 151 if (!signaling_thread_->IsCurrent()) { |
| 151 signaled_on_non_signaling_thread_ = true; | 152 signaled_on_non_signaling_thread_ = true; |
| 152 } | 153 } |
| 153 connection_state_ = state; | 154 connection_state_ = state; |
| 154 ++connection_state_signal_count_; | 155 ++connection_state_signal_count_; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 | 198 |
| 198 // Used to make sure signals only come on signaling thread. | 199 // Used to make sure signals only come on signaling thread. |
| 199 rtc::Thread* const signaling_thread_ = nullptr; | 200 rtc::Thread* const signaling_thread_ = nullptr; |
| 200 bool signaled_on_non_signaling_thread_ = false; | 201 bool signaled_on_non_signaling_thread_ = false; |
| 201 }; | 202 }; |
| 202 | 203 |
| 203 TEST_F(TransportControllerTest, TestSetIceConfig) { | 204 TEST_F(TransportControllerTest, TestSetIceConfig) { |
| 204 FakeTransportChannel* channel1 = CreateChannel("audio", 1); | 205 FakeTransportChannel* channel1 = CreateChannel("audio", 1); |
| 205 ASSERT_NE(nullptr, channel1); | 206 ASSERT_NE(nullptr, channel1); |
| 206 | 207 |
| 207 transport_controller_->SetIceConfig(CreateIceConfig(1000, true)); | 208 transport_controller_->SetIceConfig( |
| 209 CreateIceConfig(1000, cricket::GATHER_CONTINUALLY)); |
| 208 EXPECT_EQ(1000, channel1->receiving_timeout()); | 210 EXPECT_EQ(1000, channel1->receiving_timeout()); |
| 209 EXPECT_TRUE(channel1->gather_continually()); | 211 EXPECT_TRUE(channel1->gather_continually()); |
| 210 | 212 |
| 213 transport_controller_->SetIceConfig( |
| 214 CreateIceConfig(1000, cricket::GATHER_CONTINUALLY_AND_RECOVER)); |
| 211 // Test that value stored in controller is applied to new channels. | 215 // Test that value stored in controller is applied to new channels. |
| 212 FakeTransportChannel* channel2 = CreateChannel("video", 1); | 216 FakeTransportChannel* channel2 = CreateChannel("video", 1); |
| 213 ASSERT_NE(nullptr, channel2); | 217 ASSERT_NE(nullptr, channel2); |
| 214 EXPECT_EQ(1000, channel2->receiving_timeout()); | 218 EXPECT_EQ(1000, channel2->receiving_timeout()); |
| 215 EXPECT_TRUE(channel2->gather_continually()); | 219 EXPECT_TRUE(channel2->gather_continually()); |
| 216 } | 220 } |
| 217 | 221 |
| 218 TEST_F(TransportControllerTest, TestSetSslMaxProtocolVersion) { | 222 TEST_F(TransportControllerTest, TestSetSslMaxProtocolVersion) { |
| 219 EXPECT_TRUE(transport_controller_->SetSslMaxProtocolVersion( | 223 EXPECT_TRUE(transport_controller_->SetSslMaxProtocolVersion( |
| 220 rtc::SSL_PROTOCOL_DTLS_12)); | 224 rtc::SSL_PROTOCOL_DTLS_12)); |
| (...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 681 // new --> gathering --> complete | 685 // new --> gathering --> complete |
| 682 EXPECT_EQ_WAIT(cricket::kIceGatheringComplete, gathering_state_, kTimeout); | 686 EXPECT_EQ_WAIT(cricket::kIceGatheringComplete, gathering_state_, kTimeout); |
| 683 EXPECT_EQ(2, gathering_state_signal_count_); | 687 EXPECT_EQ(2, gathering_state_signal_count_); |
| 684 | 688 |
| 685 EXPECT_EQ_WAIT(1U, candidates_["audio"].size(), kTimeout); | 689 EXPECT_EQ_WAIT(1U, candidates_["audio"].size(), kTimeout); |
| 686 EXPECT_EQ_WAIT(1U, candidates_["video"].size(), kTimeout); | 690 EXPECT_EQ_WAIT(1U, candidates_["video"].size(), kTimeout); |
| 687 EXPECT_EQ(2, candidates_signal_count_); | 691 EXPECT_EQ(2, candidates_signal_count_); |
| 688 | 692 |
| 689 EXPECT_TRUE(!signaled_on_non_signaling_thread_); | 693 EXPECT_TRUE(!signaled_on_non_signaling_thread_); |
| 690 } | 694 } |
| OLD | NEW |