Chromium Code Reviews| Index: net/socket/fuzzed_socket_factory.h |
| diff --git a/net/socket/fuzzed_socket_factory.h b/net/socket/fuzzed_socket_factory.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..7809cf24f72fccff87cd460c8e212ea76105d609 |
| --- /dev/null |
| +++ b/net/socket/fuzzed_socket_factory.h |
| @@ -0,0 +1,58 @@ |
| +// Copyright 2016 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef NET_SOCKET_FUZZED_SOCKET_FACTORY_H |
| +#define NET_SOCKET_FUZZED_SOCKET_FACTORY_H |
| + |
| +#include <memory> |
| + |
| +#include "base/macros.h" |
| +#include "net/socket/client_socket_factory.h" |
| + |
| +namespace net { |
| + |
| +class FuzzedDataProvider; |
| + |
| +// A socket factory that creates FuzzedSockets that share the same |
| +// FuzzedDataProvider. To behave consistently, the read operations on all |
| +// 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.
|
| +// between sockets). |
| +// |
| +// Currently doesn't support UDP or SSL sockets - just returns sockets that |
| +// synchronously fail to connect when trying to create either type of socket. |
| +// 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.
|
| +class FuzzedSocketFactory : public ClientSocketFactory { |
| + public: |
| + 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.
|
| + ~FuzzedSocketFactory() override; |
| + |
| + std::unique_ptr<DatagramClientSocket> CreateDatagramClientSocket( |
| + DatagramSocket::BindType bind_type, |
| + const RandIntCallback& rand_int_cb, |
| + NetLog* net_log, |
| + const NetLog::Source& source) override; |
| + |
| + std::unique_ptr<StreamSocket> CreateTransportClientSocket( |
| + const AddressList& addresses, |
| + std::unique_ptr<SocketPerformanceWatcher> socket_performance_watcher, |
| + NetLog* net_log, |
| + const NetLog::Source& source) override; |
| + |
| + std::unique_ptr<SSLClientSocket> CreateSSLClientSocket( |
| + std::unique_ptr<ClientSocketHandle> transport_socket, |
| + const HostPortPair& host_and_port, |
| + const SSLConfig& ssl_config, |
| + const SSLClientSocketContext& context) override; |
| + |
| + void ClearSSLSessionCache() override; |
| + |
| + private: |
| + FuzzedDataProvider* data_provider_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(FuzzedSocketFactory); |
| +}; |
| + |
| +} // namespace net |
| + |
| +#endif // NET_SOCKET_FUZZED_SOCKET_FACTORY_H |