Bug 1022776 - Bump max transmit count by 1 and modify unit-tests to compensate. r=ekr, a=sledru
authorByron Campen [:bwc] <docfaraday@gmail.com>
Mon, 09 Jun 2014 17:31:44 -0700
changeset 199522 26461e10e6d720ad9afa7d002aa70cd89b885262
parent 199521 423cd6386bd29a5fe20f975b11917f4726a6f4c2
child 199523 b3480c1d1f6eb269c6b80646cdba3c9427aedf0e
push id3654
push userryanvm@gmail.com
push dateWed, 18 Jun 2014 19:27:56 +0000
treeherdermozilla-beta@a076e4f9d95d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersekr, sledru
bugs1022776
milestone31.0
Bug 1022776 - Bump max transmit count by 1 and modify unit-tests to compensate. r=ekr, a=sledru
media/mtransport/nricectx.cpp
media/mtransport/test/ice_unittest.cpp
media/webrtc/signaling/test/signaling_unittests.cpp
--- a/media/mtransport/nricectx.cpp
+++ b/media/mtransport/nricectx.cpp
@@ -405,17 +405,17 @@ RefPtr<NrIceCtx> NrIceCtx::Create(const 
       NR_reg_set_uchar((char *)"ice.pref.interface.vmnet5", 237);
       NR_reg_set_uchar((char *)"ice.pref.interface.vmnet6", 236);
       NR_reg_set_uchar((char *)"ice.pref.interface.vmnet7", 235);
       NR_reg_set_uchar((char *)"ice.pref.interface.vmnet8", 234);
       NR_reg_set_uchar((char *)"ice.pref.interface.virbr0", 233);
       NR_reg_set_uchar((char *)"ice.pref.interface.wlan0", 232);
     }
 
-    NR_reg_set_uint4((char *)"stun.client.maximum_transmits",4);
+    NR_reg_set_uint4((char *)"stun.client.maximum_transmits",5);
   }
 
   // Create the ICE context
   int r;
 
   UINT4 flags = offerer ? NR_ICE_CTX_FLAGS_OFFERER:
       NR_ICE_CTX_FLAGS_ANSWERER;
   flags |= NR_ICE_CTX_FLAGS_AGGRESSIVE_NOMINATION;
--- a/media/mtransport/test/ice_unittest.cpp
+++ b/media/mtransport/test/ice_unittest.cpp
@@ -45,16 +45,18 @@
 #include "gtest/gtest.h"
 #include "gtest_utils.h"
 
 using namespace mozilla;
 MtransportTestUtils *test_utils;
 
 bool stream_added = false;
 
+static int kDefaultTimeout = 7000;
+
 const std::string kDefaultStunServerAddress((char *)"23.21.150.121");
 const std::string kDefaultStunServerHostname(
     (char *)"ec2-23-21-150-121.compute-1.amazonaws.com");
 const std::string kBogusStunServerHostname(
     (char *)"stun-server-nonexistent.invalid");
 const uint16_t kDefaultStunServerPort=3478;
 const std::string kBogusIceCandidate(
     (char *)"candidate:0 2 UDP 2113601790 192.168.178.20 50769 typ");
