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

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

Issue 2622413005: Replace use of ASSERT in test code. (Closed)
Patch Set: Fixed another signed/unsigned comparison. Created 3 years, 11 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/dtlstransportchannel_unittest.cc ('k') | webrtc/p2p/base/port_unittest.cc » ('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
11 #include <algorithm> 11 #include <algorithm>
12 #include <memory> 12 #include <memory>
13 13
14 #include "webrtc/api/fakemetricsobserver.h" 14 #include "webrtc/api/fakemetricsobserver.h"
15 #include "webrtc/p2p/base/fakeportallocator.h" 15 #include "webrtc/p2p/base/fakeportallocator.h"
16 #include "webrtc/p2p/base/packettransportinterface.h" 16 #include "webrtc/p2p/base/packettransportinterface.h"
17 #include "webrtc/p2p/base/p2ptransportchannel.h" 17 #include "webrtc/p2p/base/p2ptransportchannel.h"
18 #include "webrtc/p2p/base/testrelayserver.h" 18 #include "webrtc/p2p/base/testrelayserver.h"
19 #include "webrtc/p2p/base/teststunserver.h" 19 #include "webrtc/p2p/base/teststunserver.h"
20 #include "webrtc/p2p/base/testturnserver.h" 20 #include "webrtc/p2p/base/testturnserver.h"
21 #include "webrtc/p2p/client/basicportallocator.h" 21 #include "webrtc/p2p/client/basicportallocator.h"
22 #include "webrtc/base/checks.h"
22 #include "webrtc/base/dscp.h" 23 #include "webrtc/base/dscp.h"
23 #include "webrtc/base/fakeclock.h" 24 #include "webrtc/base/fakeclock.h"
24 #include "webrtc/base/fakenetwork.h" 25 #include "webrtc/base/fakenetwork.h"
25 #include "webrtc/base/firewallsocketserver.h" 26 #include "webrtc/base/firewallsocketserver.h"
26 #include "webrtc/base/gunit.h" 27 #include "webrtc/base/gunit.h"
27 #include "webrtc/base/helpers.h" 28 #include "webrtc/base/helpers.h"
28 #include "webrtc/base/logging.h" 29 #include "webrtc/base/logging.h"
29 #include "webrtc/base/natserver.h" 30 #include "webrtc/base/natserver.h"
30 #include "webrtc/base/natsocketfactory.h" 31 #include "webrtc/base/natsocketfactory.h"
31 #include "webrtc/base/physicalsocketserver.h" 32 #include "webrtc/base/physicalsocketserver.h"
(...skipping 2017 matching lines...) Expand 10 before | Expand all | Expand 10 after
2049 EXPECT_TRUE(GetEndpoint(0)->ready_to_send_); 2050 EXPECT_TRUE(GetEndpoint(0)->ready_to_send_);
2050 EXPECT_EQ(len, SendData(ep1_ch1(), data, len)); 2051 EXPECT_EQ(len, SendData(ep1_ch1(), data, len));
2051 } 2052 }
2052 2053
2053 // Test what happens when we have 2 users behind the same NAT. This can lead 2054 // Test what happens when we have 2 users behind the same NAT. This can lead
2054 // to interesting behavior because the STUN server will only give out the 2055 // to interesting behavior because the STUN server will only give out the
2055 // address of the outermost NAT. 2056 // address of the outermost NAT.
2056 class P2PTransportChannelSameNatTest : public P2PTransportChannelTestBase { 2057 class P2PTransportChannelSameNatTest : public P2PTransportChannelTestBase {
2057 protected: 2058 protected:
2058 void ConfigureEndpoints(Config nat_type, Config config1, Config config2) { 2059 void ConfigureEndpoints(Config nat_type, Config config1, Config config2) {
2059 ASSERT(nat_type >= NAT_FULL_CONE && nat_type <= NAT_SYMMETRIC); 2060 RTC_CHECK(nat_type >= NAT_FULL_CONE && nat_type <= NAT_SYMMETRIC);
2060 rtc::NATSocketServer::Translator* outer_nat = 2061 rtc::NATSocketServer::Translator* outer_nat =
2061 nat()->AddTranslator(kPublicAddrs[0], kNatAddrs[0], 2062 nat()->AddTranslator(kPublicAddrs[0], kNatAddrs[0],
2062 static_cast<rtc::NATType>(nat_type - NAT_FULL_CONE)); 2063 static_cast<rtc::NATType>(nat_type - NAT_FULL_CONE));
2063 ConfigureEndpoint(outer_nat, 0, config1); 2064 ConfigureEndpoint(outer_nat, 0, config1);
2064 ConfigureEndpoint(outer_nat, 1, config2); 2065 ConfigureEndpoint(outer_nat, 1, config2);
2065 set_remote_ice_parameter_source(FROM_SETICEPARAMETERS); 2066 set_remote_ice_parameter_source(FROM_SETICEPARAMETERS);
2066 } 2067 }
2067 void ConfigureEndpoint(rtc::NATSocketServer::Translator* nat, 2068 void ConfigureEndpoint(rtc::NATSocketServer::Translator* nat,
2068 int endpoint, Config config) { 2069 int endpoint, Config config) {
2069 ASSERT(config <= NAT_SYMMETRIC); 2070 RTC_CHECK(config <= NAT_SYMMETRIC);
2070 if (config == OPEN) { 2071 if (config == OPEN) {
2071 AddAddress(endpoint, kPrivateAddrs[endpoint]); 2072 AddAddress(endpoint, kPrivateAddrs[endpoint]);
2072 nat->AddClient(kPrivateAddrs[endpoint]); 2073 nat->AddClient(kPrivateAddrs[endpoint]);
2073 } else { 2074 } else {
2074 AddAddress(endpoint, kCascadedPrivateAddrs[endpoint]); 2075 AddAddress(endpoint, kCascadedPrivateAddrs[endpoint]);
2075 nat->AddTranslator(kPrivateAddrs[endpoint], kCascadedNatAddrs[endpoint], 2076 nat->AddTranslator(kPrivateAddrs[endpoint], kCascadedNatAddrs[endpoint],
2076 static_cast<rtc::NATType>(config - NAT_FULL_CONE))->AddClient( 2077 static_cast<rtc::NATType>(config - NAT_FULL_CONE))->AddClient(
2077 kCascadedPrivateAddrs[endpoint]); 2078 kCascadedPrivateAddrs[endpoint]);
2078 } 2079 }
2079 } 2080 }
(...skipping 2307 matching lines...) Expand 10 before | Expand all | Expand 10 after
4387 4388
4388 // TCP Relay/Relay is the next. 4389 // TCP Relay/Relay is the next.
4389 VerifyNextPingableConnection(RELAY_PORT_TYPE, RELAY_PORT_TYPE, 4390 VerifyNextPingableConnection(RELAY_PORT_TYPE, RELAY_PORT_TYPE,
4390 TCP_PROTOCOL_NAME); 4391 TCP_PROTOCOL_NAME);
4391 4392
4392 // Finally, Local/Relay will be pinged. 4393 // Finally, Local/Relay will be pinged.
4393 VerifyNextPingableConnection(LOCAL_PORT_TYPE, RELAY_PORT_TYPE); 4394 VerifyNextPingableConnection(LOCAL_PORT_TYPE, RELAY_PORT_TYPE);
4394 } 4395 }
4395 4396
4396 } // namespace cricket { 4397 } // namespace cricket {
OLDNEW
« no previous file with comments | « webrtc/p2p/base/dtlstransportchannel_unittest.cc ('k') | webrtc/p2p/base/port_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698