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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/pc/peerconnection.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/pc/peerconnectioninterface_unittest.cc
diff --git a/webrtc/pc/peerconnectioninterface_unittest.cc b/webrtc/pc/peerconnectioninterface_unittest.cc
index 8a80e5e90793a61605af899c1dfa73c11286475e..53e0a9ec7ed125c8b9470b0a87de8b4dad8232f0 100644
--- a/webrtc/pc/peerconnectioninterface_unittest.cc
+++ b/webrtc/pc/peerconnectioninterface_unittest.cc
@@ -2284,6 +2284,43 @@ TEST_F(PeerConnectionInterfaceTest,
EXPECT_EQ(RTCErrorType::INVALID_MODIFICATION, error.type());
}
+// Test that after setting an answer, extra pooled sessions are discarded. The
+// ICE candidate pool is only intended to be used for the first offer/answer.
+TEST_F(PeerConnectionInterfaceTest,
+ ExtraPooledSessionsDiscardedAfterApplyingAnswer) {
+ CreatePeerConnection();
+
+ // Set a larger-than-necessary size.
+ PeerConnectionInterface::RTCConfiguration config;
+ config.ice_candidate_pool_size = 4;
+ EXPECT_TRUE(pc_->SetConfiguration(config));
+
+ // Do offer/answer.
+ CreateOfferAsRemoteDescription();
+ CreateAnswerAsLocalDescription();
+
+ // Expect no pooled sessions to be left.
+ const cricket::PortAllocatorSession* session =
+ port_allocator_->GetPooledSession();
+ EXPECT_EQ(nullptr, session);
+}
+
+// After Close is called, pooled candidates should be discarded so as to not
+// waste network resources.
+TEST_F(PeerConnectionInterfaceTest, PooledSessionsDiscardedAfterClose) {
+ CreatePeerConnection();
+
+ PeerConnectionInterface::RTCConfiguration config;
+ config.ice_candidate_pool_size = 3;
+ EXPECT_TRUE(pc_->SetConfiguration(config));
+ pc_->Close();
+
+ // Expect no pooled sessions to be left.
+ const cricket::PortAllocatorSession* session =
+ port_allocator_->GetPooledSession();
+ EXPECT_EQ(nullptr, session);
+}
+
// Test that SetConfiguration returns an invalid modification error if
// modifying a field in the configuration that isn't allowed to be modified.
TEST_F(PeerConnectionInterfaceTest,
« 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