Chromium Code Reviews| Index: net/socket/socket_test_util.h |
| diff --git a/net/socket/socket_test_util.h b/net/socket/socket_test_util.h |
| index 2918aad2dc55ec4f3b8ff5a63c0e8b584aa1af5c..aa5ef1c762a88c32504b4aa503583b79d03a5dfd 100644 |
| --- a/net/socket/socket_test_util.h |
| +++ b/net/socket/socket_test_util.h |
| @@ -335,6 +335,10 @@ struct SSLSocketDataProvider { |
| bool channel_id_sent; |
| ServerBoundCertService* server_bound_cert_service; |
| int connection_status; |
| + bool is_in_session_cache_; |
|
Ryan Sleevi
2014/07/10 19:51:05
Probably needs a comment here as well, since conne
mshelley
2014/07/10 22:07:14
I just realized that this shouldn't even be here -
|
| + |
| + // Denotes that this job may have pending jobs dependant upon its connection. |
| + bool is_leader_; |
|
Ryan Sleevi
2014/07/10 19:51:05
So, I'm a little confused by this - is this bookke
mshelley
2014/07/10 22:07:15
This is something that the test sets to affect the
Ryan Sleevi
2014/07/12 00:12:15
What I meant is that your tests that use this also
|
| }; |
| // A DataProvider where the client must write a request before the reads (e.g. |
| @@ -634,6 +638,12 @@ class MockClientSocketFactory : public ClientSocketFactory { |
| void AddSSLSocketDataProvider(SSLSocketDataProvider* socket); |
| void ResetNextMockIndexes(); |
| + // Tells the client socket factory that the leading job has connected. |
| + static void SetLeaderConnected(); |
| + |
| + // Returns |leader_connected_|. |
| + static bool IsLeaderConnected(); |
|
Ryan Sleevi
2014/07/10 19:51:05
Static variables are very bad, especially in tests
mshelley
2014/07/10 22:07:15
Yeah I used the static variable because I wanted t
Ryan Sleevi
2014/07/12 00:12:15
The SocketDataProvider has a path to the ClientSoc
|
| + |
| SocketDataProviderArray<SocketDataProvider>& mock_data() { |
| return mock_data_; |
| } |
| @@ -654,10 +664,13 @@ class MockClientSocketFactory : public ClientSocketFactory { |
| const SSLConfig& ssl_config, |
| const SSLClientSocketContext& context) OVERRIDE; |
| virtual void ClearSSLSessionCache() OVERRIDE; |
| + virtual std::vector<MockSSLClientSocket*> GetSSLClientSockets(); |
| private: |
| SocketDataProviderArray<SocketDataProvider> mock_data_; |
| SocketDataProviderArray<SSLSocketDataProvider> mock_ssl_data_; |
| + static bool leader_connected_; |
| + std::vector<MockSSLClientSocket*> ssl_client_sockets_; |
| }; |
| class MockClientSocket : public SSLClientSocket { |
| @@ -691,6 +704,11 @@ class MockClientSocket : public SSLClientSocket { |
| virtual void SetOmniboxSpeculation() OVERRIDE {} |
| // SSLClientSocket implementation. |
| + virtual bool InSessionCache() const OVERRIDE; |
| + virtual void WatchSessionForCompletion(const base::Closure& cb) OVERRIDE; |
| + virtual void SetSocketFailureCallback(const base::Closure& cb) OVERRIDE; |
| + virtual void OnSocketFailure() OVERRIDE; |
| + virtual void SetIsLeader() OVERRIDE; |
| virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) |
| OVERRIDE; |
| virtual int ExportKeyingMaterial(const base::StringPiece& label, |
| @@ -950,6 +968,10 @@ class MockSSLClientSocket : public MockClientSocket, public AsyncSocket { |
| virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; |
| // SSLClientSocket implementation. |
| + virtual bool InSessionCache() const OVERRIDE; |
| + virtual void WatchSessionForCompletion(const base::Closure& cb) OVERRIDE; |
| + virtual void SetSocketFailureCallback(const base::Closure& cb) OVERRIDE; |
| + virtual void OnSocketFailure() OVERRIDE; |
| virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) |
| OVERRIDE; |
| virtual NextProtoStatus GetNextProto(std::string* proto, |
| @@ -966,17 +988,24 @@ class MockSSLClientSocket : public MockClientSocket, public AsyncSocket { |
| virtual void set_channel_id_sent(bool channel_id_sent) OVERRIDE; |
| virtual ServerBoundCertService* GetServerBoundCertService() const OVERRIDE; |
| + // Returns a bool indicating whether or not the socket connected at |
| + // the correct time relative to other sockets with the same host/port pair. |
|
Ryan Sleevi
2014/07/10 19:51:05
Just from reading this, "the correct time" is uncl
mshelley
2014/07/10 22:07:15
Done.
|
| + bool IsGoodOrdering() const; |
| + |
| private: |
| static void ConnectCallback(MockSSLClientSocket* ssl_client_socket, |
| const CompletionCallback& callback, |
| int rv); |
| + base::Closure process_pending_jobs_callback_; |
| + |
| scoped_ptr<ClientSocketHandle> transport_; |
| SSLSocketDataProvider* data_; |
| bool is_npn_state_set_; |
| bool new_npn_value_; |
| bool is_protocol_negotiated_set_; |
| NextProto protocol_negotiated_; |
| + bool good_ordering_; |
| DISALLOW_COPY_AND_ASSIGN(MockSSLClientSocket); |
| }; |