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 526 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 |