OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/socket/tcp_listen_socket_unittest.h" | 5 #include "net/socket/tcp_listen_socket_unittest.h" |
6 | 6 |
7 #include <fcntl.h> | 7 #include <fcntl.h> |
8 #include <sys/types.h> | 8 #include <sys/types.h> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
11 #include "base/posix/eintr_wrapper.h" | 11 #include "base/posix/eintr_wrapper.h" |
12 #include "base/sys_byteorder.h" | 12 #include "base/sys_byteorder.h" |
13 #include "net/base/ip_endpoint.h" | 13 #include "net/base/ip_endpoint.h" |
14 #include "net/base/net_errors.h" | 14 #include "net/base/net_errors.h" |
15 #include "net/base/net_util.h" | 15 #include "net/base/net_util.h" |
16 #include "net/socket/socket_descriptor.h" | 16 #include "net/socket/socket_descriptor.h" |
17 #include "testing/platform_test.h" | 17 #include "testing/platform_test.h" |
18 | 18 |
19 namespace net { | 19 namespace net { |
20 | 20 |
21 static const int kReadBufSize = 1024; | 21 const int kReadBufSize = 1024; |
22 static const char kHelloWorld[] = "HELLO, WORLD"; | 22 const char kHelloWorld[] = "HELLO, WORLD"; |
23 static const int kMaxQueueSize = 20; | 23 const char kLoopback[] = "127.0.0.1"; |
24 static const char kLoopback[] = "127.0.0.1"; | |
25 static const int kDefaultTimeoutMs = 5000; | |
26 | 24 |
27 TCPListenSocketTester::TCPListenSocketTester() | 25 TCPListenSocketTester::TCPListenSocketTester() |
28 : loop_(NULL), | 26 : loop_(NULL), |
29 cv_(&lock_), | 27 cv_(&lock_), |
30 server_port_(0) {} | 28 server_port_(0) {} |
31 | 29 |
32 void TCPListenSocketTester::SetUp() { | 30 void TCPListenSocketTester::SetUp() { |
33 base::Thread::Options options; | 31 base::Thread::Options options; |
34 options.message_loop_type = base::MessageLoop::TYPE_IO; | 32 options.message_loop_type = base::MessageLoop::TYPE_IO; |
35 thread_.reset(new base::Thread("socketio_test")); | 33 thread_.reset(new base::Thread("socketio_test")); |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 | 300 |
303 TEST_F(TCPListenSocketTest, ServerSend) { | 301 TEST_F(TCPListenSocketTest, ServerSend) { |
304 tester_->TestServerSend(); | 302 tester_->TestServerSend(); |
305 } | 303 } |
306 | 304 |
307 TEST_F(TCPListenSocketTest, ServerSendMultiple) { | 305 TEST_F(TCPListenSocketTest, ServerSendMultiple) { |
308 tester_->TestServerSendMultiple(); | 306 tester_->TestServerSendMultiple(); |
309 } | 307 } |
310 | 308 |
311 } // namespace net | 309 } // namespace net |
OLD | NEW |