Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(561)

Unified Diff: net/socket/socket_test_util.h

Issue 1114383003: Add AllReadDataConsumed and AllWriteDataConsumed methods to SocketDataProvider (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « net/socket/sequenced_socket_data_unittest.cc ('k') | net/socket/socket_test_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/socket_test_util.h
diff --git a/net/socket/socket_test_util.h b/net/socket/socket_test_util.h
index 3bd88d2772f751a822613c856d5e2c2f98da90e1..96888fa6f56bc87cd69dc93958f7c23e275fcdbf 100644
--- a/net/socket/socket_test_util.h
+++ b/net/socket/socket_test_util.h
@@ -198,6 +198,8 @@ class SocketDataProvider {
virtual MockRead OnRead() = 0;
virtual MockWriteResult OnWrite(const std::string& data) = 0;
virtual void Reset() = 0;
+ virtual bool AllReadDataConsumed() const = 0;
+ virtual bool AllWriteDataConsumed() const = 0;
// Accessor for the socket which is using the SocketDataProvider.
AsyncSocket* socket() { return socket_; }
@@ -258,14 +260,17 @@ class StaticSocketDataHelper {
// in which case this method will still return true.
bool VerifyWriteData(const std::string& data);
+ // Return true of all read data has been consumed.
ramant (doing other things) 2015/05/01 20:25:41 overly nit: "true of all" -> "true if all"?
Ryan Hamilton 2015/05/01 21:23:32 Done.
+ bool AllReadDataConsumed() const;
+
+ // Return true of all write data has been consumed.
ramant (doing other things) 2015/05/01 20:25:41 overly nit: "true of all" -> "true if all"?
Ryan Hamilton 2015/05/01 21:23:32 Done.
+ bool AllWriteDataConsumed() const;
+
size_t read_index() const { return read_index_; }
size_t write_index() const { return write_index_; }
size_t read_count() const { return read_count_; }
size_t write_count() const { return write_count_; }
- bool at_read_eof() const { return read_index_ >= read_count_; }
- bool at_write_eof() const { return write_index_ >= write_count_; }
-
private:
MockRead* reads_;
size_t read_index_;
@@ -294,15 +299,14 @@ class StaticSocketDataProvider : public SocketDataProvider {
MockRead OnRead() override;
MockWriteResult OnWrite(const std::string& data) override;
void Reset() override;
+ bool AllReadDataConsumed() const override;
+ bool AllWriteDataConsumed() const override;
size_t read_index() const { return helper_.read_index(); }
size_t write_index() const { return helper_.write_index(); }
size_t read_count() const { return helper_.read_count(); }
size_t write_count() const { return helper_.write_count(); }
- bool at_read_eof() const { return helper_.at_read_eof(); }
- bool at_write_eof() const { return helper_.at_write_eof(); }
-
protected:
StaticSocketDataHelper* helper() { return &helper_; }
@@ -499,12 +503,8 @@ class SequencedSocketData : public SocketDataProvider {
MockRead OnRead() override;
MockWriteResult OnWrite(const std::string& data) override;
void Reset() override;
-
- // Returns true if all data has been read.
- bool at_read_eof() const;
-
- // Returns true if all data has been written.
- bool at_write_eof() const;
+ bool AllReadDataConsumed() const override;
+ bool AllWriteDataConsumed() const override;
private:
// Defines the state for the read or write path.
« no previous file with comments | « net/socket/sequenced_socket_data_unittest.cc ('k') | net/socket/socket_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698