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

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

Issue 21501: If an idle socket has received data unexpectedly, we... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Final upload before checkin. Created 11 years, 10 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/base/ssl_client_socket_nss.cc ('k') | net/base/ssl_client_socket_win.h » ('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 "base/ref_counted.h" 5 #include "base/ref_counted.h"
6 #include "net/base/address_list.h" 6 #include "net/base/address_list.h"
7 #include "net/base/client_socket_factory.h" 7 #include "net/base/client_socket_factory.h"
8 #include "net/base/host_resolver.h" 8 #include "net/base/host_resolver.h"
9 #include "net/base/host_resolver_unittest.h" 9 #include "net/base/host_resolver_unittest.h"
10 #include "net/base/net_errors.h" 10 #include "net/base/net_errors.h"
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 159
160 // The Windows code happens to keep the connection 160 // The Windows code happens to keep the connection
161 // open now in spite of an error. The designers of 161 // open now in spite of an error. The designers of
162 // this API intended to also allow the connection 162 // this API intended to also allow the connection
163 // to be closed on error, in which case the caller 163 // to be closed on error, in which case the caller
164 // should call ReconnectIgnoringLastError, but 164 // should call ReconnectIgnoringLastError, but
165 // that's currently unimplemented. 165 // that's currently unimplemented.
166 EXPECT_TRUE(sock->IsConnected()); 166 EXPECT_TRUE(sock->IsConnected());
167 } 167 }
168 168
169 // TODO(wtc): Add unit tests for IsConnectedAndIdle:
170 // - Server closes an SSL connection (with a close_notify alert message).
171 // - Server closes the underlying TCP connection directly.
172 // - Server sends data unexpectedly.
173
169 TEST_F(SSLClientSocketTest, MAYBE_Read) { 174 TEST_F(SSLClientSocketTest, MAYBE_Read) {
170 StartOKServer(); 175 StartOKServer();
171 176
172 net::AddressList addr; 177 net::AddressList addr;
173 net::HostResolver resolver; 178 net::HostResolver resolver;
174 TestCompletionCallback callback; 179 TestCompletionCallback callback;
175 180
176 int rv = resolver.Resolve(server_.kHostName, server_.kOKHTTPSPort, 181 int rv = resolver.Resolve(server_.kHostName, server_.kOKHTTPSPort,
177 &addr, &callback); 182 &addr, &callback);
178 EXPECT_EQ(net::ERR_IO_PENDING, rv); 183 EXPECT_EQ(net::ERR_IO_PENDING, rv);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 char buf[512]; 304 char buf[512];
300 rv = sock->Read(buf, sizeof(buf), &callback); 305 rv = sock->Read(buf, sizeof(buf), &callback);
301 EXPECT_TRUE(rv >= 0 || rv == net::ERR_IO_PENDING); 306 EXPECT_TRUE(rv >= 0 || rv == net::ERR_IO_PENDING);
302 307
303 if (rv == net::ERR_IO_PENDING) 308 if (rv == net::ERR_IO_PENDING)
304 rv = callback.WaitForResult(); 309 rv = callback.WaitForResult();
305 310
306 EXPECT_NE(rv, 0); 311 EXPECT_NE(rv, 0);
307 } 312 }
308 313
OLDNEW
« no previous file with comments | « net/base/ssl_client_socket_nss.cc ('k') | net/base/ssl_client_socket_win.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698