| 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 519 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 530 private: | 530 private: |
| 531 SocketDataProviderArray<SocketDataProvider> mock_data_; | 531 SocketDataProviderArray<SocketDataProvider> mock_data_; |
| 532 SocketDataProviderArray<SSLSocketDataProvider> mock_ssl_data_; | 532 SocketDataProviderArray<SSLSocketDataProvider> mock_ssl_data_; |
| 533 std::vector<uint16_t> udp_client_socket_ports_; | 533 std::vector<uint16_t> udp_client_socket_ports_; |
| 534 | 534 |
| 535 DISALLOW_COPY_AND_ASSIGN(MockClientSocketFactory); | 535 DISALLOW_COPY_AND_ASSIGN(MockClientSocketFactory); |
| 536 }; | 536 }; |
| 537 | 537 |
| 538 class MockClientSocket : public SSLClientSocket { | 538 class MockClientSocket : public SSLClientSocket { |
| 539 public: | 539 public: |
| 540 // Value returned by GetTLSUniqueChannelBinding(). | |
| 541 static const char kTlsUnique[]; | |
| 542 | |
| 543 // The BoundNetLog is needed to test LoadTimingInfo, which uses NetLog IDs as | 540 // The BoundNetLog is needed to test LoadTimingInfo, which uses NetLog IDs as |
| 544 // unique socket IDs. | 541 // unique socket IDs. |
| 545 explicit MockClientSocket(const BoundNetLog& net_log); | 542 explicit MockClientSocket(const BoundNetLog& net_log); |
| 546 | 543 |
| 547 // Socket implementation. | 544 // Socket implementation. |
| 548 int Read(IOBuffer* buf, | 545 int Read(IOBuffer* buf, |
| 549 int buf_len, | 546 int buf_len, |
| 550 const CompletionCallback& callback) override = 0; | 547 const CompletionCallback& callback) override = 0; |
| 551 int Write(IOBuffer* buf, | 548 int Write(IOBuffer* buf, |
| 552 int buf_len, | 549 int buf_len, |
| (...skipping 16 matching lines...) Expand all Loading... |
| 569 void AddConnectionAttempts(const ConnectionAttempts& attempts) override {} | 566 void AddConnectionAttempts(const ConnectionAttempts& attempts) override {} |
| 570 int64_t GetTotalReceivedBytes() const override; | 567 int64_t GetTotalReceivedBytes() const override; |
| 571 | 568 |
| 572 // SSLClientSocket implementation. | 569 // SSLClientSocket implementation. |
| 573 void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) override; | 570 void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) override; |
| 574 int ExportKeyingMaterial(const base::StringPiece& label, | 571 int ExportKeyingMaterial(const base::StringPiece& label, |
| 575 bool has_context, | 572 bool has_context, |
| 576 const base::StringPiece& context, | 573 const base::StringPiece& context, |
| 577 unsigned char* out, | 574 unsigned char* out, |
| 578 unsigned int outlen) override; | 575 unsigned int outlen) override; |
| 579 int GetTLSUniqueChannelBinding(std::string* out) override; | |
| 580 NextProtoStatus GetNextProto(std::string* proto) const override; | 576 NextProtoStatus GetNextProto(std::string* proto) const override; |
| 581 ChannelIDService* GetChannelIDService() const override; | 577 ChannelIDService* GetChannelIDService() const override; |
| 582 Error GetSignedEKMForTokenBinding(crypto::ECPrivateKey* key, | 578 Error GetSignedEKMForTokenBinding(crypto::ECPrivateKey* key, |
| 583 std::vector<uint8_t>* out) override; | 579 std::vector<uint8_t>* out) override; |
| 584 crypto::ECPrivateKey* GetChannelIDKey() const override; | 580 crypto::ECPrivateKey* GetChannelIDKey() const override; |
| 585 SSLFailureState GetSSLFailureState() const override; | 581 SSLFailureState GetSSLFailureState() const override; |
| 586 | 582 |
| 587 protected: | 583 protected: |
| 588 ~MockClientSocket() override; | 584 ~MockClientSocket() override; |
| 589 void RunCallbackAsync(const CompletionCallback& callback, int result); | 585 void RunCallbackAsync(const CompletionCallback& callback, int result); |
| (...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1000 | 996 |
| 1001 // Helper function to get the total data size of the MockReads in |reads|. | 997 // Helper function to get the total data size of the MockReads in |reads|. |
| 1002 int64_t CountReadBytes(const MockRead reads[], size_t reads_size); | 998 int64_t CountReadBytes(const MockRead reads[], size_t reads_size); |
| 1003 | 999 |
| 1004 // Helper function to get the total data size of the MockWrites in |writes|. | 1000 // Helper function to get the total data size of the MockWrites in |writes|. |
| 1005 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size); | 1001 int64_t CountWriteBytes(const MockWrite writes[], size_t writes_size); |
| 1006 | 1002 |
| 1007 } // namespace net | 1003 } // namespace net |
| 1008 | 1004 |
| 1009 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ | 1005 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ |
| OLD | NEW |