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

Unified Diff: net/socket/socket_test_util.h

Issue 147117: Make more things possible with mock sockets:... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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 | « no previous file | 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
===================================================================
--- net/socket/socket_test_util.h (revision 19144)
+++ net/socket/socket_test_util.h (working copy)
@@ -67,21 +67,16 @@
class MockSocket {
public:
- MockSocket() : unexpected_read_(true, ERR_UNEXPECTED) {
- }
+ MockSocket() {}
virtual ~MockSocket() {}
- virtual MockRead* GetNextRead() = 0;
+ virtual MockRead GetNextRead() = 0;
virtual MockWriteResult OnWrite(const std::string& data) = 0;
virtual void Reset() = 0;
MockConnect connect_data() const { return connect_; }
- protected:
- MockRead* unexpected_read() { return &unexpected_read_; }
-
private:
- MockRead unexpected_read_;
MockConnect connect_;
DISALLOW_COPY_AND_ASSIGN(MockSocket);
@@ -96,7 +91,7 @@
writes_(w), write_index_(0) {}
// MockSocket methods:
- virtual MockRead* GetNextRead();
+ virtual MockRead GetNextRead();
virtual MockWriteResult OnWrite(const std::string& data);
virtual void Reset();
@@ -119,10 +114,13 @@
DynamicMockSocket();
// MockSocket methods:
- virtual MockRead* GetNextRead();
+ virtual MockRead GetNextRead();
virtual MockWriteResult OnWrite(const std::string& data) = 0;
virtual void Reset();
+ int short_read_limit() const { return short_read_limit_; }
+ void set_short_read_limit(int limit) { short_read_limit_ = limit; }
+
protected:
// The next time there is a read from this socket, it will return |data|.
// Before calling SimulateRead next time, the previous data must be consumed.
@@ -133,6 +131,9 @@
bool has_read_;
bool consumed_read_;
+ // Max number of bytes we will read at a time. 0 means no limit.
+ int short_read_limit_;
+
DISALLOW_COPY_AND_ASSIGN(DynamicMockSocket);
};
« no previous file with comments | « no previous file | net/socket/socket_test_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698