diff --git a/dom/media/tests/mochitest/templates.js b/dom/media/tests/mochitest/templates.js index d3b401c8b2e..4029eea17b3 100644 --- a/dom/media/tests/mochitest/templates.js +++ b/dom/media/tests/mochitest/templates.js @@ -522,6 +522,12 @@ var commandsPeerConnectionOfferAnswer = [ }, function PC_REMOTE_CHECK_STATS(test) { return checkAllTrackStats(test.pcRemote); + }, + function PC_LOCAL_WAIT_FOR_END_OF_TRICKLE(test) { + return test.pcLocal.endOfTrickleIce; + }, + function PC_REMOTE_WAIT_FOR_END_OF_TRICKLE(test) { + return test.pcRemote.endOfTrickleIce; } ]; diff --git a/media/mtransport/test/ice_unittest.cpp b/media/mtransport/test/ice_unittest.cpp index 62181c28d1b..b3b7df4bab7 100644 --- a/media/mtransport/test/ice_unittest.cpp +++ b/media/mtransport/test/ice_unittest.cpp @@ -1814,6 +1814,45 @@ TEST_F(IceConnectTest, RemoveAndAddStream) { ASSERT_TRUE_WAIT(p2_->ice_complete(), 1000); } +TEST_F(IceConnectTest, RemoveStreamBeforeGather) { + AddStream("first", 1); + AddStream("second", 1); + ASSERT_TRUE(Gather(0)); + RemoveStream(0); + WaitForGather(); + ConnectTrickle(); + RealisticTrickleDelay(p1_->ControlTrickle(1)); + RealisticTrickleDelay(p2_->ControlTrickle(1)); + ASSERT_TRUE_WAIT(p1_->ice_complete(), 1000); + ASSERT_TRUE_WAIT(p2_->ice_complete(), 1000); +} + +TEST_F(IceConnectTest, RemoveStreamDuringGather) { + AddStream("first", 1); + AddStream("second", 1); + RemoveStream(0); + ASSERT_TRUE(Gather()); + ConnectTrickle(); + RealisticTrickleDelay(p1_->ControlTrickle(1)); + RealisticTrickleDelay(p2_->ControlTrickle(1)); + ASSERT_TRUE_WAIT(p1_->ice_complete(), 1000); + ASSERT_TRUE_WAIT(p2_->ice_complete(), 1000); +} + +TEST_F(IceConnectTest, RemoveStreamDuringConnect) { + AddStream("first", 1); + AddStream("second", 1); + ASSERT_TRUE(Gather()); + ConnectTrickle(); + RealisticTrickleDelay(p1_->ControlTrickle(0)); + RealisticTrickleDelay(p2_->ControlTrickle(0)); + RealisticTrickleDelay(p1_->ControlTrickle(1)); + RealisticTrickleDelay(p2_->ControlTrickle(1)); + RemoveStream(0); + ASSERT_TRUE_WAIT(p1_->ice_complete(), 1000); + ASSERT_TRUE_WAIT(p2_->ice_complete(), 1000); +} + TEST_F(IceConnectTest, TestConnectRealTrickleOneStreamOneComponent) { AddStream("first", 1); AddStream("second", 1);