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

Side by Side Diff: webrtc/pc/peerconnectioninterface_unittest.cc

Issue 2717893003: Making candidate pool size behave as decided in JSEP. (Closed)
Patch Set: Merge with master Created 3 years, 9 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/pc/peerconnection.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 2266 matching lines...) Expand 10 before | Expand all | Expand 10 after
2277 EXPECT_TRUE(pc_->SetConfiguration(config)); 2277 EXPECT_TRUE(pc_->SetConfiguration(config));
2278 2278
2279 // Set local answer; now it's too late. 2279 // Set local answer; now it's too late.
2280 CreateAnswerAsLocalDescription(); 2280 CreateAnswerAsLocalDescription();
2281 config.ice_candidate_pool_size = 3; 2281 config.ice_candidate_pool_size = 3;
2282 RTCError error; 2282 RTCError error;
2283 EXPECT_FALSE(pc_->SetConfiguration(config, &error)); 2283 EXPECT_FALSE(pc_->SetConfiguration(config, &error));
2284 EXPECT_EQ(RTCErrorType::INVALID_MODIFICATION, error.type()); 2284 EXPECT_EQ(RTCErrorType::INVALID_MODIFICATION, error.type());
2285 } 2285 }
2286 2286
2287 // Test that after setting an answer, extra pooled sessions are discarded. The
2288 // ICE candidate pool is only intended to be used for the first offer/answer.
2289 TEST_F(PeerConnectionInterfaceTest,
2290 ExtraPooledSessionsDiscardedAfterApplyingAnswer) {
2291 CreatePeerConnection();
2292
2293 // Set a larger-than-necessary size.
2294 PeerConnectionInterface::RTCConfiguration config;
2295 config.ice_candidate_pool_size = 4;
2296 EXPECT_TRUE(pc_->SetConfiguration(config));
2297
2298 // Do offer/answer.
2299 CreateOfferAsRemoteDescription();
2300 CreateAnswerAsLocalDescription();
2301
2302 // Expect no pooled sessions to be left.
2303 const cricket::PortAllocatorSession* session =
2304 port_allocator_->GetPooledSession();
2305 EXPECT_EQ(nullptr, session);
2306 }
2307
2308 // After Close is called, pooled candidates should be discarded so as to not
2309 // waste network resources.
2310 TEST_F(PeerConnectionInterfaceTest, PooledSessionsDiscardedAfterClose) {
2311 CreatePeerConnection();
2312
2313 PeerConnectionInterface::RTCConfiguration config;
2314 config.ice_candidate_pool_size = 3;
2315 EXPECT_TRUE(pc_->SetConfiguration(config));
2316 pc_->Close();
2317
2318 // Expect no pooled sessions to be left.
2319 const cricket::PortAllocatorSession* session =
2320 port_allocator_->GetPooledSession();
2321 EXPECT_EQ(nullptr, session);
2322 }
2323
2287 // Test that SetConfiguration returns an invalid modification error if 2324 // Test that SetConfiguration returns an invalid modification error if
2288 // modifying a field in the configuration that isn't allowed to be modified. 2325 // modifying a field in the configuration that isn't allowed to be modified.
2289 TEST_F(PeerConnectionInterfaceTest, 2326 TEST_F(PeerConnectionInterfaceTest,
2290 SetConfigurationReturnsInvalidModificationError) { 2327 SetConfigurationReturnsInvalidModificationError) {
2291 PeerConnectionInterface::RTCConfiguration config; 2328 PeerConnectionInterface::RTCConfiguration config;
2292 config.bundle_policy = PeerConnectionInterface::kBundlePolicyBalanced; 2329 config.bundle_policy = PeerConnectionInterface::kBundlePolicyBalanced;
2293 config.rtcp_mux_policy = PeerConnectionInterface::kRtcpMuxPolicyNegotiate; 2330 config.rtcp_mux_policy = PeerConnectionInterface::kRtcpMuxPolicyNegotiate;
2294 config.continual_gathering_policy = PeerConnectionInterface::GATHER_ONCE; 2331 config.continual_gathering_policy = PeerConnectionInterface::GATHER_ONCE;
2295 CreatePeerConnection(config, nullptr); 2332 CreatePeerConnection(config, nullptr);
2296 2333
(...skipping 1110 matching lines...) Expand 10 before | Expand all | Expand 10 after
3407 EXPECT_NE(a, f); 3444 EXPECT_NE(a, f);
3408 3445
3409 PeerConnectionInterface::RTCConfiguration g; 3446 PeerConnectionInterface::RTCConfiguration g;
3410 g.disable_ipv6 = true; 3447 g.disable_ipv6 = true;
3411 EXPECT_NE(a, g); 3448 EXPECT_NE(a, g);
3412 3449
3413 PeerConnectionInterface::RTCConfiguration h( 3450 PeerConnectionInterface::RTCConfiguration h(
3414 PeerConnectionInterface::RTCConfigurationType::kAggressive); 3451 PeerConnectionInterface::RTCConfigurationType::kAggressive);
3415 EXPECT_NE(a, h); 3452 EXPECT_NE(a, h);
3416 } 3453 }
OLDNEW
« no previous file with comments | « webrtc/pc/peerconnection.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698