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

Unified Diff: webrtc/p2p/base/stun_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/stun_unittest.cc
diff --git a/webrtc/p2p/base/stun_unittest.cc b/webrtc/p2p/base/stun_unittest.cc
index f12fa82cde5583c18ffa591735d9029469a5cba2..3f8fa018043c5790f4b6ff5cf9735daccf0b40b8 100644
--- a/webrtc/p2p/base/stun_unittest.cc
+++ b/webrtc/p2p/base/stun_unittest.cc
@@ -614,21 +614,21 @@ TEST_F(StunTest, ReadRfc5769RequestMessage) {
const StunByteStringAttribute* software =
msg.GetByteString(STUN_ATTR_SOFTWARE);
- ASSERT_TRUE(software != NULL);
+ ASSERT_TRUE(software != nullptr);
EXPECT_EQ(kRfc5769SampleMsgClientSoftware, software->GetString());
const StunByteStringAttribute* username =
msg.GetByteString(STUN_ATTR_USERNAME);
- ASSERT_TRUE(username != NULL);
+ ASSERT_TRUE(username != nullptr);
EXPECT_EQ(kRfc5769SampleMsgUsername, username->GetString());
// Actual M-I value checked in a later test.
- ASSERT_TRUE(msg.GetByteString(STUN_ATTR_MESSAGE_INTEGRITY) != NULL);
+ ASSERT_TRUE(msg.GetByteString(STUN_ATTR_MESSAGE_INTEGRITY) != nullptr);
// Fingerprint checked in a later test, but double-check the value here.
const StunUInt32Attribute* fingerprint =
msg.GetUInt32(STUN_ATTR_FINGERPRINT);
- ASSERT_TRUE(fingerprint != NULL);
+ ASSERT_TRUE(fingerprint != nullptr);
EXPECT_EQ(0xe57a3bcf, fingerprint->value());
}
@@ -642,17 +642,17 @@ TEST_F(StunTest, ReadRfc5769ResponseMessage) {
const StunByteStringAttribute* software =
msg.GetByteString(STUN_ATTR_SOFTWARE);
- ASSERT_TRUE(software != NULL);
+ ASSERT_TRUE(software != nullptr);
EXPECT_EQ(kRfc5769SampleMsgServerSoftware, software->GetString());
const StunAddressAttribute* mapped_address =
msg.GetAddress(STUN_ATTR_XOR_MAPPED_ADDRESS);
- ASSERT_TRUE(mapped_address != NULL);
+ ASSERT_TRUE(mapped_address != nullptr);
EXPECT_EQ(kRfc5769SampleMsgMappedAddress, mapped_address->GetAddress());
// Actual M-I and fingerprint checked in later tests.
- ASSERT_TRUE(msg.GetByteString(STUN_ATTR_MESSAGE_INTEGRITY) != NULL);
- ASSERT_TRUE(msg.GetUInt32(STUN_ATTR_FINGERPRINT) != NULL);
+ ASSERT_TRUE(msg.GetByteString(STUN_ATTR_MESSAGE_INTEGRITY) != nullptr);
+ ASSERT_TRUE(msg.GetUInt32(STUN_ATTR_FINGERPRINT) != nullptr);
}
// Read the RFC5389 fields from the RFC5769 sample STUN response for IPv6.
@@ -665,17 +665,17 @@ TEST_F(StunTest, ReadRfc5769ResponseMessageIPv6) {
const StunByteStringAttribute* software =
msg.GetByteString(STUN_ATTR_SOFTWARE);
- ASSERT_TRUE(software != NULL);
+ ASSERT_TRUE(software != nullptr);
EXPECT_EQ(kRfc5769SampleMsgServerSoftware, software->GetString());
const StunAddressAttribute* mapped_address =
msg.GetAddress(STUN_ATTR_XOR_MAPPED_ADDRESS);
- ASSERT_TRUE(mapped_address != NULL);
+ ASSERT_TRUE(mapped_address != nullptr);
EXPECT_EQ(kRfc5769SampleMsgIPv6MappedAddress, mapped_address->GetAddress());
// Actual M-I and fingerprint checked in later tests.
- ASSERT_TRUE(msg.GetByteString(STUN_ATTR_MESSAGE_INTEGRITY) != NULL);
- ASSERT_TRUE(msg.GetUInt32(STUN_ATTR_FINGERPRINT) != NULL);
+ ASSERT_TRUE(msg.GetByteString(STUN_ATTR_MESSAGE_INTEGRITY) != nullptr);
+ ASSERT_TRUE(msg.GetUInt32(STUN_ATTR_FINGERPRINT) != nullptr);
}
// Read the RFC5389 fields from the RFC5769 sample STUN response with auth.
@@ -688,22 +688,22 @@ TEST_F(StunTest, ReadRfc5769RequestMessageLongTermAuth) {
const StunByteStringAttribute* username =
msg.GetByteString(STUN_ATTR_USERNAME);
- ASSERT_TRUE(username != NULL);
+ ASSERT_TRUE(username != nullptr);
EXPECT_EQ(kRfc5769SampleMsgWithAuthUsername, username->GetString());
const StunByteStringAttribute* nonce =
msg.GetByteString(STUN_ATTR_NONCE);
- ASSERT_TRUE(nonce != NULL);
+ ASSERT_TRUE(nonce != nullptr);
EXPECT_EQ(kRfc5769SampleMsgWithAuthNonce, nonce->GetString());
const StunByteStringAttribute* realm =
msg.GetByteString(STUN_ATTR_REALM);
- ASSERT_TRUE(realm != NULL);
+ ASSERT_TRUE(realm != nullptr);
EXPECT_EQ(kRfc5769SampleMsgWithAuthRealm, realm->GetString());
// No fingerprint, actual M-I checked in later tests.
- ASSERT_TRUE(msg.GetByteString(STUN_ATTR_MESSAGE_INTEGRITY) != NULL);
- ASSERT_TRUE(msg.GetUInt32(STUN_ATTR_FINGERPRINT) == NULL);
+ ASSERT_TRUE(msg.GetByteString(STUN_ATTR_MESSAGE_INTEGRITY) != nullptr);
+ ASSERT_TRUE(msg.GetUInt32(STUN_ATTR_FINGERPRINT) == nullptr);
}
// The RFC3489 packet in this test is the same as
@@ -744,7 +744,7 @@ TEST_F(StunTest, SetIPv6XorAddressAttributeOwner) {
// Owner with a different transaction ID.
msg2.SetTransactionID("ABCDABCDABCD");
- StunXorAddressAttribute addr2(STUN_ATTR_XOR_MAPPED_ADDRESS, 20, NULL);
+ StunXorAddressAttribute addr2(STUN_ATTR_XOR_MAPPED_ADDRESS, 20, nullptr);
addr2.SetIP(addr->ipaddr());
addr2.SetPort(addr->port());
addr2.SetOwner(&msg2);
@@ -765,7 +765,7 @@ TEST_F(StunTest, SetIPv6XorAddressAttributeOwner) {
addr2.SetIP(addr->ipaddr());
addr2.SetPort(addr->port());
// Try writing with no owner at all, should fail and write nothing.
- addr2.SetOwner(NULL);
+ addr2.SetOwner(nullptr);
ASSERT_EQ(addr2.ipaddr(), addr->ipaddr());
wrong_buf.Clear();
EXPECT_FALSE(addr2.Write(&wrong_buf));
@@ -792,7 +792,7 @@ TEST_F(StunTest, SetIPv4XorAddressAttributeOwner) {
// Owner with a different transaction ID.
msg2.SetTransactionID("ABCDABCDABCD");
- StunXorAddressAttribute addr2(STUN_ATTR_XOR_MAPPED_ADDRESS, 20, NULL);
+ StunXorAddressAttribute addr2(STUN_ATTR_XOR_MAPPED_ADDRESS, 20, nullptr);
addr2.SetIP(addr->ipaddr());
addr2.SetPort(addr->port());
addr2.SetOwner(&msg2);
@@ -813,7 +813,7 @@ TEST_F(StunTest, SetIPv4XorAddressAttributeOwner) {
ASSERT_EQ(addr->ipaddr(), addr2.ipaddr());
// However, no owner is still an error, should fail and write nothing.
- addr2.SetOwner(NULL);
+ addr2.SetOwner(nullptr);
ASSERT_EQ(addr2.ipaddr(), addr->ipaddr());
wrong_buf.Clear();
EXPECT_FALSE(addr2.Write(&wrong_buf));
@@ -999,7 +999,7 @@ TEST_F(StunTest, ReadByteStringAttribute) {
CheckStunTransactionID(msg, kTestTransactionId2, kStunTransactionIdLength);
const StunByteStringAttribute* username =
msg.GetByteString(STUN_ATTR_USERNAME);
- ASSERT_TRUE(username != NULL);
+ ASSERT_TRUE(username != nullptr);
EXPECT_EQ(kTestUserName1, username->GetString());
}
@@ -1012,7 +1012,7 @@ TEST_F(StunTest, ReadPaddedByteStringAttribute) {
CheckStunTransactionID(msg, kTestTransactionId2, kStunTransactionIdLength);
const StunByteStringAttribute* username =
msg.GetByteString(STUN_ATTR_USERNAME);
- ASSERT_TRUE(username != NULL);
+ ASSERT_TRUE(username != nullptr);
EXPECT_EQ(kTestUserName2, username->GetString());
}
@@ -1023,7 +1023,7 @@ TEST_F(StunTest, ReadErrorCodeAttribute) {
CheckStunHeader(msg, STUN_BINDING_ERROR_RESPONSE, size);
CheckStunTransactionID(msg, kTestTransactionId1, kStunTransactionIdLength);
const StunErrorCodeAttribute* errorcode = msg.GetErrorCode();
- ASSERT_TRUE(errorcode != NULL);
+ ASSERT_TRUE(errorcode != nullptr);
EXPECT_EQ(kTestErrorClass, errorcode->eclass());
EXPECT_EQ(kTestErrorNumber, errorcode->number());
EXPECT_EQ(kTestErrorReason, errorcode->reason());
@@ -1035,7 +1035,7 @@ TEST_F(StunTest, ReadMessageWithAUInt16ListAttribute) {
size_t size = ReadStunMessage(&msg, kStunMessageWithUInt16ListAttribute);
CheckStunHeader(msg, STUN_BINDING_REQUEST, size);
const StunUInt16ListAttribute* types = msg.GetUnknownAttributes();
- ASSERT_TRUE(types != NULL);
+ ASSERT_TRUE(types != nullptr);
EXPECT_EQ(3U, types->Size());
EXPECT_EQ(0x1U, types->GetType(0));
EXPECT_EQ(0x1000U, types->GetType(1));
@@ -1050,7 +1050,7 @@ TEST_F(StunTest, ReadMessageWithAnUnknownAttribute) {
// Parsing should have succeeded and there should be a USERNAME attribute
const StunByteStringAttribute* username =
msg.GetByteString(STUN_ATTR_USERNAME);
- ASSERT_TRUE(username != NULL);
+ ASSERT_TRUE(username != nullptr);
EXPECT_EQ(kTestUserName2, username->GetString());
}
@@ -1060,7 +1060,7 @@ TEST_F(StunTest, ReadMessageWithOriginAttribute) {
CheckStunHeader(msg, STUN_BINDING_REQUEST, size);
const StunByteStringAttribute* origin =
msg.GetByteString(STUN_ATTR_ORIGIN);
- ASSERT_TRUE(origin != NULL);
+ ASSERT_TRUE(origin != nullptr);
EXPECT_EQ(kTestOrigin, origin->GetString());
}
@@ -1384,7 +1384,7 @@ TEST_F(StunTest, ReadRelayMessage) {
rtc::IPAddress legacy_ip(legacy_in_addr);
const StunAddressAttribute* addr = msg.GetAddress(STUN_ATTR_MAPPED_ADDRESS);
- ASSERT_TRUE(addr != NULL);
+ ASSERT_TRUE(addr != nullptr);
EXPECT_EQ(1, addr->family());
EXPECT_EQ(13, addr->port());
EXPECT_EQ(legacy_ip, addr->ipaddr());
@@ -1396,7 +1396,7 @@ TEST_F(StunTest, ReadRelayMessage) {
msg2.AddAttribute(addr2);
const StunByteStringAttribute* bytes = msg.GetByteString(STUN_ATTR_USERNAME);
- ASSERT_TRUE(bytes != NULL);
+ ASSERT_TRUE(bytes != nullptr);
EXPECT_EQ(12U, bytes->length());
EXPECT_EQ("abcdefghijkl", bytes->GetString());
@@ -1406,7 +1406,7 @@ TEST_F(StunTest, ReadRelayMessage) {
msg2.AddAttribute(bytes2);
const StunUInt32Attribute* uval = msg.GetUInt32(STUN_ATTR_LIFETIME);
- ASSERT_TRUE(uval != NULL);
+ ASSERT_TRUE(uval != nullptr);
EXPECT_EQ(11U, uval->value());
StunUInt32Attribute* uval2 = StunAttribute::CreateUInt32(STUN_ATTR_LIFETIME);
@@ -1414,7 +1414,7 @@ TEST_F(StunTest, ReadRelayMessage) {
msg2.AddAttribute(uval2);
bytes = msg.GetByteString(STUN_ATTR_MAGIC_COOKIE);
- ASSERT_TRUE(bytes != NULL);
+ ASSERT_TRUE(bytes != nullptr);
EXPECT_EQ(4U, bytes->length());
EXPECT_EQ(0,
memcmp(bytes->bytes(),
@@ -1427,7 +1427,7 @@ TEST_F(StunTest, ReadRelayMessage) {
msg2.AddAttribute(bytes2);
uval = msg.GetUInt32(STUN_ATTR_BANDWIDTH);
- ASSERT_TRUE(uval != NULL);
+ ASSERT_TRUE(uval != nullptr);
EXPECT_EQ(6U, uval->value());
uval2 = StunAttribute::CreateUInt32(STUN_ATTR_BANDWIDTH);
@@ -1435,7 +1435,7 @@ TEST_F(StunTest, ReadRelayMessage) {
msg2.AddAttribute(uval2);
addr = msg.GetAddress(STUN_ATTR_DESTINATION_ADDRESS);
- ASSERT_TRUE(addr != NULL);
+ ASSERT_TRUE(addr != nullptr);
EXPECT_EQ(1, addr->family());
EXPECT_EQ(13, addr->port());
EXPECT_EQ(legacy_ip, addr->ipaddr());
@@ -1446,7 +1446,7 @@ TEST_F(StunTest, ReadRelayMessage) {
msg2.AddAttribute(addr2);
addr = msg.GetAddress(STUN_ATTR_SOURCE_ADDRESS2);
- ASSERT_TRUE(addr != NULL);
+ ASSERT_TRUE(addr != nullptr);
EXPECT_EQ(1, addr->family());
EXPECT_EQ(13, addr->port());
EXPECT_EQ(legacy_ip, addr->ipaddr());
@@ -1457,7 +1457,7 @@ TEST_F(StunTest, ReadRelayMessage) {
msg2.AddAttribute(addr2);
bytes = msg.GetByteString(STUN_ATTR_DATA);
- ASSERT_TRUE(bytes != NULL);
+ ASSERT_TRUE(bytes != nullptr);
EXPECT_EQ(7U, bytes->length());
EXPECT_EQ("abcdefg", bytes->GetString());
« webrtc/base/event.cc ('K') | « webrtc/p2p/base/stun.cc ('k') | webrtc/p2p/base/stunport.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698