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 2260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2271 EXPECT_TRUE(pc_->SetConfiguration(config)); | 2271 EXPECT_TRUE(pc_->SetConfiguration(config)); |
2272 | 2272 |
2273 // Set local answer; now it's too late. | 2273 // Set local answer; now it's too late. |
2274 CreateAnswerAsLocalDescription(); | 2274 CreateAnswerAsLocalDescription(); |
2275 config.ice_candidate_pool_size = 3; | 2275 config.ice_candidate_pool_size = 3; |
2276 RTCError error; | 2276 RTCError error; |
2277 EXPECT_FALSE(pc_->SetConfiguration(config, &error)); | 2277 EXPECT_FALSE(pc_->SetConfiguration(config, &error)); |
2278 EXPECT_EQ(RTCErrorType::INVALID_MODIFICATION, error.type()); | 2278 EXPECT_EQ(RTCErrorType::INVALID_MODIFICATION, error.type()); |
2279 } | 2279 } |
2280 | 2280 |
| 2281 // Test that after setting an answer, extra pooled sessions are discarded. The |
| 2282 // ICE candidate pool is only intended to be used for the first offer/answer. |
| 2283 TEST_F(PeerConnectionInterfaceTest, |
| 2284 ExtraPooledSessionsDiscardedAfterApplyingAnswer) { |
| 2285 CreatePeerConnection(); |
| 2286 |
| 2287 // Set a larger-than-necessary size. |
| 2288 PeerConnectionInterface::RTCConfiguration config; |
| 2289 config.ice_candidate_pool_size = 4; |
| 2290 EXPECT_TRUE(pc_->SetConfiguration(config)); |
| 2291 |
| 2292 // Do offer/answer. |
| 2293 CreateOfferAsRemoteDescription(); |
| 2294 CreateAnswerAsLocalDescription(); |
| 2295 |
| 2296 // Expect no pooled sessions to be left. |
| 2297 const cricket::PortAllocatorSession* session = |
| 2298 port_allocator_->GetPooledSession(); |
| 2299 EXPECT_EQ(nullptr, session); |
| 2300 } |
| 2301 |
| 2302 // After Close is called, pooled candidates should be discarded so as to not |
| 2303 // waste network resources. |
| 2304 TEST_F(PeerConnectionInterfaceTest, PooledSessionsDiscardedAfterClose) { |
| 2305 CreatePeerConnection(); |
| 2306 |
| 2307 PeerConnectionInterface::RTCConfiguration config; |
| 2308 config.ice_candidate_pool_size = 3; |
| 2309 EXPECT_TRUE(pc_->SetConfiguration(config)); |
| 2310 pc_->Close(); |
| 2311 |
| 2312 // Expect no pooled sessions to be left. |
| 2313 const cricket::PortAllocatorSession* session = |
| 2314 port_allocator_->GetPooledSession(); |
| 2315 EXPECT_EQ(nullptr, session); |
| 2316 } |
| 2317 |
2281 // Test that SetConfiguration returns an invalid modification error if | 2318 // Test that SetConfiguration returns an invalid modification error if |
2282 // modifying a field in the configuration that isn't allowed to be modified. | 2319 // modifying a field in the configuration that isn't allowed to be modified. |
2283 TEST_F(PeerConnectionInterfaceTest, | 2320 TEST_F(PeerConnectionInterfaceTest, |
2284 SetConfigurationReturnsInvalidModificationError) { | 2321 SetConfigurationReturnsInvalidModificationError) { |
2285 PeerConnectionInterface::RTCConfiguration config; | 2322 PeerConnectionInterface::RTCConfiguration config; |
2286 config.bundle_policy = PeerConnectionInterface::kBundlePolicyBalanced; | 2323 config.bundle_policy = PeerConnectionInterface::kBundlePolicyBalanced; |
2287 config.rtcp_mux_policy = PeerConnectionInterface::kRtcpMuxPolicyNegotiate; | 2324 config.rtcp_mux_policy = PeerConnectionInterface::kRtcpMuxPolicyNegotiate; |
2288 config.continual_gathering_policy = PeerConnectionInterface::GATHER_ONCE; | 2325 config.continual_gathering_policy = PeerConnectionInterface::GATHER_ONCE; |
2289 CreatePeerConnection(config, nullptr); | 2326 CreatePeerConnection(config, nullptr); |
2290 | 2327 |
(...skipping 1118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3409 EXPECT_NE(a, f); | 3446 EXPECT_NE(a, f); |
3410 | 3447 |
3411 PeerConnectionInterface::RTCConfiguration g; | 3448 PeerConnectionInterface::RTCConfiguration g; |
3412 g.disable_ipv6 = true; | 3449 g.disable_ipv6 = true; |
3413 EXPECT_NE(a, g); | 3450 EXPECT_NE(a, g); |
3414 | 3451 |
3415 PeerConnectionInterface::RTCConfiguration h( | 3452 PeerConnectionInterface::RTCConfiguration h( |
3416 PeerConnectionInterface::RTCConfigurationType::kAggressive); | 3453 PeerConnectionInterface::RTCConfigurationType::kAggressive); |
3417 EXPECT_NE(a, h); | 3454 EXPECT_NE(a, h); |
3418 } | 3455 } |
OLD | NEW |