OLD | NEW |
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/platform_test.h" | 5 #include "base/platform_test.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/net_errors.h" | 9 #include "net/base/net_errors.h" |
10 #include "net/base/scoped_host_mapper.h" | 10 #include "net/base/scoped_host_mapper.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 socket_factory_->CreateSSLClientSocket(new net::TCPClientSocket(addr), | 81 socket_factory_->CreateSSLClientSocket(new net::TCPClientSocket(addr), |
82 hostname, kDefaultSSLConfig)); | 82 hostname, kDefaultSSLConfig)); |
83 | 83 |
84 rv = sock->Connect(&callback); | 84 rv = sock->Connect(&callback); |
85 if (rv != net::OK) { | 85 if (rv != net::OK) { |
86 ASSERT_EQ(net::ERR_IO_PENDING, rv); | 86 ASSERT_EQ(net::ERR_IO_PENDING, rv); |
87 | 87 |
88 rv = callback.WaitForResult(); | 88 rv = callback.WaitForResult(); |
89 EXPECT_EQ(net::OK, rv); | 89 EXPECT_EQ(net::OK, rv); |
90 } | 90 } |
| 91 EXPECT_TRUE(sock->IsConnected()); |
91 | 92 |
92 const char request_text[] = "GET / HTTP/1.0\r\n\r\n"; | 93 const char request_text[] = "GET / HTTP/1.0\r\n\r\n"; |
93 rv = sock->Write(request_text, arraysize(request_text) - 1, &callback); | 94 rv = sock->Write(request_text, arraysize(request_text) - 1, &callback); |
94 EXPECT_TRUE(rv >= 0 || rv == net::ERR_IO_PENDING); | 95 EXPECT_TRUE(rv >= 0 || rv == net::ERR_IO_PENDING); |
95 | 96 |
96 if (rv == net::ERR_IO_PENDING) { | 97 if (rv == net::ERR_IO_PENDING) { |
97 rv = callback.WaitForResult(); | 98 rv = callback.WaitForResult(); |
98 EXPECT_EQ(static_cast<int>(arraysize(request_text) - 1), rv); | 99 EXPECT_EQ(static_cast<int>(arraysize(request_text) - 1), rv); |
99 } | 100 } |
100 | 101 |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
192 char buf[512]; | 193 char buf[512]; |
193 rv = sock->Read(buf, sizeof(buf), &callback); | 194 rv = sock->Read(buf, sizeof(buf), &callback); |
194 EXPECT_TRUE(rv >= 0 || rv == net::ERR_IO_PENDING); | 195 EXPECT_TRUE(rv >= 0 || rv == net::ERR_IO_PENDING); |
195 | 196 |
196 if (rv == net::ERR_IO_PENDING) | 197 if (rv == net::ERR_IO_PENDING) |
197 rv = callback.WaitForResult(); | 198 rv = callback.WaitForResult(); |
198 | 199 |
199 EXPECT_NE(rv, 0); | 200 EXPECT_NE(rv, 0); |
200 } | 201 } |
201 | 202 |
OLD | NEW |