OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/fuzzed_socket_factory.h" | 5 #include "net/socket/fuzzed_socket_factory.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "net/base/address_list.h" | 9 #include "net/base/address_list.h" |
10 #include "net/base/ip_endpoint.h" | 10 #include "net/base/ip_endpoint.h" |
11 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
12 #include "net/base/network_change_notifier.h" | 12 #include "net/base/network_change_notifier.h" |
13 #include "net/log/net_log.h" | 13 #include "net/log/net_log.h" |
14 #include "net/socket/client_socket_handle.h" | 14 #include "net/socket/client_socket_handle.h" |
15 #include "net/socket/connection_attempts.h" | 15 #include "net/socket/connection_attempts.h" |
16 #include "net/socket/fuzzed_socket.h" | 16 #include "net/socket/fuzzed_socket.h" |
17 #include "net/socket/ssl_client_socket.h" | 17 #include "net/socket/ssl_client_socket.h" |
18 #include "net/ssl/ssl_failure_state.h" | |
19 #include "net/udp/fuzzed_datagram_client_socket.h" | 18 #include "net/udp/fuzzed_datagram_client_socket.h" |
20 | 19 |
21 namespace net { | 20 namespace net { |
22 | 21 |
23 namespace { | 22 namespace { |
24 | 23 |
25 // SSLClientSocket implementation that always fails to connect. | 24 // SSLClientSocket implementation that always fails to connect. |
26 class FailingSSLClientSocket : public SSLClientSocket { | 25 class FailingSSLClientSocket : public SSLClientSocket { |
27 public: | 26 public: |
28 FailingSSLClientSocket() {} | 27 FailingSSLClientSocket() {} |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 std::vector<uint8_t>* out) override { | 112 std::vector<uint8_t>* out) override { |
114 NOTREACHED(); | 113 NOTREACHED(); |
115 return ERR_UNEXPECTED; | 114 return ERR_UNEXPECTED; |
116 } | 115 } |
117 | 116 |
118 crypto::ECPrivateKey* GetChannelIDKey() const override { | 117 crypto::ECPrivateKey* GetChannelIDKey() const override { |
119 NOTREACHED(); | 118 NOTREACHED(); |
120 return nullptr; | 119 return nullptr; |
121 } | 120 } |
122 | 121 |
123 SSLFailureState GetSSLFailureState() const override { | |
124 return SSL_FAILURE_UNKNOWN; | |
125 } | |
126 | |
127 private: | 122 private: |
128 BoundNetLog net_log_; | 123 BoundNetLog net_log_; |
129 | 124 |
130 DISALLOW_COPY_AND_ASSIGN(FailingSSLClientSocket); | 125 DISALLOW_COPY_AND_ASSIGN(FailingSSLClientSocket); |
131 }; | 126 }; |
132 | 127 |
133 } // namespace | 128 } // namespace |
134 | 129 |
135 FuzzedSocketFactory::FuzzedSocketFactory(FuzzedDataProvider* data_provider) | 130 FuzzedSocketFactory::FuzzedSocketFactory(FuzzedDataProvider* data_provider) |
136 : data_provider_(data_provider) {} | 131 : data_provider_(data_provider) {} |
(...skipping 26 matching lines...) Expand all Loading... |
163 std::unique_ptr<ClientSocketHandle> transport_socket, | 158 std::unique_ptr<ClientSocketHandle> transport_socket, |
164 const HostPortPair& host_and_port, | 159 const HostPortPair& host_and_port, |
165 const SSLConfig& ssl_config, | 160 const SSLConfig& ssl_config, |
166 const SSLClientSocketContext& context) { | 161 const SSLClientSocketContext& context) { |
167 return base::WrapUnique(new FailingSSLClientSocket()); | 162 return base::WrapUnique(new FailingSSLClientSocket()); |
168 } | 163 } |
169 | 164 |
170 void FuzzedSocketFactory::ClearSSLSessionCache() {} | 165 void FuzzedSocketFactory::ClearSSLSessionCache() {} |
171 | 166 |
172 } // namespace net | 167 } // namespace net |
OLD | NEW |