| 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 "jingle/glue/chrome_async_socket.h" | 5 #include "jingle/glue/chrome_async_socket.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <deque> | 9 #include <deque> |
| 10 #include <memory> | 10 #include <memory> |
| 11 #include <string> | 11 #include <string> |
| 12 #include <utility> | 12 #include <utility> |
| 13 | 13 |
| 14 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
| 17 #include "base/message_loop/message_pump_default.h" | 17 #include "base/message_loop/message_pump_default.h" |
| 18 #include "base/run_loop.h" | 18 #include "base/run_loop.h" |
| 19 #include "jingle/glue/resolving_client_socket_factory.h" | 19 #include "jingle/glue/resolving_client_socket_factory.h" |
| 20 #include "net/base/address_list.h" | 20 #include "net/base/address_list.h" |
| 21 #include "net/base/ip_address.h" | 21 #include "net/base/ip_address.h" |
| 22 #include "net/base/net_errors.h" | 22 #include "net/base/net_errors.h" |
| 23 #include "net/cert/mock_cert_verifier.h" | 23 #include "net/cert/mock_cert_verifier.h" |
| 24 #include "net/http/transport_security_state.h" | 24 #include "net/http/transport_security_state.h" |
| 25 #include "net/log/net_log_source.h" |
| 25 #include "net/socket/socket_test_util.h" | 26 #include "net/socket/socket_test_util.h" |
| 26 #include "net/socket/ssl_client_socket.h" | 27 #include "net/socket/ssl_client_socket.h" |
| 27 #include "net/ssl/ssl_config_service.h" | 28 #include "net/ssl/ssl_config_service.h" |
| 28 #include "net/url_request/url_request_context_getter.h" | 29 #include "net/url_request/url_request_context_getter.h" |
| 29 #include "testing/gtest/include/gtest/gtest.h" | 30 #include "testing/gtest/include/gtest/gtest.h" |
| 30 #include "third_party/webrtc/base/ipaddress.h" | 31 #include "third_party/webrtc/base/ipaddress.h" |
| 31 #include "third_party/webrtc/base/sigslot.h" | 32 #include "third_party/webrtc/base/sigslot.h" |
| 32 #include "third_party/webrtc/base/socketaddress.h" | 33 #include "third_party/webrtc/base/socketaddress.h" |
| 33 | 34 |
| 34 namespace jingle_glue { | 35 namespace jingle_glue { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 : mock_client_socket_factory_(mock_client_socket_factory), | 123 : mock_client_socket_factory_(mock_client_socket_factory), |
| 123 address_list_(address_list), | 124 address_list_(address_list), |
| 124 cert_verifier_(new net::MockCertVerifier), | 125 cert_verifier_(new net::MockCertVerifier), |
| 125 transport_security_state_(new net::TransportSecurityState) { | 126 transport_security_state_(new net::TransportSecurityState) { |
| 126 } | 127 } |
| 127 | 128 |
| 128 // ResolvingClientSocketFactory implementation. | 129 // ResolvingClientSocketFactory implementation. |
| 129 std::unique_ptr<net::StreamSocket> CreateTransportClientSocket( | 130 std::unique_ptr<net::StreamSocket> CreateTransportClientSocket( |
| 130 const net::HostPortPair& host_and_port) override { | 131 const net::HostPortPair& host_and_port) override { |
| 131 return mock_client_socket_factory_->CreateTransportClientSocket( | 132 return mock_client_socket_factory_->CreateTransportClientSocket( |
| 132 address_list_, NULL, NULL, net::NetLog::Source()); | 133 address_list_, NULL, NULL, net::NetLogSource()); |
| 133 } | 134 } |
| 134 | 135 |
| 135 std::unique_ptr<net::SSLClientSocket> CreateSSLClientSocket( | 136 std::unique_ptr<net::SSLClientSocket> CreateSSLClientSocket( |
| 136 std::unique_ptr<net::ClientSocketHandle> transport_socket, | 137 std::unique_ptr<net::ClientSocketHandle> transport_socket, |
| 137 const net::HostPortPair& host_and_port) override { | 138 const net::HostPortPair& host_and_port) override { |
| 138 net::SSLClientSocketContext context; | 139 net::SSLClientSocketContext context; |
| 139 context.cert_verifier = cert_verifier_.get(); | 140 context.cert_verifier = cert_verifier_.get(); |
| 140 context.transport_security_state = transport_security_state_.get(); | 141 context.transport_security_state = transport_security_state_.get(); |
| 141 return mock_client_socket_factory_->CreateSSLClientSocket( | 142 return mock_client_socket_factory_->CreateSSLClientSocket( |
| 142 std::move(transport_socket), host_and_port, ssl_config_, context); | 143 std::move(transport_socket), host_and_port, ssl_config_, context); |
| (...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1092 base::RunLoop().RunUntilIdle(); | 1093 base::RunLoop().RunUntilIdle(); |
| 1093 | 1094 |
| 1094 ExpectNoSignal(); | 1095 ExpectNoSignal(); |
| 1095 | 1096 |
| 1096 DoSSLCloseOpenedNoError(); | 1097 DoSSLCloseOpenedNoError(); |
| 1097 } | 1098 } |
| 1098 | 1099 |
| 1099 } // namespace | 1100 } // namespace |
| 1100 | 1101 |
| 1101 } // namespace jingle_glue | 1102 } // namespace jingle_glue |
| OLD | NEW |