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 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
499 | 499 |
500 ~SequencedSocketData() override; | 500 ~SequencedSocketData() override; |
501 | 501 |
502 // SocketDataProviderBase implementation. | 502 // SocketDataProviderBase implementation. |
503 MockRead OnRead() override; | 503 MockRead OnRead() override; |
504 MockWriteResult OnWrite(const std::string& data) override; | 504 MockWriteResult OnWrite(const std::string& data) override; |
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 bool IsReadPaused(); | |
510 void CompleteRead(); | |
511 | |
512 private: | 509 private: |
513 // Defines the state for the read or write path. | 510 // Defines the state for the read or write path. |
514 enum IoState { | 511 enum IoState { |
515 IDLE, // No async operation is in progress. | 512 IDLE, // No async operation is in progress. |
516 PENDING, // An async operation in waiting for another opteration to | 513 PENDING, // An async operation in waiting for another opteration to |
517 // complete. | 514 // complete. |
518 COMPLETING, // A task has been posted to complet an async operation. | 515 COMPLETING, // A task has been posted to complet an async operation. |
519 PAUSED, // IO is paused until CompleteRead() is called. | |
520 }; | 516 }; |
521 | |
522 void OnReadComplete(); | 517 void OnReadComplete(); |
523 void OnWriteComplete(); | 518 void OnWriteComplete(); |
524 | 519 |
525 void MaybePostReadCompleteTask(); | 520 void MaybePostReadCompleteTask(); |
526 void MaybePostWriteCompleteTask(); | 521 void MaybePostWriteCompleteTask(); |
527 | 522 |
528 StaticSocketDataHelper helper_; | 523 StaticSocketDataHelper helper_; |
529 int sequence_number_; | 524 int sequence_number_; |
530 IoState read_state_; | 525 IoState read_state_; |
531 IoState write_state_; | 526 IoState write_state_; |
(...skipping 851 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1383 | 1378 |
1384 extern const char kSOCKS5OkRequest[]; | 1379 extern const char kSOCKS5OkRequest[]; |
1385 extern const int kSOCKS5OkRequestLength; | 1380 extern const int kSOCKS5OkRequestLength; |
1386 | 1381 |
1387 extern const char kSOCKS5OkResponse[]; | 1382 extern const char kSOCKS5OkResponse[]; |
1388 extern const int kSOCKS5OkResponseLength; | 1383 extern const int kSOCKS5OkResponseLength; |
1389 | 1384 |
1390 } // namespace net | 1385 } // namespace net |
1391 | 1386 |
1392 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ | 1387 #endif // NET_SOCKET_SOCKET_TEST_UTIL_H_ |
OLD | NEW |