Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef NET_SOCKET_FUZZED_SOCKET_FACTORY_H | |
| 6 #define NET_SOCKET_FUZZED_SOCKET_FACTORY_H | |
| 7 | |
| 8 #include <memory> | |
| 9 | |
| 10 #include "base/macros.h" | |
| 11 #include "net/socket/client_socket_factory.h" | |
| 12 | |
| 13 namespace net { | |
| 14 | |
| 15 class FuzzedDataProvider; | |
| 16 | |
| 17 // A socket factory that creates FuzzedSockets that share the same | |
| 18 // FuzzedDataProvider. To behave consistently, the read operations on all | |
| 19 // sockets much bet the same, and in the same order (both on each socket, and | |
|
eroman
2016/04/22 22:07:11
much bet, aye?
:)
mmenke
2016/04/27 19:53:25
Yes, yes. Much bet, very much bet.
| |
| 20 // between sockets). | |
| 21 // | |
| 22 // Currently doesn't support UDP or SSL sockets - just returns sockets that | |
| 23 // synchronously fail to connect when trying to create either type of socket. | |
| 24 // TODO(mmenke): Add support for both types of socket. | |
|
eroman
2016/04/22 22:07:11
Also TODO: add fuzzing for generation of valid cry
mmenke
2016/04/27 19:53:25
Done.
| |
| 25 class FuzzedSocketFactory : public ClientSocketFactory { | |
| 26 public: | |
| 27 explicit FuzzedSocketFactory(FuzzedDataProvider* data_provider); | |
|
eroman
2016/04/22 22:07:11
mention ownership.
I assume non-owned when we don
mmenke
2016/04/27 19:53:25
Done.
| |
| 28 ~FuzzedSocketFactory() override; | |
| 29 | |
| 30 std::unique_ptr<DatagramClientSocket> CreateDatagramClientSocket( | |
| 31 DatagramSocket::BindType bind_type, | |
| 32 const RandIntCallback& rand_int_cb, | |
| 33 NetLog* net_log, | |
| 34 const NetLog::Source& source) override; | |
| 35 | |
| 36 std::unique_ptr<StreamSocket> CreateTransportClientSocket( | |
| 37 const AddressList& addresses, | |
| 38 std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher, | |
| 39 NetLog* net_log, | |
| 40 const NetLog::Source& source) override; | |
| 41 | |
| 42 std::unique_ptr<SSLClientSocket> CreateSSLClientSocket( | |
| 43 std::unique_ptr<ClientSocketHandle> transport_socket, | |
| 44 const HostPortPair& host_and_port, | |
| 45 const SSLConfig& ssl_config, | |
| 46 const SSLClientSocketContext& context) override; | |
| 47 | |
| 48 void ClearSSLSessionCache() override; | |
| 49 | |
| 50 private: | |
| 51 FuzzedDataProvider* data_provider_; | |
| 52 | |
| 53 DISALLOW_COPY_AND_ASSIGN(FuzzedSocketFactory); | |
| 54 }; | |
| 55 | |
| 56 } // namespace net | |
| 57 | |
| 58 #endif // NET_SOCKET_FUZZED_SOCKET_FACTORY_H | |
| OLD | NEW |