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

Side by Side Diff: webrtc/p2p/base/dtlstransportchannel_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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright 2011 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2011 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 const rtc::scoped_refptr<rtc::RTCCertificate>& cert, 44 const rtc::scoped_refptr<rtc::RTCCertificate>& cert,
45 cricket::ConnectionRole role) { 45 cricket::ConnectionRole role) {
46 std::unique_ptr<rtc::SSLFingerprint> fingerprint; 46 std::unique_ptr<rtc::SSLFingerprint> fingerprint;
47 if (cert) { 47 if (cert) {
48 std::string digest_algorithm; 48 std::string digest_algorithm;
49 EXPECT_TRUE( 49 EXPECT_TRUE(
50 cert->ssl_certificate().GetSignatureDigestAlgorithm(&digest_algorithm)); 50 cert->ssl_certificate().GetSignatureDigestAlgorithm(&digest_algorithm));
51 EXPECT_FALSE(digest_algorithm.empty()); 51 EXPECT_FALSE(digest_algorithm.empty());
52 fingerprint.reset( 52 fingerprint.reset(
53 rtc::SSLFingerprint::Create(digest_algorithm, cert->identity())); 53 rtc::SSLFingerprint::Create(digest_algorithm, cert->identity()));
54 EXPECT_TRUE(fingerprint.get() != NULL); 54 EXPECT_TRUE(fingerprint.get() != nullptr);
55 EXPECT_EQ(rtc::DIGEST_SHA_256, digest_algorithm); 55 EXPECT_EQ(rtc::DIGEST_SHA_256, digest_algorithm);
56 } 56 }
57 return cricket::TransportDescription(std::vector<std::string>(), kIceUfrag1, 57 return cricket::TransportDescription(std::vector<std::string>(), kIceUfrag1,
58 kIcePwd1, cricket::ICEMODE_FULL, role, 58 kIcePwd1, cricket::ICEMODE_FULL, role,
59 fingerprint.get()); 59 fingerprint.get());
60 } 60 }
61 61
62 using cricket::ConnectionRole; 62 using cricket::ConnectionRole;
63 63
64 enum Flags { NF_REOFFER = 0x1, NF_EXPECT_FAILURE = 0x2 }; 64 enum Flags { NF_REOFFER = 0x1, NF_EXPECT_FAILURE = 0x2 };
(...skipping 354 matching lines...) Expand 10 before | Expand all | Expand 10 after
419 if (data[13] == 1) { 419 if (data[13] == 1) {
420 ++received_dtls_client_hellos_; 420 ++received_dtls_client_hellos_;
421 } else if (data[13] == 2) { 421 } else if (data[13] == 2) {
422 ++received_dtls_server_hellos_; 422 ++received_dtls_server_hellos_;
423 } 423 }
424 } else if (negotiated_dtls() && !(data[0] >= 20 && data[0] <= 22)) { 424 } else if (negotiated_dtls() && !(data[0] >= 20 && data[0] <= 22)) {
425 ASSERT_TRUE(data[0] == 23 || IsRtpLeadByte(data[0])); 425 ASSERT_TRUE(data[0] == 23 || IsRtpLeadByte(data[0]));
426 if (data[0] == 23) { 426 if (data[0] == 23) {
427 ASSERT_TRUE(VerifyEncryptedPacket(data, size)); 427 ASSERT_TRUE(VerifyEncryptedPacket(data, size));
428 } else if (IsRtpLeadByte(data[0])) { 428 } else if (IsRtpLeadByte(data[0])) {
429 ASSERT_TRUE(VerifyPacket(data, size, NULL)); 429 ASSERT_TRUE(VerifyPacket(data, size, nullptr));
430 } 430 }
431 } 431 }
432 } 432 }
433 433
434 private: 434 private:
435 std::string name_; 435 std::string name_;
436 rtc::scoped_refptr<rtc::RTCCertificate> certificate_; 436 rtc::scoped_refptr<rtc::RTCCertificate> certificate_;
437 std::vector<std::unique_ptr<cricket::FakeIceTransport>> fake_ice_transports_; 437 std::vector<std::unique_ptr<cricket::FakeIceTransport>> fake_ice_transports_;
438 std::vector<std::unique_ptr<cricket::DtlsTransport>> fake_dtls_transports_; 438 std::vector<std::unique_ptr<cricket::DtlsTransport>> fake_dtls_transports_;
439 std::unique_ptr<cricket::JsepTransport> transport_; 439 std::unique_ptr<cricket::JsepTransport> transport_;
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 }; 635 };
636 636
637 class DtlsTransportChannelTest : public DtlsTransportChannelTestBase, 637 class DtlsTransportChannelTest : public DtlsTransportChannelTestBase,
638 public ::testing::Test {}; 638 public ::testing::Test {};
639 639
640 // Test that transport negotiation of ICE, no DTLS works properly. 640 // Test that transport negotiation of ICE, no DTLS works properly.
641 TEST_F(DtlsTransportChannelTest, TestChannelSetupIce) { 641 TEST_F(DtlsTransportChannelTest, TestChannelSetupIce) {
642 Negotiate(); 642 Negotiate();
643 cricket::FakeIceTransport* channel1 = client1_.GetFakeIceTransort(0); 643 cricket::FakeIceTransport* channel1 = client1_.GetFakeIceTransort(0);
644 cricket::FakeIceTransport* channel2 = client2_.GetFakeIceTransort(0); 644 cricket::FakeIceTransport* channel2 = client2_.GetFakeIceTransort(0);
645 ASSERT_TRUE(channel1 != NULL); 645 ASSERT_TRUE(channel1 != nullptr);
646 ASSERT_TRUE(channel2 != NULL); 646 ASSERT_TRUE(channel2 != nullptr);
647 EXPECT_EQ(cricket::ICEROLE_CONTROLLING, channel1->GetIceRole()); 647 EXPECT_EQ(cricket::ICEROLE_CONTROLLING, channel1->GetIceRole());
648 EXPECT_EQ(1U, channel1->IceTiebreaker()); 648 EXPECT_EQ(1U, channel1->IceTiebreaker());
649 EXPECT_EQ(kIceUfrag1, channel1->ice_ufrag()); 649 EXPECT_EQ(kIceUfrag1, channel1->ice_ufrag());
650 EXPECT_EQ(kIcePwd1, channel1->ice_pwd()); 650 EXPECT_EQ(kIcePwd1, channel1->ice_pwd());
651 EXPECT_EQ(cricket::ICEROLE_CONTROLLED, channel2->GetIceRole()); 651 EXPECT_EQ(cricket::ICEROLE_CONTROLLED, channel2->GetIceRole());
652 EXPECT_EQ(2U, channel2->IceTiebreaker()); 652 EXPECT_EQ(2U, channel2->IceTiebreaker());
653 } 653 }
654 654
655 // Connect without DTLS, and transfer some data. 655 // Connect without DTLS, and transfer some data.
656 TEST_F(DtlsTransportChannelTest, TestTransfer) { 656 TEST_F(DtlsTransportChannelTest, TestTransfer) {
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
1160 std::vector<DtlsTransportEvent>{ 1160 std::vector<DtlsTransportEvent>{
1161 CALLER_RECEIVES_CLIENTHELLO, CALLER_RECEIVES_FINGERPRINT, 1161 CALLER_RECEIVES_CLIENTHELLO, CALLER_RECEIVES_FINGERPRINT,
1162 CALLER_WRITABLE, HANDSHAKE_FINISHES}, 1162 CALLER_WRITABLE, HANDSHAKE_FINISHES},
1163 std::vector<DtlsTransportEvent>{ 1163 std::vector<DtlsTransportEvent>{
1164 CALLER_RECEIVES_CLIENTHELLO, CALLER_WRITABLE, 1164 CALLER_RECEIVES_CLIENTHELLO, CALLER_WRITABLE,
1165 CALLER_RECEIVES_FINGERPRINT, HANDSHAKE_FINISHES}, 1165 CALLER_RECEIVES_FINGERPRINT, HANDSHAKE_FINISHES},
1166 std::vector<DtlsTransportEvent>{CALLER_RECEIVES_CLIENTHELLO, 1166 std::vector<DtlsTransportEvent>{CALLER_RECEIVES_CLIENTHELLO,
1167 CALLER_WRITABLE, HANDSHAKE_FINISHES, 1167 CALLER_WRITABLE, HANDSHAKE_FINISHES,
1168 CALLER_RECEIVES_FINGERPRINT}), 1168 CALLER_RECEIVES_FINGERPRINT}),
1169 ::testing::Bool())); 1169 ::testing::Bool()));
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698