| 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/ref_counted.h" |
| 5 #include "net/base/address_list.h" | 6 #include "net/base/address_list.h" |
| 6 #include "net/base/client_socket_factory.h" | 7 #include "net/base/client_socket_factory.h" |
| 7 #include "net/base/host_resolver.h" | 8 #include "net/base/host_resolver.h" |
| 9 #include "net/base/host_resolver_unittest.h" |
| 8 #include "net/base/net_errors.h" | 10 #include "net/base/net_errors.h" |
| 9 #include "net/base/scoped_host_mapper.h" | |
| 10 #include "net/base/ssl_client_socket.h" | 11 #include "net/base/ssl_client_socket.h" |
| 11 #include "net/base/ssl_config_service.h" | 12 #include "net/base/ssl_config_service.h" |
| 12 #include "net/base/tcp_client_socket.h" | 13 #include "net/base/tcp_client_socket.h" |
| 13 #include "net/base/test_completion_callback.h" | 14 #include "net/base/test_completion_callback.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
| 15 #include "testing/platform_test.h" | 16 #include "testing/platform_test.h" |
| 16 | 17 |
| 17 //----------------------------------------------------------------------------- | 18 //----------------------------------------------------------------------------- |
| 18 | 19 |
| 19 const net::SSLConfig kDefaultSSLConfig; | 20 const net::SSLConfig kDefaultSSLConfig; |
| 20 | 21 |
| 21 class SSLClientSocketTest : public PlatformTest { | 22 class SSLClientSocketTest : public PlatformTest { |
| 22 public: | 23 public: |
| 23 SSLClientSocketTest() | 24 SSLClientSocketTest() |
| 24 : socket_factory_(net::ClientSocketFactory::GetDefaultFactory()) { | 25 : host_mapper_(new net::RuleBasedHostMapper()), |
| 26 scoped_host_mapper_(host_mapper_.get()), |
| 27 socket_factory_(net::ClientSocketFactory::GetDefaultFactory()) { |
| 25 // TODO(darin): kill this exception once we have a way to test out the | 28 // TODO(darin): kill this exception once we have a way to test out the |
| 26 // TCPClientSocket class using loopback connections. | 29 // TCPClientSocket class using loopback connections. |
| 27 host_mapper_.AddRule("bugs.webkit.org", "bugs.webkit.org"); | 30 host_mapper_->AddRule("bugs.webkit.org", "bugs.webkit.org"); |
| 28 } | 31 } |
| 29 | 32 |
| 30 protected: | 33 protected: |
| 31 net::ScopedHostMapper host_mapper_; | 34 scoped_refptr<net::RuleBasedHostMapper> host_mapper_; |
| 35 net::ScopedHostMapper scoped_host_mapper_; |
| 32 net::ClientSocketFactory* socket_factory_; | 36 net::ClientSocketFactory* socket_factory_; |
| 33 }; | 37 }; |
| 34 | 38 |
| 35 //----------------------------------------------------------------------------- | 39 //----------------------------------------------------------------------------- |
| 36 | 40 |
| 37 // bug 1354783 | 41 // bug 1354783 |
| 38 TEST_F(SSLClientSocketTest, DISABLED_Connect) { | 42 TEST_F(SSLClientSocketTest, DISABLED_Connect) { |
| 39 net::AddressList addr; | 43 net::AddressList addr; |
| 40 net::HostResolver resolver; | 44 net::HostResolver resolver; |
| 41 TestCompletionCallback callback; | 45 TestCompletionCallback callback; |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 char buf[512]; | 197 char buf[512]; |
| 194 rv = sock->Read(buf, sizeof(buf), &callback); | 198 rv = sock->Read(buf, sizeof(buf), &callback); |
| 195 EXPECT_TRUE(rv >= 0 || rv == net::ERR_IO_PENDING); | 199 EXPECT_TRUE(rv >= 0 || rv == net::ERR_IO_PENDING); |
| 196 | 200 |
| 197 if (rv == net::ERR_IO_PENDING) | 201 if (rv == net::ERR_IO_PENDING) |
| 198 rv = callback.WaitForResult(); | 202 rv = callback.WaitForResult(); |
| 199 | 203 |
| 200 EXPECT_NE(rv, 0); | 204 EXPECT_NE(rv, 0); |
| 201 } | 205 } |
| 202 | 206 |
| OLD | NEW |