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

Unified Diff: webrtc/p2p/base/p2ptransportchannel_unittest.cc

Issue 2685783014: Replace NULL with nullptr in all C++ files. (Closed)
Patch Set: Fixing android. 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 side-by-side diff with in-line comments
Download patch
Index: webrtc/p2p/base/p2ptransportchannel_unittest.cc
diff --git a/webrtc/p2p/base/p2ptransportchannel_unittest.cc b/webrtc/p2p/base/p2ptransportchannel_unittest.cc
index d1548a2224ef17ec4de4e64f329ee4d03efd0497..8f5301c2ff3df9615c7cc454c52d3e327da2eb44 100644
--- a/webrtc/p2p/base/p2ptransportchannel_unittest.cc
+++ b/webrtc/p2p/base/p2ptransportchannel_unittest.cc
@@ -292,7 +292,7 @@ class P2PTransportChannelTestBase : public testing::Test,
}
ChannelData* GetChannelData(rtc::PacketTransportInternal* transport) {
if (!HasTransport(transport))
- return NULL;
+ return nullptr;
if (cd1_.ch_.get() == transport)
return &cd1_;
else
@@ -430,7 +430,7 @@ class P2PTransportChannelTestBase : public testing::Test,
} else if (endpoint == 1) {
return &ep2_;
} else {
- return NULL;
+ return nullptr;
}
}
BasicPortAllocator* GetAllocator(int endpoint) {
@@ -553,9 +553,9 @@ class P2PTransportChannelTestBase : public testing::Test,
// Create the channels and wait for them to connect.
CreateChannels();
EXPECT_TRUE_SIMULATED_WAIT(
- ep1_ch1() != NULL && ep2_ch1() != NULL && ep1_ch1()->receiving() &&
- ep1_ch1()->writable() && ep2_ch1()->receiving() &&
- ep2_ch1()->writable(),
+ ep1_ch1() != nullptr && ep2_ch1() != nullptr &&
+ ep1_ch1()->receiving() && ep1_ch1()->writable() &&
+ ep2_ch1()->receiving() && ep2_ch1()->writable(),
expected.connect_wait + kShortTimeout, clock);
connect_time = rtc::TimeMillis() - connect_start;
if (connect_time < expected.connect_wait) {
@@ -819,12 +819,12 @@ class P2PTransportChannelTestBase : public testing::Test,
static const Candidate* LocalCandidate(P2PTransportChannel* ch) {
return (ch && ch->selected_connection())
? &ch->selected_connection()->local_candidate()
- : NULL;
+ : nullptr;
}
static const Candidate* RemoteCandidate(P2PTransportChannel* ch) {
return (ch && ch->selected_connection())
? &ch->selected_connection()->remote_candidate()
- : NULL;
+ : nullptr;
}
Endpoint* GetEndpoint(rtc::PacketTransportInternal* transport) {
if (ep1_.HasTransport(transport)) {
@@ -832,7 +832,7 @@ class P2PTransportChannelTestBase : public testing::Test,
} else if (ep2_.HasTransport(transport)) {
return &ep2_;
} else {
- return NULL;
+ return nullptr;
}
}
P2PTransportChannel* GetRemoteChannel(IceTransportInternal* ch) {
@@ -845,7 +845,7 @@ class P2PTransportChannelTestBase : public testing::Test,
else if (ch == ep2_ch2())
return ep1_ch2();
else
- return NULL;
+ return nullptr;
}
std::list<std::string>& GetPacketList(
rtc::PacketTransportInternal* transport) {
@@ -1082,29 +1082,42 @@ class P2PTransportChannelTest : public P2PTransportChannelTestBase {
#define LTPT &kLocalTcpToPrflxTcp
#define PTLT &kPrflxTcpToLocalTcp
// TODO: Enable these once TestRelayServer can accept external TCP.
-#define LTRT NULL
-#define LSRS NULL
+#define LTRT nullptr
+#define LSRS nullptr
// Test matrix. Originator behavior defined by rows, receiever by columns.
-// TODO: Fix NULLs caused by lack of TCP support in NATSocket.
-// TODO: Fix NULLs caused by no HTTP proxy support.
+// TODO: Fix nulls caused by lack of TCP support in NATSocket.
+// TODO: Fix nulls caused by no HTTP proxy support.
// TODO: Rearrange rows/columns from best to worst.
const P2PTransportChannelTest::Result*
P2PTransportChannelTest::kMatrix[NUM_CONFIGS][NUM_CONFIGS] = {
-// OPEN CONE ADDR PORT SYMM 2CON SCON !UDP !TCP HTTP PRXH PRXS
-/*OP*/ {LULU, LUSU, LUSU, LUSU, LUPU, LUSU, LUPU, LTPT, LTPT, LSRS, NULL, LTPT},
-/*CO*/ {SULU, SUSU, SUSU, SUSU, SUPU, SUSU, SUPU, NULL, NULL, LSRS, NULL, LTRT},
-/*AD*/ {SULU, SUSU, SUSU, SUSU, SUPU, SUSU, SUPU, NULL, NULL, LSRS, NULL, LTRT},
-/*PO*/ {SULU, SUSU, SUSU, SUSU, RUPU, SUSU, RUPU, NULL, NULL, LSRS, NULL, LTRT},
-/*SY*/ {PULU, PUSU, PUSU, PURU, PURU, PUSU, PURU, NULL, NULL, LSRS, NULL, LTRT},
-/*2C*/ {SULU, SUSU, SUSU, SUSU, SUPU, SUSU, SUPU, NULL, NULL, LSRS, NULL, LTRT},
-/*SC*/ {PULU, PUSU, PUSU, PURU, PURU, PUSU, PURU, NULL, NULL, LSRS, NULL, LTRT},
-/*!U*/ {LTPT, NULL, NULL, NULL, NULL, NULL, NULL, LTPT, LTPT, LSRS, NULL, LTRT},
-/*!T*/ {PTLT, NULL, NULL, NULL, NULL, NULL, NULL, PTLT, LTRT, LSRS, NULL, LTRT},
-/*HT*/ {LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, NULL, LSRS},
-/*PR*/ {NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL},
-/*PR*/ {LTRT, LTRT, LTRT, LTRT, LTRT, LTRT, LTRT, LTRT, LTRT, LSRS, NULL, LTRT},
+ // OPEN CONE ADDR PORT SYMM 2CON SCON !UDP !TCP HTTP PRXH
+ // PRXS
+ /*OP*/ {LULU, LUSU, LUSU, LUSU, LUPU, LUSU, LUPU, LTPT, LTPT, LSRS,
+ nullptr, LTPT},
+ /*CO*/ {SULU, SUSU, SUSU, SUSU, SUPU, SUSU, SUPU, nullptr, nullptr,
+ LSRS, nullptr, LTRT},
+ /*AD*/ {SULU, SUSU, SUSU, SUSU, SUPU, SUSU, SUPU, nullptr, nullptr,
+ LSRS, nullptr, LTRT},
+ /*PO*/ {SULU, SUSU, SUSU, SUSU, RUPU, SUSU, RUPU, nullptr, nullptr,
+ LSRS, nullptr, LTRT},
+ /*SY*/ {PULU, PUSU, PUSU, PURU, PURU, PUSU, PURU, nullptr, nullptr,
+ LSRS, nullptr, LTRT},
+ /*2C*/ {SULU, SUSU, SUSU, SUSU, SUPU, SUSU, SUPU, nullptr, nullptr,
+ LSRS, nullptr, LTRT},
+ /*SC*/ {PULU, PUSU, PUSU, PURU, PURU, PUSU, PURU, nullptr, nullptr,
+ LSRS, nullptr, LTRT},
+ /*!U*/ {LTPT, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
+ LTPT, LTPT, LSRS, nullptr, LTRT},
+ /*!T*/ {PTLT, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
+ PTLT, LTRT, LSRS, nullptr, LTRT},
+ /*HT*/ {LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, LSRS, LSRS,
+ nullptr, LSRS},
+ /*PR*/ {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
+ nullptr, nullptr, nullptr, nullptr, nullptr},
+ /*PR*/ {LTRT, LTRT, LTRT, LTRT, LTRT, LTRT, LTRT, LTRT, LTRT, LSRS,
+ nullptr, LTRT},
};
// The actual tests that exercise all the various configurations.
@@ -1113,7 +1126,7 @@ const P2PTransportChannelTest::Result*
TEST_F(P2PTransportChannelTest, z##Test##x##To##y) { \
ConfigureEndpoints(x, y, PORTALLOCATOR_ENABLE_SHARED_SOCKET, \
PORTALLOCATOR_ENABLE_SHARED_SOCKET); \
- if (kMatrix[x][y] != NULL) \
+ if (kMatrix[x][y] != nullptr) \
Test(*kMatrix[x][y]); \
else \
LOG(LS_WARNING) << "Not yet implemented"; \
@@ -1516,10 +1529,10 @@ TEST_F(P2PTransportChannelTest, RemoteCandidatesWithoutUfragPwd) {
ConfigureEndpoints(OPEN, OPEN, kDefaultPortAllocatorFlags,
kDefaultPortAllocatorFlags);
CreateChannels();
- const Connection* selected_connection = NULL;
+ const Connection* selected_connection = nullptr;
// Wait until the callee's connections are created.
EXPECT_TRUE_SIMULATED_WAIT(
- (selected_connection = ep2_ch1()->selected_connection()) != NULL,
+ (selected_connection = ep2_ch1()->selected_connection()) != nullptr,
kMediumTimeout, clock);
// Wait to make sure the selected connection is not changed.
SIMULATED_WAIT(ep2_ch1()->selected_connection() != selected_connection,
@@ -1562,7 +1575,7 @@ TEST_F(P2PTransportChannelTest, IncomingOnlyOpen) {
ep1_ch1()->set_incoming_only(true);
EXPECT_TRUE_SIMULATED_WAIT(
- ep1_ch1() != NULL && ep2_ch1() != NULL && ep1_ch1()->receiving() &&
+ ep1_ch1() != nullptr && ep2_ch1() != nullptr && ep1_ch1()->receiving() &&
ep1_ch1()->writable() && ep2_ch1()->receiving() &&
ep2_ch1()->writable(),
kMediumTimeout, clock);
@@ -1776,7 +1789,7 @@ TEST_F(P2PTransportChannelTest, TestContinualGathering) {
CreateChannels(continual_gathering_config, default_config);
EXPECT_TRUE_SIMULATED_WAIT(
- ep1_ch1() != NULL && ep2_ch1() != NULL && ep1_ch1()->receiving() &&
+ ep1_ch1() != nullptr && ep2_ch1() != nullptr && ep1_ch1()->receiving() &&
ep1_ch1()->writable() && ep2_ch1()->receiving() &&
ep2_ch1()->writable(),
kMediumTimeout, clock);
@@ -1820,7 +1833,7 @@ TEST_F(P2PTransportChannelTest, TestUsingPooledSessionBeforeDoneGathering) {
// Now let the endpoints connect and try exchanging some data.
CreateChannels();
EXPECT_TRUE_SIMULATED_WAIT(
- ep1_ch1() != NULL && ep2_ch1() != NULL && ep1_ch1()->receiving() &&
+ ep1_ch1() != nullptr && ep2_ch1() != nullptr && ep1_ch1()->receiving() &&
ep1_ch1()->writable() && ep2_ch1()->receiving() &&
ep2_ch1()->writable(),
kMediumTimeout, clock);
@@ -1865,7 +1878,7 @@ TEST_F(P2PTransportChannelTest, TestUsingPooledSessionAfterDoneGathering) {
// Now let the endpoints connect and try exchanging some data.
CreateChannels();
EXPECT_TRUE_SIMULATED_WAIT(
- ep1_ch1() != NULL && ep2_ch1() != NULL && ep1_ch1()->receiving() &&
+ ep1_ch1() != nullptr && ep2_ch1() != nullptr && ep1_ch1()->receiving() &&
ep1_ch1()->writable() && ep2_ch1()->receiving() &&
ep2_ch1()->writable(),
kMediumTimeout, clock);

Powered by Google App Engine
This is Rietveld 408576698