OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_log.h" | 10 #include "net/base/net_log.h" |
11 #include "net/base/net_log_unittest.h" | 11 #include "net/base/net_log_unittest.h" |
12 #include "net/base/net_errors.h" | 12 #include "net/base/net_errors.h" |
13 #include "net/base/ssl_config_service.h" | 13 #include "net/base/ssl_config_service.h" |
14 #include "net/base/test_completion_callback.h" | 14 #include "net/base/test_completion_callback.h" |
15 #include "net/socket/client_socket_factory.h" | 15 #include "net/socket/client_socket_factory.h" |
16 #include "net/socket/socket_test_util.h" | 16 #include "net/socket/socket_test_util.h" |
17 #include "net/socket/ssl_test_util.h" | 17 #include "net/socket/ssl_test_util.h" |
18 #include "net/socket/tcp_client_socket.h" | 18 #include "net/socket/tcp_client_socket.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
20 #include "testing/platform_test.h" | 20 #include "testing/platform_test.h" |
21 | 21 |
22 //----------------------------------------------------------------------------- | 22 //----------------------------------------------------------------------------- |
23 | 23 |
24 const net::SSLConfig kDefaultSSLConfig; | 24 const net::SSLConfig kDefaultSSLConfig; |
25 | 25 |
26 class SSLClientSocketTest : public PlatformTest { | 26 class SSLClientSocketTest : public PlatformTest { |
27 public: | 27 public: |
28 SSLClientSocketTest() | 28 SSLClientSocketTest() |
29 : resolver_(net::CreateSystemHostResolver()), | 29 : resolver_(net::CreateSystemHostResolver( |
| 30 net::HostResolver::kDefaultParallelism)), |
30 socket_factory_(net::ClientSocketFactory::GetDefaultFactory()) { | 31 socket_factory_(net::ClientSocketFactory::GetDefaultFactory()) { |
31 } | 32 } |
32 | 33 |
33 void StartOKServer() { | 34 void StartOKServer() { |
34 bool success = server_.Start(net::TestServerLauncher::ProtoHTTP, | 35 bool success = server_.Start(net::TestServerLauncher::ProtoHTTP, |
35 server_.kHostName, server_.kOKHTTPSPort, | 36 server_.kHostName, server_.kOKHTTPSPort, |
36 FilePath(), server_.GetOKCertPath(), std::wstring()); | 37 FilePath(), server_.GetOKCertPath(), std::wstring()); |
37 ASSERT_TRUE(success); | 38 ASSERT_TRUE(success); |
38 } | 39 } |
39 | 40 |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
462 rv = callback.WaitForResult(); | 463 rv = callback.WaitForResult(); |
463 EXPECT_EQ(net::OK, rv); | 464 EXPECT_EQ(net::OK, rv); |
464 | 465 |
465 scoped_ptr<net::SSLClientSocket> sock( | 466 scoped_ptr<net::SSLClientSocket> sock( |
466 socket_factory_->CreateSSLClientSocket( | 467 socket_factory_->CreateSSLClientSocket( |
467 transport, server_.kHostName, kDefaultSSLConfig)); | 468 transport, server_.kHostName, kDefaultSSLConfig)); |
468 | 469 |
469 rv = sock->Connect(&callback); | 470 rv = sock->Connect(&callback); |
470 EXPECT_EQ(net::ERR_SSL_PROTOCOL_ERROR, rv); | 471 EXPECT_EQ(net::ERR_SSL_PROTOCOL_ERROR, rv); |
471 } | 472 } |
OLD | NEW |