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

Side by Side Diff: net/base/listen_socket_unittest.cc

Issue 2868036: Brushed up listen socket: (Closed)
Patch Set: Lint. Created 10 years, 5 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 | « net/base/listen_socket_unittest.h ('k') | net/base/telnet_server.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 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/base/listen_socket_unittest.h" 5 #include "net/base/listen_socket_unittest.h"
6 6
7 #include <fcntl.h> 7 #include <fcntl.h>
8 8
9 #include "base/eintr_wrapper.h" 9 #include "base/eintr_wrapper.h"
10 #include "net/base/net_util.h" 10 #include "net/base/net_util.h"
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 } 205 }
206 206
207 void ListenSocketTester::DidAccept(ListenSocket *server, 207 void ListenSocketTester::DidAccept(ListenSocket *server,
208 ListenSocket *connection) { 208 ListenSocket *connection) {
209 connection_ = connection; 209 connection_ = connection;
210 connection_->AddRef(); 210 connection_->AddRef();
211 ReportAction(ListenSocketTestAction(ACTION_ACCEPT)); 211 ReportAction(ListenSocketTestAction(ACTION_ACCEPT));
212 } 212 }
213 213
214 void ListenSocketTester::DidRead(ListenSocket *connection, 214 void ListenSocketTester::DidRead(ListenSocket *connection,
215 const std::string& data) { 215 const char* data,
216 ReportAction(ListenSocketTestAction(ACTION_READ, data)); 216 int len) {
217 std::string str(data, len);
218 ReportAction(ListenSocketTestAction(ACTION_READ, str));
217 } 219 }
218 220
219 void ListenSocketTester::DidClose(ListenSocket *sock) { 221 void ListenSocketTester::DidClose(ListenSocket *sock) {
220 ReportAction(ListenSocketTestAction(ACTION_CLOSE)); 222 ReportAction(ListenSocketTestAction(ACTION_CLOSE));
221 } 223 }
222 224
223 bool ListenSocketTester::Send(SOCKET sock, const std::string& str) { 225 bool ListenSocketTester::Send(SOCKET sock, const std::string& str) {
224 int len = static_cast<int>(str.length()); 226 int len = static_cast<int>(str.length());
225 int send_len = HANDLE_EINTR(send(sock, str.data(), len, 0)); 227 int send_len = HANDLE_EINTR(send(sock, str.data(), len, 0));
226 if (send_len == SOCKET_ERROR) { 228 if (send_len == SOCKET_ERROR) {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 tester_->TestClientSend(); 315 tester_->TestClientSend();
314 } 316 }
315 317
316 TEST_F(ListenSocketTest, ClientSendLong) { 318 TEST_F(ListenSocketTest, ClientSendLong) {
317 tester_->TestClientSendLong(); 319 tester_->TestClientSendLong();
318 } 320 }
319 321
320 TEST_F(ListenSocketTest, ServerSend) { 322 TEST_F(ListenSocketTest, ServerSend) {
321 tester_->TestServerSend(); 323 tester_->TestServerSend();
322 } 324 }
OLDNEW
« no previous file with comments | « net/base/listen_socket_unittest.h ('k') | net/base/telnet_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698