OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/callback_helpers.h" | 7 #include "base/callback_helpers.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
11 #include "net/base/address_list.h" | 11 #include "net/base/address_list.h" |
12 #include "net/base/io_buffer.h" | 12 #include "net/base/io_buffer.h" |
13 #include "net/base/net_errors.h" | 13 #include "net/base/net_errors.h" |
14 #include "net/base/net_log.h" | 14 #include "net/base/net_log.h" |
15 #include "net/base/net_log_unittest.h" | 15 #include "net/base/net_log_unittest.h" |
16 #include "net/base/test_completion_callback.h" | 16 #include "net/base/test_completion_callback.h" |
17 #include "net/base/test_data_directory.h" | 17 #include "net/base/test_data_directory.h" |
18 #include "net/cert/asn1_util.h" | 18 #include "net/cert/asn1_util.h" |
19 #include "net/cert/ct_verifier.h" | 19 #include "net/cert/ct_verifier.h" |
| 20 #include "net/cert/ct_verify_result.h" |
20 #include "net/cert/mock_cert_verifier.h" | 21 #include "net/cert/mock_cert_verifier.h" |
21 #include "net/cert/test_root_certs.h" | 22 #include "net/cert/test_root_certs.h" |
22 #include "net/dns/host_resolver.h" | 23 #include "net/dns/host_resolver.h" |
23 #include "net/http/transport_security_state.h" | 24 #include "net/http/transport_security_state.h" |
24 #include "net/socket/client_socket_factory.h" | 25 #include "net/socket/client_socket_factory.h" |
25 #include "net/socket/client_socket_handle.h" | 26 #include "net/socket/client_socket_handle.h" |
26 #include "net/socket/socket_test_util.h" | 27 #include "net/socket/socket_test_util.h" |
27 #include "net/socket/tcp_client_socket.h" | 28 #include "net/socket/tcp_client_socket.h" |
28 #include "net/ssl/channel_id_service.h" | 29 #include "net/ssl/channel_id_service.h" |
29 #include "net/ssl/default_channel_id_store.h" | 30 #include "net/ssl/default_channel_id_store.h" |
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 | 654 |
654 // A mock CTVerifier that records every call to Verify but doesn't verify | 655 // A mock CTVerifier that records every call to Verify but doesn't verify |
655 // anything. | 656 // anything. |
656 class MockCTVerifier : public CTVerifier { | 657 class MockCTVerifier : public CTVerifier { |
657 public: | 658 public: |
658 MOCK_METHOD5(Verify, int(X509Certificate*, | 659 MOCK_METHOD5(Verify, int(X509Certificate*, |
659 const std::string&, | 660 const std::string&, |
660 const std::string&, | 661 const std::string&, |
661 ct::CTVerifyResult*, | 662 ct::CTVerifyResult*, |
662 const BoundNetLog&)); | 663 const BoundNetLog&)); |
| 664 |
| 665 uint32_t GetNumKnownLogs() override { return 3; } |
663 }; | 666 }; |
664 | 667 |
665 class SSLClientSocketTest : public PlatformTest { | 668 class SSLClientSocketTest : public PlatformTest { |
666 public: | 669 public: |
667 SSLClientSocketTest() | 670 SSLClientSocketTest() |
668 : socket_factory_(ClientSocketFactory::GetDefaultFactory()), | 671 : socket_factory_(ClientSocketFactory::GetDefaultFactory()), |
669 cert_verifier_(new MockCertVerifier), | 672 cert_verifier_(new MockCertVerifier), |
670 transport_security_state_(new TransportSecurityState), | 673 transport_security_state_(new TransportSecurityState), |
671 ran_handshake_completion_callback_(false) { | 674 ran_handshake_completion_callback_(false) { |
672 cert_verifier_->set_default_result(OK); | 675 cert_verifier_->set_default_result(OK); |
(...skipping 2352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3025 ssl_config.channel_id_enabled = true; | 3028 ssl_config.channel_id_enabled = true; |
3026 | 3029 |
3027 int rv; | 3030 int rv; |
3028 ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv)); | 3031 ASSERT_TRUE(CreateAndConnectSSLClientSocket(ssl_config, &rv)); |
3029 | 3032 |
3030 EXPECT_EQ(ERR_UNEXPECTED, rv); | 3033 EXPECT_EQ(ERR_UNEXPECTED, rv); |
3031 EXPECT_FALSE(sock_->IsConnected()); | 3034 EXPECT_FALSE(sock_->IsConnected()); |
3032 } | 3035 } |
3033 | 3036 |
3034 } // namespace net | 3037 } // namespace net |
OLD | NEW |