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

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

Issue 126303: Add a "LoadLog*" parameter to transactions, hostresolver, clientsocketpool. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync again Created 11 years, 4 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/socks_client_socket_unittest.cc ('k') | net/socket/ssl_test_util.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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/ssl_client_socket.h" 5 #include "net/socket/ssl_client_socket.h"
6 6
7 #include "net/base/address_list.h" 7 #include "net/base/address_list.h"
8 #include "net/base/host_resolver.h" 8 #include "net/base/host_resolver.h"
9 #include "net/base/io_buffer.h" 9 #include "net/base/io_buffer.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 #define MAYBE_Read_Interrupted Read_Interrupted 84 #define MAYBE_Read_Interrupted Read_Interrupted
85 #endif 85 #endif
86 86
87 TEST_F(SSLClientSocketTest, MAYBE_Connect) { 87 TEST_F(SSLClientSocketTest, MAYBE_Connect) {
88 StartOKServer(); 88 StartOKServer();
89 89
90 net::AddressList addr; 90 net::AddressList addr;
91 TestCompletionCallback callback; 91 TestCompletionCallback callback;
92 92
93 net::HostResolver::RequestInfo info(server_.kHostName, server_.kOKHTTPSPort); 93 net::HostResolver::RequestInfo info(server_.kHostName, server_.kOKHTTPSPort);
94 int rv = resolver_->Resolve(info, &addr, NULL, NULL); 94 int rv = resolver_->Resolve(NULL, info, &addr, NULL, NULL);
95 EXPECT_EQ(net::OK, rv); 95 EXPECT_EQ(net::OK, rv);
96 96
97 net::ClientSocket *transport = new net::TCPClientSocket(addr); 97 net::ClientSocket *transport = new net::TCPClientSocket(addr);
98 rv = transport->Connect(&callback); 98 rv = transport->Connect(&callback);
99 if (rv == net::ERR_IO_PENDING) 99 if (rv == net::ERR_IO_PENDING)
100 rv = callback.WaitForResult(); 100 rv = callback.WaitForResult();
101 EXPECT_EQ(net::OK, rv); 101 EXPECT_EQ(net::OK, rv);
102 102
103 scoped_ptr<net::SSLClientSocket> sock( 103 scoped_ptr<net::SSLClientSocket> sock(
104 socket_factory_->CreateSSLClientSocket(transport, 104 socket_factory_->CreateSSLClientSocket(transport,
(...skipping 16 matching lines...) Expand all
121 EXPECT_FALSE(sock->IsConnected()); 121 EXPECT_FALSE(sock->IsConnected());
122 } 122 }
123 123
124 TEST_F(SSLClientSocketTest, MAYBE_ConnectExpired) { 124 TEST_F(SSLClientSocketTest, MAYBE_ConnectExpired) {
125 StartExpiredServer(); 125 StartExpiredServer();
126 126
127 net::AddressList addr; 127 net::AddressList addr;
128 TestCompletionCallback callback; 128 TestCompletionCallback callback;
129 129
130 net::HostResolver::RequestInfo info(server_.kHostName, server_.kBadHTTPSPort); 130 net::HostResolver::RequestInfo info(server_.kHostName, server_.kBadHTTPSPort);
131 int rv = resolver_->Resolve(info, &addr, NULL, NULL); 131 int rv = resolver_->Resolve(NULL, info, &addr, NULL, NULL);
132 EXPECT_EQ(net::OK, rv); 132 EXPECT_EQ(net::OK, rv);
133 133
134 net::ClientSocket *transport = new net::TCPClientSocket(addr); 134 net::ClientSocket *transport = new net::TCPClientSocket(addr);
135 rv = transport->Connect(&callback); 135 rv = transport->Connect(&callback);
136 if (rv == net::ERR_IO_PENDING) 136 if (rv == net::ERR_IO_PENDING)
137 rv = callback.WaitForResult(); 137 rv = callback.WaitForResult();
138 EXPECT_EQ(net::OK, rv); 138 EXPECT_EQ(net::OK, rv);
139 139
140 scoped_ptr<net::SSLClientSocket> sock( 140 scoped_ptr<net::SSLClientSocket> sock(
141 socket_factory_->CreateSSLClientSocket(transport, 141 socket_factory_->CreateSSLClientSocket(transport,
(...skipping 16 matching lines...) Expand all
158 } 158 }
159 159
160 TEST_F(SSLClientSocketTest, MAYBE_ConnectMismatched) { 160 TEST_F(SSLClientSocketTest, MAYBE_ConnectMismatched) {
161 StartMismatchedServer(); 161 StartMismatchedServer();
162 162
163 net::AddressList addr; 163 net::AddressList addr;
164 TestCompletionCallback callback; 164 TestCompletionCallback callback;
165 165
166 net::HostResolver::RequestInfo info(server_.kMismatchedHostName, 166 net::HostResolver::RequestInfo info(server_.kMismatchedHostName,
167 server_.kOKHTTPSPort); 167 server_.kOKHTTPSPort);
168 int rv = resolver_->Resolve(info, &addr, NULL, NULL); 168 int rv = resolver_->Resolve(NULL, info, &addr, NULL, NULL);
169 EXPECT_EQ(net::OK, rv); 169 EXPECT_EQ(net::OK, rv);
170 170
171 net::ClientSocket *transport = new net::TCPClientSocket(addr); 171 net::ClientSocket *transport = new net::TCPClientSocket(addr);
172 rv = transport->Connect(&callback); 172 rv = transport->Connect(&callback);
173 if (rv == net::ERR_IO_PENDING) 173 if (rv == net::ERR_IO_PENDING)
174 rv = callback.WaitForResult(); 174 rv = callback.WaitForResult();
175 EXPECT_EQ(net::OK, rv); 175 EXPECT_EQ(net::OK, rv);
176 176
177 scoped_ptr<net::SSLClientSocket> sock( 177 scoped_ptr<net::SSLClientSocket> sock(
178 socket_factory_->CreateSSLClientSocket(transport, 178 socket_factory_->CreateSSLClientSocket(transport,
(...skipping 20 matching lines...) Expand all
199 // - Server closes the underlying TCP connection directly. 199 // - Server closes the underlying TCP connection directly.
200 // - Server sends data unexpectedly. 200 // - Server sends data unexpectedly.
201 201
202 TEST_F(SSLClientSocketTest, MAYBE_Read) { 202 TEST_F(SSLClientSocketTest, MAYBE_Read) {
203 StartOKServer(); 203 StartOKServer();
204 204
205 net::AddressList addr; 205 net::AddressList addr;
206 TestCompletionCallback callback; 206 TestCompletionCallback callback;
207 207
208 net::HostResolver::RequestInfo info(server_.kHostName, server_.kOKHTTPSPort); 208 net::HostResolver::RequestInfo info(server_.kHostName, server_.kOKHTTPSPort);
209 int rv = resolver_->Resolve(info, &addr, &callback, NULL); 209 int rv = resolver_->Resolve(NULL, info, &addr, &callback, NULL);
210 EXPECT_EQ(net::ERR_IO_PENDING, rv); 210 EXPECT_EQ(net::ERR_IO_PENDING, rv);
211 211
212 rv = callback.WaitForResult(); 212 rv = callback.WaitForResult();
213 EXPECT_EQ(net::OK, rv); 213 EXPECT_EQ(net::OK, rv);
214 214
215 net::ClientSocket *transport = new net::TCPClientSocket(addr); 215 net::ClientSocket *transport = new net::TCPClientSocket(addr);
216 rv = transport->Connect(&callback); 216 rv = transport->Connect(&callback);
217 if (rv == net::ERR_IO_PENDING) 217 if (rv == net::ERR_IO_PENDING)
218 rv = callback.WaitForResult(); 218 rv = callback.WaitForResult();
219 EXPECT_EQ(net::OK, rv); 219 EXPECT_EQ(net::OK, rv);
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 } 259 }
260 } 260 }
261 261
262 TEST_F(SSLClientSocketTest, MAYBE_Read_SmallChunks) { 262 TEST_F(SSLClientSocketTest, MAYBE_Read_SmallChunks) {
263 StartOKServer(); 263 StartOKServer();
264 264
265 net::AddressList addr; 265 net::AddressList addr;
266 TestCompletionCallback callback; 266 TestCompletionCallback callback;
267 267
268 net::HostResolver::RequestInfo info(server_.kHostName, server_.kOKHTTPSPort); 268 net::HostResolver::RequestInfo info(server_.kHostName, server_.kOKHTTPSPort);
269 int rv = resolver_->Resolve(info, &addr, NULL, NULL); 269 int rv = resolver_->Resolve(NULL, info, &addr, NULL, NULL);
270 EXPECT_EQ(net::OK, rv); 270 EXPECT_EQ(net::OK, rv);
271 271
272 net::ClientSocket *transport = new net::TCPClientSocket(addr); 272 net::ClientSocket *transport = new net::TCPClientSocket(addr);
273 rv = transport->Connect(&callback); 273 rv = transport->Connect(&callback);
274 if (rv == net::ERR_IO_PENDING) 274 if (rv == net::ERR_IO_PENDING)
275 rv = callback.WaitForResult(); 275 rv = callback.WaitForResult();
276 EXPECT_EQ(net::OK, rv); 276 EXPECT_EQ(net::OK, rv);
277 277
278 scoped_ptr<net::SSLClientSocket> sock( 278 scoped_ptr<net::SSLClientSocket> sock(
279 socket_factory_->CreateSSLClientSocket(transport, 279 socket_factory_->CreateSSLClientSocket(transport,
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 } 314 }
315 } 315 }
316 316
317 TEST_F(SSLClientSocketTest, MAYBE_Read_Interrupted) { 317 TEST_F(SSLClientSocketTest, MAYBE_Read_Interrupted) {
318 StartOKServer(); 318 StartOKServer();
319 319
320 net::AddressList addr; 320 net::AddressList addr;
321 TestCompletionCallback callback; 321 TestCompletionCallback callback;
322 322
323 net::HostResolver::RequestInfo info(server_.kHostName, server_.kOKHTTPSPort); 323 net::HostResolver::RequestInfo info(server_.kHostName, server_.kOKHTTPSPort);
324 int rv = resolver_->Resolve(info, &addr, NULL, NULL); 324 int rv = resolver_->Resolve(NULL, info, &addr, NULL, NULL);
325 EXPECT_EQ(net::OK, rv); 325 EXPECT_EQ(net::OK, rv);
326 326
327 net::ClientSocket *transport = new net::TCPClientSocket(addr); 327 net::ClientSocket *transport = new net::TCPClientSocket(addr);
328 rv = transport->Connect(&callback); 328 rv = transport->Connect(&callback);
329 if (rv == net::ERR_IO_PENDING) 329 if (rv == net::ERR_IO_PENDING)
330 rv = callback.WaitForResult(); 330 rv = callback.WaitForResult();
331 EXPECT_EQ(net::OK, rv); 331 EXPECT_EQ(net::OK, rv);
332 332
333 scoped_ptr<net::SSLClientSocket> sock( 333 scoped_ptr<net::SSLClientSocket> sock(
334 socket_factory_->CreateSSLClientSocket(transport, 334 socket_factory_->CreateSSLClientSocket(transport,
(...skipping 23 matching lines...) Expand all
358 // Do a partial read and then exit. This test should not crash! 358 // Do a partial read and then exit. This test should not crash!
359 scoped_refptr<net::IOBuffer> buf = new net::IOBuffer(512); 359 scoped_refptr<net::IOBuffer> buf = new net::IOBuffer(512);
360 rv = sock->Read(buf, 512, &callback); 360 rv = sock->Read(buf, 512, &callback);
361 EXPECT_TRUE(rv >= 0 || rv == net::ERR_IO_PENDING); 361 EXPECT_TRUE(rv >= 0 || rv == net::ERR_IO_PENDING);
362 362
363 if (rv == net::ERR_IO_PENDING) 363 if (rv == net::ERR_IO_PENDING)
364 rv = callback.WaitForResult(); 364 rv = callback.WaitForResult();
365 365
366 EXPECT_NE(rv, 0); 366 EXPECT_NE(rv, 0);
367 } 367 }
OLDNEW
« no previous file with comments | « net/socket/socks_client_socket_unittest.cc ('k') | net/socket/ssl_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698