| 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 293 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 }; | 304 }; |
| 305 | 305 |
| 306 // A DataProvider where the client must write a request before the reads (e.g. | 306 // A DataProvider where the client must write a request before the reads (e.g. |
| 307 // the response) will complete. | 307 // the response) will complete. |
| 308 class DelayedSocketData : public StaticSocketDataProvider { | 308 class DelayedSocketData : public StaticSocketDataProvider { |
| 309 public: | 309 public: |
| 310 // |write_delay| the number of MockWrites to complete before allowing | 310 // |write_delay| the number of MockWrites to complete before allowing |
| 311 // a MockRead to complete. | 311 // a MockRead to complete. |
| 312 // |reads| the list of MockRead completions. | 312 // |reads| the list of MockRead completions. |
| 313 // |writes| the list of MockWrite completions. | 313 // |writes| the list of MockWrite completions. |
| 314 // Note: All MockReads and MockWrites must be async. | |
| 315 // Note: For stream sockets, the MockRead list must end with a EOF, e.g., a | 314 // Note: For stream sockets, the MockRead list must end with a EOF, e.g., a |
| 316 // MockRead(true, 0, 0); | 315 // MockRead(true, 0, 0); |
| 317 DelayedSocketData(int write_delay, | 316 DelayedSocketData(int write_delay, |
| 318 MockRead* reads, size_t reads_count, | 317 MockRead* reads, size_t reads_count, |
| 319 MockWrite* writes, size_t writes_count); | 318 MockWrite* writes, size_t writes_count); |
| 320 | 319 |
| 321 // |connect| the result for the connect phase. | 320 // |connect| the result for the connect phase. |
| 322 // |reads| the list of MockRead completions. | 321 // |reads| the list of MockRead completions. |
| 323 // |write_delay| the number of MockWrites to complete before allowing | 322 // |write_delay| the number of MockWrites to complete before allowing |
| 324 // a MockRead to complete. | 323 // a MockRead to complete. |
| 325 // |writes| the list of MockWrite completions. | 324 // |writes| the list of MockWrite completions. |
| 326 // Note: All MockReads and MockWrites must be async. | |
| 327 // Note: For stream sockets, the MockRead list must end with a EOF, e.g., a | 325 // Note: For stream sockets, the MockRead list must end with a EOF, e.g., a |
| 328 // MockRead(true, 0, 0); | 326 // MockRead(true, 0, 0); |
| 329 DelayedSocketData(const MockConnect& connect, int write_delay, | 327 DelayedSocketData(const MockConnect& connect, int write_delay, |
| 330 MockRead* reads, size_t reads_count, | 328 MockRead* reads, size_t reads_count, |
| 331 MockWrite* writes, size_t writes_count); | 329 MockWrite* writes, size_t writes_count); |
| 332 virtual ~DelayedSocketData(); | 330 virtual ~DelayedSocketData(); |
| 333 | 331 |
| 334 void ForceNextRead(); | 332 void ForceNextRead(); |
| 335 | 333 |
| 336 // StaticSocketDataProvider: | 334 // StaticSocketDataProvider: |
| (...skipping 734 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1071 | 1069 |
| 1072 extern const char kSOCKS5OkRequest[]; | 1070 extern const char kSOCKS5OkRequest[]; |
| 1073 extern const int kSOCKS5OkRequestLength; | 1071 extern const int kSOCKS5OkRequestLength; |
| 1074 | 1072 |
| 1075 extern const char kSOCKS5OkResponse[]; | 1073 extern const char kSOCKS5OkResponse[]; |
| 1076 extern const int kSOCKS5OkResponseLength; | 1074 extern const int kSOCKS5OkResponseLength; |
| 1077 | 1075 |
| 1078 } // namespace net | 1076 } // namespace net |
| 1079 | 1077 |
| 1080 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ | 1078 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ |
| OLD | NEW |