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 "base/test/fuzzed_data_provider.h" | 9 #include "base/test/fuzzed_data_provider.h" |
10 #include "net/base/address_list.h" | 10 #include "net/base/address_list.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 : data_provider_(data_provider) {} | 129 : data_provider_(data_provider) {} |
130 | 130 |
131 FuzzedSocketFactory::~FuzzedSocketFactory() {} | 131 FuzzedSocketFactory::~FuzzedSocketFactory() {} |
132 | 132 |
133 std::unique_ptr<DatagramClientSocket> | 133 std::unique_ptr<DatagramClientSocket> |
134 FuzzedSocketFactory::CreateDatagramClientSocket( | 134 FuzzedSocketFactory::CreateDatagramClientSocket( |
135 DatagramSocket::BindType bind_type, | 135 DatagramSocket::BindType bind_type, |
136 const RandIntCallback& rand_int_cb, | 136 const RandIntCallback& rand_int_cb, |
137 NetLog* net_log, | 137 NetLog* net_log, |
138 const NetLog::Source& source) { | 138 const NetLog::Source& source) { |
139 return base::WrapUnique(new FuzzedDatagramClientSocket(data_provider_)); | 139 return base::MakeUnique<FuzzedDatagramClientSocket>(data_provider_); |
140 } | 140 } |
141 | 141 |
142 std::unique_ptr<StreamSocket> FuzzedSocketFactory::CreateTransportClientSocket( | 142 std::unique_ptr<StreamSocket> FuzzedSocketFactory::CreateTransportClientSocket( |
143 const AddressList& addresses, | 143 const AddressList& addresses, |
144 std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher, | 144 std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher, |
145 NetLog* net_log, | 145 NetLog* net_log, |
146 const NetLog::Source& source) { | 146 const NetLog::Source& source) { |
147 std::unique_ptr<FuzzedSocket> socket( | 147 std::unique_ptr<FuzzedSocket> socket( |
148 new FuzzedSocket(data_provider_, net_log)); | 148 new FuzzedSocket(data_provider_, net_log)); |
149 socket->set_fuzz_connect_result(true); | 149 socket->set_fuzz_connect_result(true); |
150 // Just use the first address. | 150 // Just use the first address. |
151 socket->set_remote_address(*addresses.begin()); | 151 socket->set_remote_address(*addresses.begin()); |
152 return std::move(socket); | 152 return std::move(socket); |
153 } | 153 } |
154 | 154 |
155 std::unique_ptr<SSLClientSocket> FuzzedSocketFactory::CreateSSLClientSocket( | 155 std::unique_ptr<SSLClientSocket> FuzzedSocketFactory::CreateSSLClientSocket( |
156 std::unique_ptr<ClientSocketHandle> transport_socket, | 156 std::unique_ptr<ClientSocketHandle> transport_socket, |
157 const HostPortPair& host_and_port, | 157 const HostPortPair& host_and_port, |
158 const SSLConfig& ssl_config, | 158 const SSLConfig& ssl_config, |
159 const SSLClientSocketContext& context) { | 159 const SSLClientSocketContext& context) { |
160 return base::WrapUnique(new FailingSSLClientSocket()); | 160 return base::MakeUnique<FailingSSLClientSocket>(); |
161 } | 161 } |
162 | 162 |
163 void FuzzedSocketFactory::ClearSSLSessionCache() {} | 163 void FuzzedSocketFactory::ClearSSLSessionCache() {} |
164 | 164 |
165 } // namespace net | 165 } // namespace net |
OLD | NEW |