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

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

Issue 1084533002: Rename NetLogLogger and CapturingNetLog (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rename NetLogLogger and CapturingNetLog(removed compiler error for chromeOS) Created 5 years, 8 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 // 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_client_socket.h" 5 #include "net/socket/tcp_client_socket.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "net/base/address_list.h" 10 #include "net/base/address_list.h"
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 TestCompletionCallback* callback); 83 TestCompletionCallback* callback);
84 84
85 void SendClientRequest(); 85 void SendClientRequest();
86 86
87 void set_close_server_socket_on_next_send(bool close) { 87 void set_close_server_socket_on_next_send(bool close) {
88 close_server_socket_on_next_send_ = close; 88 close_server_socket_on_next_send_ = close;
89 } 89 }
90 90
91 protected: 91 protected:
92 uint16 listen_port_; 92 uint16 listen_port_;
93 CapturingNetLog net_log_; 93 TestNetLog net_log_;
94 ClientSocketFactory* const socket_factory_; 94 ClientSocketFactory* const socket_factory_;
95 scoped_ptr<StreamSocket> sock_; 95 scoped_ptr<StreamSocket> sock_;
96 96
97 private: 97 private:
98 scoped_ptr<TCPListenSocket> listen_sock_; 98 scoped_ptr<TCPListenSocket> listen_sock_;
99 scoped_ptr<TCPListenSocket> connected_sock_; 99 scoped_ptr<TCPListenSocket> connected_sock_;
100 bool close_server_socket_on_next_send_; 100 bool close_server_socket_on_next_send_;
101 }; 101 };
102 102
103 void TransportClientSocketTest::SetUp() { 103 void TransportClientSocketTest::SetUp() {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 INSTANTIATE_TEST_CASE_P(StreamSocket, 178 INSTANTIATE_TEST_CASE_P(StreamSocket,
179 TransportClientSocketTest, 179 TransportClientSocketTest,
180 ::testing::Values(TCP)); 180 ::testing::Values(TCP));
181 181
182 TEST_P(TransportClientSocketTest, Connect) { 182 TEST_P(TransportClientSocketTest, Connect) {
183 TestCompletionCallback callback; 183 TestCompletionCallback callback;
184 EXPECT_FALSE(sock_->IsConnected()); 184 EXPECT_FALSE(sock_->IsConnected());
185 185
186 int rv = sock_->Connect(callback.callback()); 186 int rv = sock_->Connect(callback.callback());
187 187
188 net::CapturingNetLog::CapturedEntryList net_log_entries; 188 net::TestNetLog::CapturedEntryList net_log_entries;
189 net_log_.GetEntries(&net_log_entries); 189 net_log_.GetEntries(&net_log_entries);
190 EXPECT_TRUE(net::LogContainsBeginEvent( 190 EXPECT_TRUE(net::LogContainsBeginEvent(
191 net_log_entries, 0, net::NetLog::TYPE_SOCKET_ALIVE)); 191 net_log_entries, 0, net::NetLog::TYPE_SOCKET_ALIVE));
192 EXPECT_TRUE(net::LogContainsBeginEvent( 192 EXPECT_TRUE(net::LogContainsBeginEvent(
193 net_log_entries, 1, net::NetLog::TYPE_TCP_CONNECT)); 193 net_log_entries, 1, net::NetLog::TYPE_TCP_CONNECT));
194 if (rv != OK) { 194 if (rv != OK) {
195 ASSERT_EQ(rv, ERR_IO_PENDING); 195 ASSERT_EQ(rv, ERR_IO_PENDING);
196 rv = callback.WaitForResult(); 196 rv = callback.WaitForResult();
197 EXPECT_EQ(rv, OK); 197 EXPECT_EQ(rv, OK);
198 } 198 }
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 441
442 // It's possible the read is blocked because it's already read all the data. 442 // It's possible the read is blocked because it's already read all the data.
443 // Close the server socket, so there will at least be a 0-byte read. 443 // Close the server socket, so there will at least be a 0-byte read.
444 CloseServerSocket(); 444 CloseServerSocket();
445 445
446 rv = callback.WaitForResult(); 446 rv = callback.WaitForResult();
447 EXPECT_GE(rv, 0); 447 EXPECT_GE(rv, 0);
448 } 448 }
449 449
450 } // namespace net 450 } // namespace net
OLDNEW
« no previous file with comments | « net/socket/transport_client_socket_pool_unittest.cc ('k') | net/socket/websocket_transport_client_socket_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698