Chromium Code Reviews| Index: webrtc/p2p/base/stunrequest_unittest.cc |
| diff --git a/webrtc/p2p/base/stunrequest_unittest.cc b/webrtc/p2p/base/stunrequest_unittest.cc |
| index 47583b90e8e9072b36a18a3ecfd4059303cb2dda..6b582fa6383d54842eb807f64f5c8484aab1b65a 100644 |
| --- a/webrtc/p2p/base/stunrequest_unittest.cc |
| +++ b/webrtc/p2p/base/stunrequest_unittest.cc |
| @@ -57,10 +57,10 @@ class StunRequestTest : public testing::Test, |
| static int TotalDelay(int sends) { |
| int total = 0; |
| for (int i = 0; i < sends; i++) { |
| - if (i < 4) |
| - total += 100 << i; |
| + if (i < 5) |
| + total += 250 << i; |
|
skvlad
2017/02/07 03:05:45
could it be more clear with a hardcoded array?
st
|
| else |
| - total += 1600; |
| + total += 8000; |
| } |
| return total; |
| } |
| @@ -143,9 +143,8 @@ TEST_F(StunRequestTest, TestUnexpected) { |
| } |
| // Test that requests are sent at the right times, and that the 9th request |
| -// (sent at 7900 ms) can be properly replied to. |
| +// (sent at 32000 ms) can be properly replied to. |
| TEST_F(StunRequestTest, TestBackoff) { |
| - const int MAX_TIMEOUT_MS = 10000; |
| rtc::ScopedFakeClock fake_clock; |
| StunMessage* req = CreateStunMessage(STUN_BINDING_REQUEST, NULL); |
| @@ -153,7 +152,8 @@ TEST_F(StunRequestTest, TestBackoff) { |
| manager_.Send(new StunRequestThunker(req, this)); |
| StunMessage* res = CreateStunMessage(STUN_BINDING_RESPONSE, req); |
| for (int i = 0; i < 9; ++i) { |
| - EXPECT_TRUE_SIMULATED_WAIT(request_count_ != i, MAX_TIMEOUT_MS, fake_clock); |
| + EXPECT_TRUE_SIMULATED_WAIT(request_count_ != i, STUN_TOTAL_TIMEOUT, |
| + fake_clock); |
| int64_t elapsed = rtc::TimeMillis() - start; |
| LOG(LS_INFO) << "STUN request #" << (i + 1) |
| << " sent at " << elapsed << " ms"; |
| @@ -168,15 +168,14 @@ TEST_F(StunRequestTest, TestBackoff) { |
| delete res; |
| } |
| -// Test that we timeout properly if no response is received in 9500 ms. |
| +// Test that we timeout properly if no response is received in 40000 ms. |
| TEST_F(StunRequestTest, TestTimeout) { |
| rtc::ScopedFakeClock fake_clock; |
| StunMessage* req = CreateStunMessage(STUN_BINDING_REQUEST, NULL); |
| StunMessage* res = CreateStunMessage(STUN_BINDING_RESPONSE, req); |
| manager_.Send(new StunRequestThunker(req, this)); |
| - // Simulate the 9500 ms STUN timeout |
| - SIMULATED_WAIT(false, 9500, fake_clock); |
| + SIMULATED_WAIT(false, cricket::STUN_TOTAL_TIMEOUT, fake_clock); |
| EXPECT_FALSE(manager_.CheckResponse(res)); |
| EXPECT_TRUE(response_ == NULL); |