@@ -705,17 +707,17 @@ class IceGatherTest : public ::testing::
      peer_->Gather();
 
     if (wait) {
       WaitForGather();
     }
   }
 
   void WaitForGather() {
-    ASSERT_TRUE_WAIT(peer_->gathering_complete(), 10000);
+    ASSERT_TRUE_WAIT(peer_->gathering_complete(), kDefaultTimeout);
   }
 
   void UseFakeStunServerWithResponse(const std::string& fake_addr,
                                      uint16_t fake_port) {
     TestStunServer::GetInstance()->SetResponseAddr(fake_addr, fake_port);
     // Sets an additional stun server
     peer_->SetStunServer(TestStunServer::GetInstance()->addr(),
                          TestStunServer::GetInstance()->port());
@@ -765,20 +767,20 @@ class IceConnectTest : public ::testing:
   bool Gather(bool wait) {
     Init(false);
     p1_->SetStunServer(g_stun_server_address, kDefaultStunServerPort);
     p2_->SetStunServer(g_stun_server_address, kDefaultStunServerPort);
     p1_->Gather();
     p2_->Gather();
 
     if (wait) {
-      EXPECT_TRUE_WAIT(p1_->gathering_complete(), 10000);
+      EXPECT_TRUE_WAIT(p1_->gathering_complete(), kDefaultTimeout);
       if (!p1_->gathering_complete())
         return false;
-      EXPECT_TRUE_WAIT(p2_->gathering_complete(), 10000);
+      EXPECT_TRUE_WAIT(p2_->gathering_complete(), kDefaultTimeout);
       if (!p2_->gathering_complete())
         return false;
     }
     return true;
   }
 
   void SetTurnServer(const std::string addr, uint16_t port,
                      const std::string username,
@@ -799,18 +801,20 @@ class IceConnectTest : public ::testing:
       p2_->SetCandidateFilter(filter);
     }
   }
 
   void Connect() {
     p1_->Connect(p2_, TRICKLE_NONE);
     p2_->Connect(p1_, TRICKLE_NONE);
 
-    ASSERT_TRUE_WAIT(p1_->ready_ct() == 1 && p2_->ready_ct() == 1, 5000);
-    ASSERT_TRUE_WAIT(p1_->ice_complete() && p2_->ice_complete(), 5000);
+    ASSERT_TRUE_WAIT(p1_->ready_ct() == 1 && p2_->ready_ct() == 1,
+                     kDefaultTimeout);
+    ASSERT_TRUE_WAIT(p1_->ice_complete() && p2_->ice_complete(),
+                     kDefaultTimeout);
 
     p1_->DumpAndCheckActiveCandidates();
     p2_->DumpAndCheckActiveCandidates();
   }
 
   void SetExpectedTypes(NrIceCandidate::Type local, NrIceCandidate::Type remote,
                         std::string transport = kNrIceTransportUdp) {
     p1_->SetExpectedTypes(local, remote, transport);
@@ -828,35 +832,36 @@ class IceConnectTest : public ::testing:
   }
 
   void ConnectP2(TrickleMode mode = TRICKLE_NONE) {
     p2_->Connect(p1_, mode);
   }
 
   void WaitForComplete(int expected_streams = 1) {
     ASSERT_TRUE_WAIT(p1_->ready_ct() == expected_streams &&
-                     p2_->ready_ct() == expected_streams, 5000);
-    ASSERT_TRUE_WAIT(p1_->ice_complete() && p2_->ice_complete(), 5000);
+                     p2_->ready_ct() == expected_streams, kDefaultTimeout);
+    ASSERT_TRUE_WAIT(p1_->ice_complete() && p2_->ice_complete(),
+                     kDefaultTimeout);
   }
 
   void WaitForGather() {
-    ASSERT_TRUE_WAIT(p1_->gathering_complete(), 10000);
-    ASSERT_TRUE_WAIT(p2_->gathering_complete(), 10000);
+    ASSERT_TRUE_WAIT(p1_->gathering_complete(), kDefaultTimeout);
+    ASSERT_TRUE_WAIT(p2_->gathering_complete(), kDefaultTimeout);
   }
 
   void ConnectTrickle(TrickleMode trickle = TRICKLE_SIMULATE) {
     p1_->Connect(p2_, trickle);
     p2_->Connect(p1_, trickle);
   }
 
   void SimulateTrickle(size_t stream) {
     p1_->SimulateTrickle(stream);
     p2_->SimulateTrickle(stream);
-    ASSERT_TRUE_WAIT(p1_->is_ready(stream), 5000);
-    ASSERT_TRUE_WAIT(p2_->is_ready(stream), 5000);
+    ASSERT_TRUE_WAIT(p1_->is_ready(stream), kDefaultTimeout);
+    ASSERT_TRUE_WAIT(p2_->is_ready(stream), kDefaultTimeout);
   }
 
   void SimulateTrickleP1(size_t stream) {
     p1_->SimulateTrickle(stream);
   }
 
   void SimulateTrickleP2(size_t stream) {
     p2_->SimulateTrickle(stream);
@@ -873,17 +878,17 @@ class IceConnectTest : public ::testing:
     p1_->Connect(p2_, TRICKLE_NONE, true);
     p2_->Connect(p1_, TRICKLE_NONE, false);
     test_utils->sts_target()->Dispatch(WrapRunnable(this,
                                                     &IceConnectTest::CloseP1),
                                        NS_DISPATCH_SYNC);
     p2_->StartChecks();
 
     // Wait to see if we crash
-    PR_Sleep(PR_MillisecondsToInterval(5000));
+    PR_Sleep(PR_MillisecondsToInterval(kDefaultTimeout));
   }
 
   void SendReceive() {
     //    p1_->Send(2);
     test_utils->sts_target()->Dispatch(
         WrapRunnable(p1_.get(),
                      &IceTestPeer::SendPacket, 0, 1,
                      reinterpret_cast<const unsigned char *>("TEST"), 4),
@@ -1203,18 +1208,18 @@ TEST_F(IceConnectTest, TestConnectTrickl
   ASSERT_TRUE_WAIT(p2_->ice_complete(), 1000);
 }
 
 TEST_F(IceConnectTest, TestConnectRealTrickleOneStreamOneComponent) {
   AddStream("first", 1);
   AddStream("second", 1);
   ASSERT_TRUE(Gather(false));
   ConnectTrickle(TRICKLE_REAL);
-  ASSERT_TRUE_WAIT(p1_->ice_complete(), 5000);
-  ASSERT_TRUE_WAIT(p2_->ice_complete(), 5000);
+  ASSERT_TRUE_WAIT(p1_->ice_complete(), kDefaultTimeout);
+  ASSERT_TRUE_WAIT(p2_->ice_complete(), kDefaultTimeout);
   WaitForGather();  // ICE can complete before we finish gathering.
 }
 
 TEST_F(IceConnectTest, TestSendReceive) {
   AddStream("first", 1);
   ASSERT_TRUE(Gather(true));
   Connect();
   SendReceive();
--- a/media/webrtc/signaling/test/signaling_unittests.cpp
+++ b/media/webrtc/signaling/test/signaling_unittests.cpp
@@ -54,17 +54,17 @@ bool gTestsComplete = false;
 
 #ifndef USE_FAKE_MEDIA_STREAMS
 #error USE_FAKE_MEDIA_STREAMS undefined
 #endif
 #ifndef USE_FAKE_PCOBSERVER
 #error USE_FAKE_PCOBSERVER undefined
 #endif
 
-static int kDefaultTimeout = 5000;
+static int kDefaultTimeout = 7000;
 static bool fRtcpMux = true;
 
 static std::string callerName = "caller";
 static std::string calleeName = "callee";
 
 #define ARRAY_TO_STL(container, type, array) \
         (container<type>((array), (array) + PR_ARRAY_SIZE(array)))
 
@@ -730,26 +730,26 @@ class SignalingAgent {
       WrapRunnable(this, &SignalingAgent::Init_m, thread));
 
     ASSERT_TRUE_WAIT(sipcc_state() == PCImplSipccState::Started,
                      kDefaultTimeout);
   }
 
   void WaitForGather() {
     ASSERT_TRUE_WAIT(ice_gathering_state() == PCImplIceGatheringState::Complete,
-                     5000);
+                     kDefaultTimeout);
 
     std::cout << name << ": Init Complete" << std::endl;
   }
 
   bool WaitForGatherAllowFail() {
     EXPECT_TRUE_WAIT(
         ice_gathering_state() == PCImplIceGatheringState::Complete ||
         ice_connection_state() == PCImplIceConnectionState::Failed,
-        5000);
+        kDefaultTimeout);
 
     if (ice_connection_state() == PCImplIceConnectionState::Failed) {
       std::cout << name << ": Init Failed" << std::endl;
       return false;
     }
 
     std::cout << name << "Init Complete" << std::endl;
     return true;