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

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

Issue 9959033: Move NextProto enum to a new file net/socket/next_proto.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address wtc's comments Created 8 years, 8 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/socket/next_proto.h ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 262
263 DISALLOW_COPY_AND_ASSIGN(DynamicSocketDataProvider); 263 DISALLOW_COPY_AND_ASSIGN(DynamicSocketDataProvider);
264 }; 264 };
265 265
266 // SSLSocketDataProviders only need to keep track of the return code from calls 266 // SSLSocketDataProviders only need to keep track of the return code from calls
267 // to Connect(). 267 // to Connect().
268 struct SSLSocketDataProvider { 268 struct SSLSocketDataProvider {
269 SSLSocketDataProvider(IoMode mode, int result); 269 SSLSocketDataProvider(IoMode mode, int result);
270 ~SSLSocketDataProvider(); 270 ~SSLSocketDataProvider();
271 271
272 void SetNextProto(SSLClientSocket::NextProto proto); 272 void SetNextProto(NextProto proto);
273 273
274 MockConnect connect; 274 MockConnect connect;
275 SSLClientSocket::NextProtoStatus next_proto_status; 275 SSLClientSocket::NextProtoStatus next_proto_status;
276 std::string next_proto; 276 std::string next_proto;
277 std::string server_protos; 277 std::string server_protos;
278 bool was_npn_negotiated; 278 bool was_npn_negotiated;
279 SSLClientSocket::NextProto protocol_negotiated; 279 NextProto protocol_negotiated;
280 bool client_cert_sent; 280 bool client_cert_sent;
281 SSLCertRequestInfo* cert_request_info; 281 SSLCertRequestInfo* cert_request_info;
282 scoped_refptr<X509Certificate> cert; 282 scoped_refptr<X509Certificate> cert;
283 SSLClientCertType domain_bound_cert_type; 283 SSLClientCertType domain_bound_cert_type;
284 ServerBoundCertService* server_bound_cert_service; 284 ServerBoundCertService* server_bound_cert_service;
285 }; 285 };
286 286
287 // A DataProvider where the client must write a request before the reads (e.g. 287 // A DataProvider where the client must write a request before the reads (e.g.
288 // the response) will complete. 288 // the response) will complete.
289 class DelayedSocketData : public StaticSocketDataProvider { 289 class DelayedSocketData : public StaticSocketDataProvider {
(...skipping 453 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE; 743 virtual base::TimeDelta GetConnectTimeMicros() const OVERRIDE;
744 744
745 // SSLClientSocket implementation. 745 // SSLClientSocket implementation.
746 virtual void GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; 746 virtual void GetSSLInfo(SSLInfo* ssl_info) OVERRIDE;
747 virtual void GetSSLCertRequestInfo( 747 virtual void GetSSLCertRequestInfo(
748 SSLCertRequestInfo* cert_request_info) OVERRIDE; 748 SSLCertRequestInfo* cert_request_info) OVERRIDE;
749 virtual NextProtoStatus GetNextProto(std::string* proto, 749 virtual NextProtoStatus GetNextProto(std::string* proto,
750 std::string* server_protos) OVERRIDE; 750 std::string* server_protos) OVERRIDE;
751 virtual bool was_npn_negotiated() const OVERRIDE; 751 virtual bool was_npn_negotiated() const OVERRIDE;
752 virtual bool set_was_npn_negotiated(bool negotiated) OVERRIDE; 752 virtual bool set_was_npn_negotiated(bool negotiated) OVERRIDE;
753 virtual SSLClientSocket::NextProto protocol_negotiated() const OVERRIDE; 753 virtual NextProto protocol_negotiated() const OVERRIDE;
754 virtual void set_protocol_negotiated( 754 virtual void set_protocol_negotiated(
755 SSLClientSocket::NextProto protocol_negotiated) OVERRIDE; 755 NextProto protocol_negotiated) OVERRIDE;
756 756
757 // This MockSocket does not implement the manual async IO feature. 757 // This MockSocket does not implement the manual async IO feature.
758 virtual void OnReadComplete(const MockRead& data) OVERRIDE; 758 virtual void OnReadComplete(const MockRead& data) OVERRIDE;
759 759
760 virtual bool WasDomainBoundCertSent() const OVERRIDE; 760 virtual bool WasDomainBoundCertSent() const OVERRIDE;
761 virtual SSLClientCertType domain_bound_cert_type() const OVERRIDE; 761 virtual SSLClientCertType domain_bound_cert_type() const OVERRIDE;
762 virtual SSLClientCertType set_domain_bound_cert_type( 762 virtual SSLClientCertType set_domain_bound_cert_type(
763 SSLClientCertType type) OVERRIDE; 763 SSLClientCertType type) OVERRIDE;
764 virtual ServerBoundCertService* GetServerBoundCertService() const OVERRIDE; 764 virtual ServerBoundCertService* GetServerBoundCertService() const OVERRIDE;
765 765
766 private: 766 private:
767 static void ConnectCallback(MockSSLClientSocket *ssl_client_socket, 767 static void ConnectCallback(MockSSLClientSocket *ssl_client_socket,
768 const CompletionCallback& callback, 768 const CompletionCallback& callback,
769 int rv); 769 int rv);
770 770
771 scoped_ptr<ClientSocketHandle> transport_; 771 scoped_ptr<ClientSocketHandle> transport_;
772 SSLSocketDataProvider* data_; 772 SSLSocketDataProvider* data_;
773 bool is_npn_state_set_; 773 bool is_npn_state_set_;
774 bool new_npn_value_; 774 bool new_npn_value_;
775 bool was_used_to_convey_data_; 775 bool was_used_to_convey_data_;
776 bool is_protocol_negotiated_set_; 776 bool is_protocol_negotiated_set_;
777 SSLClientSocket::NextProto protocol_negotiated_; 777 NextProto protocol_negotiated_;
778 }; 778 };
779 779
780 class MockUDPClientSocket : public DatagramClientSocket, 780 class MockUDPClientSocket : public DatagramClientSocket,
781 public AsyncSocket { 781 public AsyncSocket {
782 public: 782 public:
783 MockUDPClientSocket(SocketDataProvider* data, net::NetLog* net_log); 783 MockUDPClientSocket(SocketDataProvider* data, net::NetLog* net_log);
784 virtual ~MockUDPClientSocket(); 784 virtual ~MockUDPClientSocket();
785 785
786 // Socket implementation. 786 // Socket implementation.
787 virtual int Read(IOBuffer* buf, int buf_len, 787 virtual int Read(IOBuffer* buf, int buf_len,
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after
1043 1043
1044 extern const char kSOCKS5OkRequest[]; 1044 extern const char kSOCKS5OkRequest[];
1045 extern const int kSOCKS5OkRequestLength; 1045 extern const int kSOCKS5OkRequestLength;
1046 1046
1047 extern const char kSOCKS5OkResponse[]; 1047 extern const char kSOCKS5OkResponse[];
1048 extern const int kSOCKS5OkResponseLength; 1048 extern const int kSOCKS5OkResponseLength;
1049 1049
1050 } // namespace net 1050 } // namespace net
1051 1051
1052 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ 1052 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_
OLDNEW
« no previous file with comments | « net/socket/next_proto.h ('k') | net/socket/socket_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698