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 <cstring> | 8 #include <cstring> |
9 #include <deque> | 9 #include <deque> |
10 #include <string> | 10 #include <string> |
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
522 T* GetNext() { | 522 T* GetNext() { |
523 DCHECK_LT(next_index_, data_providers_.size()); | 523 DCHECK_LT(next_index_, data_providers_.size()); |
524 return data_providers_[next_index_++]; | 524 return data_providers_[next_index_++]; |
525 } | 525 } |
526 | 526 |
527 void Add(T* data_provider) { | 527 void Add(T* data_provider) { |
528 DCHECK(data_provider); | 528 DCHECK(data_provider); |
529 data_providers_.push_back(data_provider); | 529 data_providers_.push_back(data_provider); |
530 } | 530 } |
531 | 531 |
532 size_t next_index() { return next_index_; } | |
533 | |
532 void ResetNextIndex() { | 534 void ResetNextIndex() { |
533 next_index_ = 0; | 535 next_index_ = 0; |
534 } | 536 } |
535 | 537 |
536 private: | 538 private: |
537 // Index of the next |data_providers_| element to use. Not an iterator | 539 // Index of the next |data_providers_| element to use. Not an iterator |
538 // because those are invalidated on vector reallocation. | 540 // because those are invalidated on vector reallocation. |
539 size_t next_index_; | 541 size_t next_index_; |
540 | 542 |
541 // SocketDataProviders to be returned. | 543 // SocketDataProviders to be returned. |
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
734 int write_result_; | 736 int write_result_; |
735 | 737 |
736 MockRead read_data_; | 738 MockRead read_data_; |
737 | 739 |
738 IOBuffer* read_buf_; | 740 IOBuffer* read_buf_; |
739 int read_buf_len_; | 741 int read_buf_len_; |
740 bool read_pending_; | 742 bool read_pending_; |
741 CompletionCallback read_callback_; | 743 CompletionCallback read_callback_; |
742 DeterministicSocketData* data_; | 744 DeterministicSocketData* data_; |
743 bool was_used_to_convey_data_; | 745 bool was_used_to_convey_data_; |
744 bool peer_closed_connection_; | 746 bool peer_closed_connection_; |
thaidn_google
2013/04/19 01:42:55
not me.
| |
745 }; | 747 }; |
746 | 748 |
747 class MockSSLClientSocket : public MockClientSocket, public AsyncSocket { | 749 class MockSSLClientSocket : public MockClientSocket, public AsyncSocket { |
748 public: | 750 public: |
749 MockSSLClientSocket( | 751 MockSSLClientSocket( |
750 ClientSocketHandle* transport_socket, | 752 ClientSocketHandle* transport_socket, |
751 const HostPortPair& host_and_port, | 753 const HostPortPair& host_and_port, |
752 const SSLConfig& ssl_config, | 754 const SSLConfig& ssl_config, |
753 SSLSocketDataProvider* socket); | 755 SSLSocketDataProvider* socket); |
754 virtual ~MockSSLClientSocket(); | 756 virtual ~MockSSLClientSocket(); |
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1068 | 1070 |
1069 extern const char kSOCKS5OkRequest[]; | 1071 extern const char kSOCKS5OkRequest[]; |
1070 extern const int kSOCKS5OkRequestLength; | 1072 extern const int kSOCKS5OkRequestLength; |
1071 | 1073 |
1072 extern const char kSOCKS5OkResponse[]; | 1074 extern const char kSOCKS5OkResponse[]; |
1073 extern const int kSOCKS5OkResponseLength; | 1075 extern const int kSOCKS5OkResponseLength; |
1074 | 1076 |
1075 } // namespace net | 1077 } // namespace net |
1076 | 1078 |
1077 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ | 1079 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ |
OLD | NEW |