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..0c0057216375f5c0100cf2a349703d31226f9efb 100644 |
--- a/net/socket/socket_test_util.h |
+++ b/net/socket/socket_test_util.h |
@@ -335,6 +335,11 @@ struct SSLSocketDataProvider { |
bool channel_id_sent; |
ServerBoundCertService* server_bound_cert_service; |
int connection_status; |
+ // Indicates that the socket should block in the Connect method. |
+ bool block_in_connect_; |
+ // Indicates that the socket previously blocked in the Connect method. |
+ bool blocked_in_connect_; |
wtc
2014/07/18 01:17:14
Nit: these two members look similar. I suggest nam
mshelley
2014/07/18 21:08:31
Done.
|
+ bool is_in_session_cache_; |
wtc
2014/07/18 15:39:17
Since SSLSocketDataProvider is a struct, the three
mshelley
2014/07/18 21:08:31
Done.
|
}; |
// A DataProvider where the client must write a request before the reads (e.g. |
@@ -654,10 +659,12 @@ class MockClientSocketFactory : public ClientSocketFactory { |
const SSLConfig& ssl_config, |
const SSLClientSocketContext& context) OVERRIDE; |
virtual void ClearSSLSessionCache() OVERRIDE; |
+ virtual std::vector<MockSSLClientSocket*> GetSSLClientSockets(); |
wtc
2014/07/18 15:39:17
1. Please declare this method before the "ClientSo
mshelley
2014/07/18 21:08:31
Done.
|
private: |
SocketDataProviderArray<SocketDataProvider> mock_data_; |
SocketDataProviderArray<SSLSocketDataProvider> mock_ssl_data_; |
+ std::vector<MockSSLClientSocket*> ssl_client_sockets_; |
}; |
class MockClientSocket : public SSLClientSocket { |
@@ -683,6 +690,7 @@ class MockClientSocket : public SSLClientSocket { |
virtual int Connect(const CompletionCallback& callback) = 0; |
virtual void Disconnect() OVERRIDE; |
virtual bool IsConnected() const OVERRIDE; |
+ virtual bool IsConnectedSSL() const OVERRIDE; |
wtc
2014/07/18 01:17:14
IMPORTANT: IsConnectedSSL is not a method of the S
wtc
2014/07/18 15:39:17
MockSSLClientSocket has the same problem on line 9
mshelley
2014/07/18 21:08:31
Done.
|
virtual bool IsConnectedAndIdle() const OVERRIDE; |
virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE; |
virtual int GetLocalAddress(IPEndPoint* address) const OVERRIDE; |
@@ -691,6 +699,9 @@ class MockClientSocket : public SSLClientSocket { |
virtual void SetOmniboxSpeculation() OVERRIDE {} |
// SSLClientSocket implementation. |
+ virtual bool InSessionCache() const OVERRIDE; |
+ virtual void SetHandshakeSuccessCallback(const base::Closure& cb) OVERRIDE; |
+ virtual void SetHandshakeFailureCallback(const base::Closure& cb) OVERRIDE; |
virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) |
OVERRIDE; |
virtual int ExportKeyingMaterial(const base::StringPiece& label, |
@@ -703,11 +714,18 @@ class MockClientSocket : public SSLClientSocket { |
std::string* server_protos) OVERRIDE; |
virtual ServerBoundCertService* GetServerBoundCertService() const OVERRIDE; |
+ // Resumes the connection of a socket that was paused for testing. |
wtc
2014/07/18 01:17:14
This should say "Returns a callback that resumes t
mshelley
2014/07/18 21:08:31
Done.
|
+ // |resumption_callback_| should be set before invoking this method. |
+ CompletionCallback GetResumptionCallback(); |
wtc
2014/07/18 15:39:17
This is a getter method, so it should be named and
mshelley
2014/07/18 21:08:31
Done.
|
+ |
protected: |
virtual ~MockClientSocket(); |
void RunCallbackAsync(const CompletionCallback& callback, int result); |
void RunCallback(const CompletionCallback& callback, int result); |
+ // Callback to be used to resume the connection of a paused socket. |
+ CompletionCallback resumption_callback_; |
wtc
2014/07/18 15:39:16
1. Declare this data member after line 731 because
mshelley
2014/07/18 21:08:31
Done.
|
+ |
// SSLClientSocket implementation. |
virtual scoped_refptr<X509Certificate> GetUnverifiedServerCertificateChain() |
const OVERRIDE; |
@@ -943,6 +961,7 @@ class MockSSLClientSocket : public MockClientSocket, public AsyncSocket { |
virtual int Connect(const CompletionCallback& callback) OVERRIDE; |
virtual void Disconnect() OVERRIDE; |
virtual bool IsConnected() const OVERRIDE; |
+ virtual bool IsConnectedSSL() const OVERRIDE; |
virtual bool WasEverUsed() const OVERRIDE; |
virtual bool UsingTCPFastOpen() const OVERRIDE; |
virtual int GetPeerAddress(IPEndPoint* address) const OVERRIDE; |
@@ -950,6 +969,9 @@ class MockSSLClientSocket : public MockClientSocket, public AsyncSocket { |
virtual bool GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; |
// SSLClientSocket implementation. |
+ virtual bool InSessionCache() const OVERRIDE; |
+ virtual void SetHandshakeSuccessCallback(const base::Closure& cb) OVERRIDE; |
+ virtual void SetHandshakeFailureCallback(const base::Closure& cb) OVERRIDE; |
virtual void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) |
OVERRIDE; |
virtual NextProtoStatus GetNextProto(std::string* proto, |
@@ -978,6 +1000,9 @@ class MockSSLClientSocket : public MockClientSocket, public AsyncSocket { |
bool is_protocol_negotiated_set_; |
NextProto protocol_negotiated_; |
+ base::Closure success_callback_; |
+ base::Closure error_callback_; |
+ |
DISALLOW_COPY_AND_ASSIGN(MockSSLClientSocket); |
}; |