OLD | NEW |
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 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
354 MockConnect connect; | 354 MockConnect connect; |
355 SSLClientSocket::NextProtoStatus next_proto_status; | 355 SSLClientSocket::NextProtoStatus next_proto_status; |
356 std::string next_proto; | 356 std::string next_proto; |
357 NextProtoVector next_protos_expected_in_ssl_config; | 357 NextProtoVector next_protos_expected_in_ssl_config; |
358 bool client_cert_sent; | 358 bool client_cert_sent; |
359 SSLCertRequestInfo* cert_request_info; | 359 SSLCertRequestInfo* cert_request_info; |
360 scoped_refptr<X509Certificate> cert; | 360 scoped_refptr<X509Certificate> cert; |
361 bool channel_id_sent; | 361 bool channel_id_sent; |
362 ChannelIDService* channel_id_service; | 362 ChannelIDService* channel_id_service; |
363 int connection_status; | 363 int connection_status; |
| 364 bool token_binding_negotiated; |
| 365 TokenBindingParam token_binding_key_param; |
364 }; | 366 }; |
365 | 367 |
366 // Uses the sequence_number field in the mock reads and writes to | 368 // Uses the sequence_number field in the mock reads and writes to |
367 // complete the operations in a specified order. | 369 // complete the operations in a specified order. |
368 class SequencedSocketData : public SocketDataProvider { | 370 class SequencedSocketData : public SocketDataProvider { |
369 public: | 371 public: |
370 // |reads| is the list of MockRead completions. | 372 // |reads| is the list of MockRead completions. |
371 // |writes| is the list of MockWrite completions. | 373 // |writes| is the list of MockWrite completions. |
372 SequencedSocketData(MockRead* reads, | 374 SequencedSocketData(MockRead* reads, |
373 size_t reads_count, | 375 size_t reads_count, |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
570 // SSLClientSocket implementation. | 572 // SSLClientSocket implementation. |
571 void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) override; | 573 void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) override; |
572 int ExportKeyingMaterial(const base::StringPiece& label, | 574 int ExportKeyingMaterial(const base::StringPiece& label, |
573 bool has_context, | 575 bool has_context, |
574 const base::StringPiece& context, | 576 const base::StringPiece& context, |
575 unsigned char* out, | 577 unsigned char* out, |
576 unsigned int outlen) override; | 578 unsigned int outlen) override; |
577 int GetTLSUniqueChannelBinding(std::string* out) override; | 579 int GetTLSUniqueChannelBinding(std::string* out) override; |
578 NextProtoStatus GetNextProto(std::string* proto) const override; | 580 NextProtoStatus GetNextProto(std::string* proto) const override; |
579 ChannelIDService* GetChannelIDService() const override; | 581 ChannelIDService* GetChannelIDService() const override; |
| 582 Error GetSignedEKMForTokenBinding(crypto::ECPrivateKey* key, |
| 583 std::vector<uint8_t>* out) override; |
580 SSLFailureState GetSSLFailureState() const override; | 584 SSLFailureState GetSSLFailureState() const override; |
581 | 585 |
582 protected: | 586 protected: |
583 ~MockClientSocket() override; | 587 ~MockClientSocket() override; |
584 void RunCallbackAsync(const CompletionCallback& callback, int result); | 588 void RunCallbackAsync(const CompletionCallback& callback, int result); |
585 void RunCallback(const CompletionCallback& callback, int result); | 589 void RunCallback(const CompletionCallback& callback, int result); |
586 | 590 |
587 // True if Connect completed successfully and Disconnect hasn't been called. | 591 // True if Connect completed successfully and Disconnect hasn't been called. |
588 bool connected_; | 592 bool connected_; |
589 | 593 |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
684 void Disconnect() override; | 688 void Disconnect() override; |
685 bool IsConnected() const override; | 689 bool IsConnected() const override; |
686 bool IsConnectedAndIdle() const override; | 690 bool IsConnectedAndIdle() const override; |
687 bool WasEverUsed() const override; | 691 bool WasEverUsed() const override; |
688 bool UsingTCPFastOpen() const override; | 692 bool UsingTCPFastOpen() const override; |
689 int GetPeerAddress(IPEndPoint* address) const override; | 693 int GetPeerAddress(IPEndPoint* address) const override; |
690 bool GetSSLInfo(SSLInfo* ssl_info) override; | 694 bool GetSSLInfo(SSLInfo* ssl_info) override; |
691 | 695 |
692 // SSLClientSocket implementation. | 696 // SSLClientSocket implementation. |
693 void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) override; | 697 void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) override; |
| 698 Error GetSignedEKMForTokenBinding(crypto::ECPrivateKey* key, |
| 699 std::vector<uint8_t>* out) override; |
694 NextProtoStatus GetNextProto(std::string* proto) const override; | 700 NextProtoStatus GetNextProto(std::string* proto) const override; |
695 | 701 |
696 // This MockSocket does not implement the manual async IO feature. | 702 // This MockSocket does not implement the manual async IO feature. |
697 void OnReadComplete(const MockRead& data) override; | 703 void OnReadComplete(const MockRead& data) override; |
698 void OnWriteComplete(int rv) override; | 704 void OnWriteComplete(int rv) override; |
699 void OnConnectComplete(const MockConnect& data) override; | 705 void OnConnectComplete(const MockConnect& data) override; |
700 // SSL sockets don't need magic to deal with destruction of their data | 706 // SSL sockets don't need magic to deal with destruction of their data |
701 // provider. | 707 // provider. |
702 // TODO(mmenke): Probably a good idea to support it, anyways. | 708 // TODO(mmenke): Probably a good idea to support it, anyways. |
703 void OnDataProviderDestroyed() override {} | 709 void OnDataProviderDestroyed() override {} |
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
993 | 999 |
994 // Helper function to get the total data size of the MockReads in |reads|. | 1000 // Helper function to get the total data size of the MockReads in |reads|. |
995 int64_t CountReadBytes(const MockRead reads[], size_t reads_size); | 1001 int64_t CountReadBytes(const MockRead reads[], size_t reads_size); |
996 | 1002 |
997 // Helper function to get the total data size of the MockWrites in |writes|. | 1003 // Helper function to get the total data size of the MockWrites in |writes|. |
998 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size); | 1004 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size); |
999 | 1005 |
1000 } // namespace net | 1006 } // namespace net |
1001 | 1007 |
1002 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ | 1008 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ |
OLD | NEW |