Chromium Code Reviews| 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() { |
|
wtc
2013/04/18 18:15:34
Nit and optional: we should rename this method "re
| |
| 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. |
| 542 std::vector<T*> data_providers_; | 544 std::vector<T*> data_providers_; |
| (...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1067 | 1069 |
| 1068 extern const char kSOCKS5OkRequest[]; | 1070 extern const char kSOCKS5OkRequest[]; |
| 1069 extern const int kSOCKS5OkRequestLength; | 1071 extern const int kSOCKS5OkRequestLength; |
| 1070 | 1072 |
| 1071 extern const char kSOCKS5OkResponse[]; | 1073 extern const char kSOCKS5OkResponse[]; |
| 1072 extern const int kSOCKS5OkResponseLength; | 1074 extern const int kSOCKS5OkResponseLength; |
| 1073 | 1075 |
| 1074 } // namespace net | 1076 } // namespace net |
| 1075 | 1077 |
| 1076 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ | 1078 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ |
| OLD | NEW |