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 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1018 // if that request did not complete (for example was canceled). | 1018 // if that request did not complete (for example was canceled). |
1019 int GetOrderOfRequest(size_t index) const; | 1019 int GetOrderOfRequest(size_t index) const; |
1020 | 1020 |
1021 // Resets first initialized socket handle from |requests_|. If found such | 1021 // Resets first initialized socket handle from |requests_|. If found such |
1022 // a handle, returns true. | 1022 // a handle, returns true. |
1023 bool ReleaseOneConnection(KeepAlive keep_alive); | 1023 bool ReleaseOneConnection(KeepAlive keep_alive); |
1024 | 1024 |
1025 // Releases connections until there is nothing to release. | 1025 // Releases connections until there is nothing to release. |
1026 void ReleaseAllConnections(KeepAlive keep_alive); | 1026 void ReleaseAllConnections(KeepAlive keep_alive); |
1027 | 1027 |
| 1028 // Note that this uses 0-based indices, while GetOrderOfRequest takes and |
| 1029 // returns 0-based indices. |
1028 TestSocketRequest* request(int i) { return requests_[i]; } | 1030 TestSocketRequest* request(int i) { return requests_[i]; } |
| 1031 |
1029 size_t requests_size() const { return requests_.size(); } | 1032 size_t requests_size() const { return requests_.size(); } |
1030 ScopedVector<TestSocketRequest>* requests() { return &requests_; } | 1033 ScopedVector<TestSocketRequest>* requests() { return &requests_; } |
1031 size_t completion_count() const { return completion_count_; } | 1034 size_t completion_count() const { return completion_count_; } |
1032 | 1035 |
1033 private: | 1036 private: |
1034 ScopedVector<TestSocketRequest> requests_; | 1037 ScopedVector<TestSocketRequest> requests_; |
1035 std::vector<TestSocketRequest*> request_order_; | 1038 std::vector<TestSocketRequest*> request_order_; |
1036 size_t completion_count_; | 1039 size_t completion_count_; |
1037 }; | 1040 }; |
1038 | 1041 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1178 | 1181 |
1179 extern const char kSOCKS5OkRequest[]; | 1182 extern const char kSOCKS5OkRequest[]; |
1180 extern const int kSOCKS5OkRequestLength; | 1183 extern const int kSOCKS5OkRequestLength; |
1181 | 1184 |
1182 extern const char kSOCKS5OkResponse[]; | 1185 extern const char kSOCKS5OkResponse[]; |
1183 extern const int kSOCKS5OkResponseLength; | 1186 extern const int kSOCKS5OkResponseLength; |
1184 | 1187 |
1185 } // namespace net | 1188 } // namespace net |
1186 | 1189 |
1187 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ | 1190 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ |
OLD | NEW |