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

Side by Side Diff: net/socket/tcp_listen_socket_unittest.cc

Issue 15829004: Update net/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: license twerk Created 7 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « net/socket/tcp_listen_socket.cc ('k') | net/socket/tcp_server_socket_unittest.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) 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"
(...skipping 25 matching lines...) Expand all
36 options.message_loop_type = base::MessageLoop::TYPE_IO; 36 options.message_loop_type = base::MessageLoop::TYPE_IO;
37 thread_.reset(new base::Thread("socketio_test")); 37 thread_.reset(new base::Thread("socketio_test"));
38 thread_->StartWithOptions(options); 38 thread_->StartWithOptions(options);
39 loop_ = reinterpret_cast<base::MessageLoopForIO*>(thread_->message_loop()); 39 loop_ = reinterpret_cast<base::MessageLoopForIO*>(thread_->message_loop());
40 40
41 loop_->PostTask(FROM_HERE, base::Bind( 41 loop_->PostTask(FROM_HERE, base::Bind(
42 &TCPListenSocketTester::Listen, this)); 42 &TCPListenSocketTester::Listen, this));
43 43
44 // verify Listen succeeded 44 // verify Listen succeeded
45 NextAction(); 45 NextAction();
46 ASSERT_FALSE(server_ == NULL); 46 ASSERT_FALSE(server_.get() == NULL);
47 ASSERT_EQ(ACTION_LISTEN, last_action_.type()); 47 ASSERT_EQ(ACTION_LISTEN, last_action_.type());
48 48
49 // verify the connect/accept and setup test_socket_ 49 // verify the connect/accept and setup test_socket_
50 test_socket_ = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); 50 test_socket_ = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
51 ASSERT_NE(StreamListenSocket::kInvalidSocket, test_socket_); 51 ASSERT_NE(StreamListenSocket::kInvalidSocket, test_socket_);
52 struct sockaddr_in client; 52 struct sockaddr_in client;
53 client.sin_family = AF_INET; 53 client.sin_family = AF_INET;
54 client.sin_addr.s_addr = inet_addr(kLoopback); 54 client.sin_addr.s_addr = inet_addr(kLoopback);
55 client.sin_port = base::HostToNet16(kTestPort); 55 client.sin_port = base::HostToNet16(kTestPort);
56 int ret = HANDLE_EINTR( 56 int ret = HANDLE_EINTR(
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 void TCPListenSocketTester::Shutdown() { 120 void TCPListenSocketTester::Shutdown() {
121 connection_->Release(); 121 connection_->Release();
122 connection_ = NULL; 122 connection_ = NULL;
123 server_->Release(); 123 server_->Release();
124 server_ = NULL; 124 server_ = NULL;
125 ReportAction(TCPListenSocketTestAction(ACTION_SHUTDOWN)); 125 ReportAction(TCPListenSocketTestAction(ACTION_SHUTDOWN));
126 } 126 }
127 127
128 void TCPListenSocketTester::Listen() { 128 void TCPListenSocketTester::Listen() {
129 server_ = DoListen(); 129 server_ = DoListen();
130 ASSERT_TRUE(server_); 130 ASSERT_TRUE(server_.get());
131 server_->AddRef(); 131 server_->AddRef();
132 ReportAction(TCPListenSocketTestAction(ACTION_LISTEN)); 132 ReportAction(TCPListenSocketTestAction(ACTION_LISTEN));
133 } 133 }
134 134
135 void TCPListenSocketTester::SendFromTester() { 135 void TCPListenSocketTester::SendFromTester() {
136 connection_->Send(kHelloWorld); 136 connection_->Send(kHelloWorld);
137 ReportAction(TCPListenSocketTestAction(ACTION_SEND)); 137 ReportAction(TCPListenSocketTestAction(ACTION_SEND));
138 } 138 }
139 139
140 void TCPListenSocketTester::TestClientSend() { 140 void TCPListenSocketTester::TestClientSend() {
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 287
288 TEST_F(TCPListenSocketTest, ServerSend) { 288 TEST_F(TCPListenSocketTest, ServerSend) {
289 tester_->TestServerSend(); 289 tester_->TestServerSend();
290 } 290 }
291 291
292 TEST_F(TCPListenSocketTest, ServerSendMultiple) { 292 TEST_F(TCPListenSocketTest, ServerSendMultiple) {
293 tester_->TestServerSendMultiple(); 293 tester_->TestServerSendMultiple();
294 } 294 }
295 295
296 } // namespace net 296 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/tcp_listen_socket.cc ('k') | net/socket/tcp_server_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698