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

Unified Diff: webrtc/p2p/base/jseptransport_unittest.cc

Issue 2563153002: Implement the "needs-ice-restart" logic for SetConfiguration. (Closed)
Patch Set: Fixing signed/unsigned comparison warning. Created 4 years 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/p2p/base/jseptransport.cc ('k') | webrtc/p2p/base/transportcontroller.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/jseptransport_unittest.cc
diff --git a/webrtc/p2p/base/jseptransport_unittest.cc b/webrtc/p2p/base/jseptransport_unittest.cc
index 2f2510c476e6a922f3575a64c0fd1a405589273a..f882a5de6d54266c3814ac0a5963d22d48292279 100644
--- a/webrtc/p2p/base/jseptransport_unittest.cc
+++ b/webrtc/p2p/base/jseptransport_unittest.cc
@@ -73,6 +73,41 @@ TEST_F(JsepTransportTest, TestIceCredentialsChanged) {
EXPECT_FALSE(cricket::IceCredentialsChanged("u1", "p1", "u1", "p1"));
}
+// Tests SetNeedsIceRestartFlag and NeedsIceRestart, ensuring NeedsIceRestart
+// only starts returning "false" once an ICE restart has been initiated.
+TEST_F(JsepTransportTest, NeedsIceRestart) {
+ // Do initial offer/answer so there's something to restart.
+ cricket::TransportDescription local_desc(kIceUfrag1, kIcePwd1);
+ cricket::TransportDescription remote_desc(kIceUfrag1, kIcePwd1);
+ ASSERT_TRUE(transport_->SetLocalTransportDescription(
+ local_desc, cricket::CA_OFFER, nullptr));
+ ASSERT_TRUE(transport_->SetRemoteTransportDescription(
+ remote_desc, cricket::CA_ANSWER, nullptr));
+
+ // Flag initially should be false.
+ EXPECT_FALSE(transport_->NeedsIceRestart());
+
+ // After setting flag, it should be true.
+ transport_->SetNeedsIceRestartFlag();
+ EXPECT_TRUE(transport_->NeedsIceRestart());
+
+ // Doing an identical offer/answer shouldn't clear the flag.
+ ASSERT_TRUE(transport_->SetLocalTransportDescription(
+ local_desc, cricket::CA_OFFER, nullptr));
+ ASSERT_TRUE(transport_->SetRemoteTransportDescription(
+ remote_desc, cricket::CA_ANSWER, nullptr));
+ EXPECT_TRUE(transport_->NeedsIceRestart());
+
+ // Doing an offer/answer that restarts ICE should clear the flag.
+ cricket::TransportDescription ice_restart_local_desc(kIceUfrag2, kIcePwd2);
+ cricket::TransportDescription ice_restart_remote_desc(kIceUfrag2, kIcePwd2);
+ ASSERT_TRUE(transport_->SetLocalTransportDescription(
+ ice_restart_local_desc, cricket::CA_OFFER, nullptr));
+ ASSERT_TRUE(transport_->SetRemoteTransportDescription(
+ ice_restart_remote_desc, cricket::CA_ANSWER, nullptr));
+ EXPECT_FALSE(transport_->NeedsIceRestart());
+}
+
TEST_F(JsepTransportTest, TestGetStats) {
EXPECT_TRUE(SetupChannel());
cricket::TransportStats stats;
« no previous file with comments | « webrtc/p2p/base/jseptransport.cc ('k') | webrtc/p2p/base/transportcontroller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698