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

Side by Side Diff: webrtc/p2p/base/stunport_unittest.cc

Issue 2677743002: Increase STUN RTOs (Closed)
Patch Set: merge Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « webrtc/p2p/base/port.cc ('k') | webrtc/p2p/base/stunrequest.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright 2009 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2009 The WebRTC Project Authors. All rights reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
(...skipping 12 matching lines...) Expand all
23 using cricket::ServerAddresses; 23 using cricket::ServerAddresses;
24 using rtc::SocketAddress; 24 using rtc::SocketAddress;
25 25
26 static const SocketAddress kLocalAddr("127.0.0.1", 0); 26 static const SocketAddress kLocalAddr("127.0.0.1", 0);
27 static const SocketAddress kStunAddr1("127.0.0.1", 5000); 27 static const SocketAddress kStunAddr1("127.0.0.1", 5000);
28 static const SocketAddress kStunAddr2("127.0.0.1", 4000); 28 static const SocketAddress kStunAddr2("127.0.0.1", 4000);
29 static const SocketAddress kStunAddr3("127.0.0.1", 3000); 29 static const SocketAddress kStunAddr3("127.0.0.1", 3000);
30 static const SocketAddress kBadAddr("0.0.0.1", 5000); 30 static const SocketAddress kBadAddr("0.0.0.1", 5000);
31 static const SocketAddress kStunHostnameAddr("localhost", 5000); 31 static const SocketAddress kStunHostnameAddr("localhost", 5000);
32 static const SocketAddress kBadHostnameAddr("not-a-real-hostname", 5000); 32 static const SocketAddress kBadHostnameAddr("not-a-real-hostname", 5000);
33 // STUN timeout (with all retries) is 9500ms. 33 // STUN timeout (with all retries) is cricket::STUN_TOTAL_TIMEOUT.
34 // Add some margin of error for slow bots. 34 // Add some margin of error for slow bots.
35 // TODO(deadbeef): Use simulated clock instead of just increasing timeouts to 35 static const int kTimeoutMs = cricket::STUN_TOTAL_TIMEOUT;
36 // fix flaky tests.
37 static const int kTimeoutMs = 15000;
38 // stun prio = 100 << 24 | 30 (IPV4) << 8 | 256 - 0 36 // stun prio = 100 << 24 | 30 (IPV4) << 8 | 256 - 0
39 static const uint32_t kStunCandidatePriority = 1677729535; 37 static const uint32_t kStunCandidatePriority = 1677729535;
40 static const int kInfiniteLifetime = -1; 38 static const int kInfiniteLifetime = -1;
41 static const int kHighCostPortKeepaliveLifetimeMs = 2 * 60 * 1000; 39 static const int kHighCostPortKeepaliveLifetimeMs = 2 * 60 * 1000;
42 40
43 // Tests connecting a StunPort to a fake STUN server (cricket::StunServer) 41 // Tests connecting a StunPort to a fake STUN server (cricket::StunServer)
44 // TODO: Use a VirtualSocketServer here. We have to use a 42 // TODO: Use a VirtualSocketServer here. We have to use a
45 // PhysicalSocketServer right now since DNS is not part of SocketServer yet. 43 // PhysicalSocketServer right now since DNS is not part of SocketServer yet.
46 class StunPortTestBase : public testing::Test, public sigslot::has_slots<> { 44 class StunPortTestBase : public testing::Test, public sigslot::has_slots<> {
47 public: 45 public:
(...skipping 326 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 // Test that by default, the STUN binding requests will last for a long time. 372 // Test that by default, the STUN binding requests will last for a long time.
375 TEST_F(StunPortTest, TestStunBindingRequestLongLifetime) { 373 TEST_F(StunPortTest, TestStunBindingRequestLongLifetime) {
376 SetKeepaliveDelay(101); 374 SetKeepaliveDelay(101);
377 CreateStunPort(kStunAddr1); 375 CreateStunPort(kStunAddr1);
378 PrepareAddress(); 376 PrepareAddress();
379 EXPECT_TRUE_SIMULATED_WAIT(done(), kTimeoutMs, fake_clock); 377 EXPECT_TRUE_SIMULATED_WAIT(done(), kTimeoutMs, fake_clock);
380 EXPECT_TRUE_SIMULATED_WAIT( 378 EXPECT_TRUE_SIMULATED_WAIT(
381 port()->HasPendingRequest(cricket::STUN_BINDING_REQUEST), 1000, 379 port()->HasPendingRequest(cricket::STUN_BINDING_REQUEST), 1000,
382 fake_clock); 380 fake_clock);
383 } 381 }
OLDNEW
« no previous file with comments | « webrtc/p2p/base/port.cc ('k') | webrtc/p2p/base/stunrequest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698