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

Side by Side Diff: webrtc/p2p/base/asyncstuntcpsocket_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 2013 The WebRTC Project Authors. All rights reserved. 2 * Copyright 2013 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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 }; 62 };
63 63
64 64
65 static const rtc::SocketAddress kClientAddr("11.11.11.11", 0); 65 static const rtc::SocketAddress kClientAddr("11.11.11.11", 0);
66 static const rtc::SocketAddress kServerAddr("22.22.22.22", 0); 66 static const rtc::SocketAddress kServerAddr("22.22.22.22", 0);
67 67
68 class AsyncStunTCPSocketTest : public testing::Test, 68 class AsyncStunTCPSocketTest : public testing::Test,
69 public sigslot::has_slots<> { 69 public sigslot::has_slots<> {
70 protected: 70 protected:
71 AsyncStunTCPSocketTest() 71 AsyncStunTCPSocketTest()
72 : vss_(new rtc::VirtualSocketServer(NULL)), 72 : vss_(new rtc::VirtualSocketServer(nullptr)), ss_scope_(vss_.get()) {}
73 ss_scope_(vss_.get()) {
74 }
75 73
76 virtual void SetUp() { 74 virtual void SetUp() {
77 CreateSockets(); 75 CreateSockets();
78 } 76 }
79 77
80 void CreateSockets() { 78 void CreateSockets() {
81 rtc::AsyncSocket* server = vss_->CreateAsyncSocket( 79 rtc::AsyncSocket* server = vss_->CreateAsyncSocket(
82 kServerAddr.family(), SOCK_STREAM); 80 kServerAddr.family(), SOCK_STREAM);
83 server->Bind(kServerAddr); 81 server->Bind(kServerAddr);
84 recv_socket_.reset(new AsyncStunTCPSocket(server, true)); 82 recv_socket_.reset(new AsyncStunTCPSocket(server, true));
85 recv_socket_->SignalNewConnection.connect( 83 recv_socket_->SignalNewConnection.connect(
86 this, &AsyncStunTCPSocketTest::OnNewConnection); 84 this, &AsyncStunTCPSocketTest::OnNewConnection);
87 85
88 rtc::AsyncSocket* client = vss_->CreateAsyncSocket( 86 rtc::AsyncSocket* client = vss_->CreateAsyncSocket(
89 kClientAddr.family(), SOCK_STREAM); 87 kClientAddr.family(), SOCK_STREAM);
90 send_socket_.reset(AsyncStunTCPSocket::Create( 88 send_socket_.reset(AsyncStunTCPSocket::Create(
91 client, kClientAddr, recv_socket_->GetLocalAddress())); 89 client, kClientAddr, recv_socket_->GetLocalAddress()));
92 ASSERT_TRUE(send_socket_.get() != NULL); 90 ASSERT_TRUE(send_socket_.get() != nullptr);
93 vss_->ProcessMessagesUntilIdle(); 91 vss_->ProcessMessagesUntilIdle();
94 } 92 }
95 93
96 void OnReadPacket(rtc::AsyncPacketSocket* socket, const char* data, 94 void OnReadPacket(rtc::AsyncPacketSocket* socket, const char* data,
97 size_t len, const rtc::SocketAddress& remote_addr, 95 size_t len, const rtc::SocketAddress& remote_addr,
98 const rtc::PacketTime& packet_time) { 96 const rtc::PacketTime& packet_time) {
99 recv_packets_.push_back(std::string(data, len)); 97 recv_packets_.push_back(std::string(data, len));
100 } 98 }
101 99
102 void OnNewConnection(rtc::AsyncPacketSocket* server, 100 void OnNewConnection(rtc::AsyncPacketSocket* server,
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
256 TEST_F(AsyncStunTCPSocketTest, DISABLED_TestWithSmallSendBuffer) { 254 TEST_F(AsyncStunTCPSocketTest, DISABLED_TestWithSmallSendBuffer) {
257 vss_->set_send_buffer_capacity(1); 255 vss_->set_send_buffer_capacity(1);
258 Send(kTurnChannelDataMessageWithOddLength, 256 Send(kTurnChannelDataMessageWithOddLength,
259 sizeof(kTurnChannelDataMessageWithOddLength)); 257 sizeof(kTurnChannelDataMessageWithOddLength));
260 EXPECT_EQ(1u, recv_packets_.size()); 258 EXPECT_EQ(1u, recv_packets_.size());
261 EXPECT_TRUE(CheckData(kTurnChannelDataMessageWithOddLength, 259 EXPECT_TRUE(CheckData(kTurnChannelDataMessageWithOddLength,
262 sizeof(kTurnChannelDataMessageWithOddLength))); 260 sizeof(kTurnChannelDataMessageWithOddLength)));
263 } 261 }
264 262
265 } // namespace cricket 263 } // namespace cricket
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698