Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Side by Side Diff: net/socket/socket_test_util.h

Issue 3110006: Add support for speaking SSL to an HTTP Proxy, to HttpProxyClientSocketPool (and friends) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/http/http_stream_request.cc ('k') | net/socket/socket_test_util.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_SOCKET_SOCKET_TEST_UTIL_H_ 5 #ifndef NET_SOCKET_SOCKET_TEST_UTIL_H_
6 #define NET_SOCKET_SOCKET_TEST_UTIL_H_ 6 #define NET_SOCKET_SOCKET_TEST_UTIL_H_
7 #pragma once 7 #pragma once
8 8
9 #include <cstring> 9 #include <cstring>
10 #include <deque> 10 #include <deque>
(...skipping 12 matching lines...) Expand all
23 #include "net/base/net_errors.h" 23 #include "net/base/net_errors.h"
24 #include "net/base/net_log.h" 24 #include "net/base/net_log.h"
25 #include "net/base/ssl_config_service.h" 25 #include "net/base/ssl_config_service.h"
26 #include "net/base/test_completion_callback.h" 26 #include "net/base/test_completion_callback.h"
27 #include "net/http/http_auth_controller.h" 27 #include "net/http/http_auth_controller.h"
28 #include "net/http/http_proxy_client_socket_pool.h" 28 #include "net/http/http_proxy_client_socket_pool.h"
29 #include "net/socket/client_socket_factory.h" 29 #include "net/socket/client_socket_factory.h"
30 #include "net/socket/client_socket_handle.h" 30 #include "net/socket/client_socket_handle.h"
31 #include "net/socket/socks_client_socket_pool.h" 31 #include "net/socket/socks_client_socket_pool.h"
32 #include "net/socket/ssl_client_socket.h" 32 #include "net/socket/ssl_client_socket.h"
33 #include "net/socket/ssl_client_socket_pool.h"
33 #include "net/socket/tcp_client_socket_pool.h" 34 #include "net/socket/tcp_client_socket_pool.h"
34 #include "testing/gtest/include/gtest/gtest.h" 35 #include "testing/gtest/include/gtest/gtest.h"
35 36
36 namespace net { 37 namespace net {
37 38
38 enum { 39 enum {
39 // A private network error code used by the socket test utility classes. 40 // A private network error code used by the socket test utility classes.
40 // If the |result| member of a MockRead is 41 // If the |result| member of a MockRead is
41 // ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ, that MockRead is just a 42 // ERR_TEST_PEER_CLOSE_AFTER_NEXT_MOCK_READ, that MockRead is just a
42 // marker that indicates the peer will close the connection after the next 43 // marker that indicates the peer will close the connection after the next
(...skipping 817 matching lines...) Expand 10 before | Expand all | Expand 10 after
860 861
861 extern const char kSOCKS5GreetResponse[]; 862 extern const char kSOCKS5GreetResponse[];
862 extern const int kSOCKS5GreetResponseLength; 863 extern const int kSOCKS5GreetResponseLength;
863 864
864 extern const char kSOCKS5OkRequest[]; 865 extern const char kSOCKS5OkRequest[];
865 extern const int kSOCKS5OkRequestLength; 866 extern const int kSOCKS5OkRequestLength;
866 867
867 extern const char kSOCKS5OkResponse[]; 868 extern const char kSOCKS5OkResponse[];
868 extern const int kSOCKS5OkResponseLength; 869 extern const int kSOCKS5OkResponseLength;
869 870
871 class MockSSLClientSocketPool : public SSLClientSocketPool {
872 public:
873 class MockConnectJob {
874 public:
875 MockConnectJob(ClientSocket* socket, ClientSocketHandle* handle,
876 CompletionCallback* callback);
877
878 int Connect();
879 bool CancelHandle(const ClientSocketHandle* handle);
880
881 private:
882 void OnConnect(int rv);
883
884 scoped_ptr<ClientSocket> socket_;
885 ClientSocketHandle* handle_;
886 CompletionCallback* user_callback_;
887 CompletionCallbackImpl<MockConnectJob> connect_callback_;
888
889 DISALLOW_COPY_AND_ASSIGN(MockConnectJob);
890 };
891
892 MockSSLClientSocketPool(
893 int max_sockets,
894 int max_sockets_per_group,
895 const scoped_refptr<ClientSocketPoolHistograms>& histograms,
896 ClientSocketFactory* socket_factory);
897
898 int release_count() const { return release_count_; }
899 int cancel_count() const { return cancel_count_; }
900
901 // SSLClientSocketPool methods.
902 virtual int RequestSocket(const std::string& group_name,
903 const void* socket_params,
904 RequestPriority priority,
905 ClientSocketHandle* handle,
906 CompletionCallback* callback,
907 const BoundNetLog& net_log);
908
909 virtual void CancelRequest(const std::string& group_name,
910 ClientSocketHandle* handle);
911 virtual void ReleaseSocket(const std::string& group_name,
912 ClientSocket* socket, int id);
913
914 protected:
915 virtual ~MockSSLClientSocketPool();
916
917 private:
918 ClientSocketFactory* client_socket_factory_;
919 int release_count_;
920 int cancel_count_;
921 ScopedVector<MockConnectJob> job_list_;
922
923 DISALLOW_COPY_AND_ASSIGN(MockSSLClientSocketPool);
924 };
925
926
870 } // namespace net 927 } // namespace net
871 928
872 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ 929 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_
OLDNEW
« no previous file with comments | « net/http/http_stream_request.cc ('k') | net/socket/socket_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698