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..3b1ef305c11a3419f0924703c6f55e86147d1a63 100644 |
--- a/net/socket/socket_test_util.h |
+++ b/net/socket/socket_test_util.h |
@@ -335,6 +335,9 @@ struct SSLSocketDataProvider { |
bool channel_id_sent; |
ServerBoundCertService* server_bound_cert_service; |
int connection_status; |
+ |
+ // Denotes that this job may have pending jobs dependant upon its connection. |
+ bool is_leader_; |
}; |
// A DataProvider where the client must write a request before the reads (e.g. |
@@ -634,6 +637,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(); |
+ |
SocketDataProviderArray<SocketDataProvider>& mock_data() { |
return mock_data_; |
} |
@@ -654,10 +663,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 +703,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 +967,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 +987,29 @@ 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. |
+ // |
+ // If |is_leader_| is true, the socket should connect before all other |
+ // sockets. |
+ // If |is_leader_| is false, the socket should not connect until the leading |
+ // socket has connected. |
+ 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); |
}; |