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 501 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 512 }; | 512 }; |
| 513 | 513 |
| 514 // Holds an array of SocketDataProvider elements. As Mock{TCP,SSL}StreamSocket | 514 // Holds an array of SocketDataProvider elements. As Mock{TCP,SSL}StreamSocket |
| 515 // objects get instantiated, they take their data from the i'th element of this | 515 // objects get instantiated, they take their data from the i'th element of this |
| 516 // array. | 516 // array. |
| 517 template<typename T> | 517 template<typename T> |
| 518 class SocketDataProviderArray { | 518 class SocketDataProviderArray { |
| 519 public: | 519 public: |
| 520 SocketDataProviderArray() : next_index_(0) {} | 520 SocketDataProviderArray() : next_index_(0) {} |
| 521 | 521 |
| 522 size_t next_index() { return next_index_; } | |
|
wtc
2013/04/17 19:49:50
Nit: move this getter method to be next to the rel
thaidn_google
2013/04/17 22:16:07
Done.
| |
| 523 | |
| 522 T* GetNext() { | 524 T* GetNext() { |
| 523 DCHECK_LT(next_index_, data_providers_.size()); | 525 DCHECK_LT(next_index_, data_providers_.size()); |
| 524 return data_providers_[next_index_++]; | 526 return data_providers_[next_index_++]; |
| 525 } | 527 } |
| 526 | 528 |
| 527 void Add(T* data_provider) { | 529 void Add(T* data_provider) { |
| 528 DCHECK(data_provider); | 530 DCHECK(data_provider); |
| 529 data_providers_.push_back(data_provider); | 531 data_providers_.push_back(data_provider); |
| 530 } | 532 } |
| 531 | 533 |
| (...skipping 535 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 |