Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: net/socket/fuzzed_socket_factory.cc

Issue 2259823002: Re-write many calls to WrapUnique() with MakeUnique() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/server/web_socket_encoder.cc ('k') | net/spdy/bidirectional_stream_spdy_impl_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « net/server/web_socket_encoder.cc ('k') | net/spdy/bidirectional_stream_spdy_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698