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 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
505 void Reset() override; | 505 void Reset() override; |
506 bool AllReadDataConsumed() const override; | 506 bool AllReadDataConsumed() const override; |
507 bool AllWriteDataConsumed() const override; | 507 bool AllWriteDataConsumed() const override; |
508 | 508 |
509 // Returns true if all data has been read. | 509 // Returns true if all data has been read. |
510 bool at_read_eof() const; | 510 bool at_read_eof() const; |
511 | 511 |
512 // Returns true if all data has been written. | 512 // Returns true if all data has been written. |
513 bool at_write_eof() const; | 513 bool at_write_eof() const; |
514 | 514 |
| 515 bool IsReadPaused(); |
| 516 void CompleteRead(); |
| 517 |
515 private: | 518 private: |
516 // Defines the state for the read or write path. | 519 // Defines the state for the read or write path. |
517 enum IoState { | 520 enum IoState { |
518 IDLE, // No async operation is in progress. | 521 IDLE, // No async operation is in progress. |
519 PENDING, // An async operation in waiting for another opteration to | 522 PENDING, // An async operation in waiting for another opteration to |
520 // complete. | 523 // complete. |
521 COMPLETING, // A task has been posted to complet an async operation. | 524 COMPLETING, // A task has been posted to complet an async operation. |
| 525 PAUSED, // IO is paused until CompleteRead() is called. |
522 }; | 526 }; |
| 527 |
523 void OnReadComplete(); | 528 void OnReadComplete(); |
524 void OnWriteComplete(); | 529 void OnWriteComplete(); |
525 | 530 |
526 void MaybePostReadCompleteTask(); | 531 void MaybePostReadCompleteTask(); |
527 void MaybePostWriteCompleteTask(); | 532 void MaybePostWriteCompleteTask(); |
528 | 533 |
529 StaticSocketDataHelper helper_; | 534 StaticSocketDataHelper helper_; |
530 int sequence_number_; | 535 int sequence_number_; |
531 IoState read_state_; | 536 IoState read_state_; |
532 IoState write_state_; | 537 IoState write_state_; |
(...skipping 858 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1391 | 1396 |
1392 extern const char kSOCKS5OkRequest[]; | 1397 extern const char kSOCKS5OkRequest[]; |
1393 extern const int kSOCKS5OkRequestLength; | 1398 extern const int kSOCKS5OkRequestLength; |
1394 | 1399 |
1395 extern const char kSOCKS5OkResponse[]; | 1400 extern const char kSOCKS5OkResponse[]; |
1396 extern const int kSOCKS5OkResponseLength; | 1401 extern const int kSOCKS5OkResponseLength; |
1397 | 1402 |
1398 } // namespace net | 1403 } // namespace net |
1399 | 1404 |
1400 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ | 1405 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ |
OLD | NEW |