diff options
author | ahendrickson@google.com <ahendrickson@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-25 19:56:12 +0000 |
---|---|---|
committer | ahendrickson@google.com <ahendrickson@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-25 19:56:12 +0000 |
commit | 3f662f158a7ba94d3e1b235262a975474c117fad (patch) | |
tree | fbb8952a875ab16c3a6e766257548084e33aae9f /net/socket/socket_test_util.h | |
parent | 8bb174c2d00c18fb682ab9bcbfa1f5f3f0ed2281 (diff) | |
download | chromium_src-3f662f158a7ba94d3e1b235262a975474c117fad.zip chromium_src-3f662f158a7ba94d3e1b235262a975474c117fad.tar.gz chromium_src-3f662f158a7ba94d3e1b235262a975474c117fad.tar.bz2 |
SpdySession now sets the following fields in HttpResponseInfo:
request_time
response_time
vary_data
There is also a unit test to exercise the new functionality.
- Changed CreateSpdyHeadersFromHttpRequest() to use std::string::append()
rather than std::string::operator+() to append a single '\0' character
to the string, as the former does nothing.
- Now using SpdyFramer.
- The unit tests now include all server push cases.
BUG=34505
TEST=Run netunittests.exe --gtest_filter=SpdyNetworkTransactionTest.*
Review URL: http://codereview.chromium.org/634002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42660 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket/socket_test_util.h')
-rw-r--r-- | net/socket/socket_test_util.h | 47 |
1 files changed, 42 insertions, 5 deletions
diff --git a/net/socket/socket_test_util.h b/net/socket/socket_test_util.h index 2daa901..b42b272 100644 --- a/net/socket/socket_test_util.h +++ b/net/socket/socket_test_util.h @@ -50,29 +50,55 @@ struct MockConnect { }; struct MockRead { + // Flag to indicate that the message loop should be terminated. + enum { + STOPLOOP = 1 << 31 + }; + // Default - MockRead() : async(false), result(0), data(NULL), data_len(0) {} + MockRead() : async(false), result(0), data(NULL), data_len(0), + sequence_number(0), time_stamp(base::Time::Now()) {} // Read failure (no data). MockRead(bool async, int result) : async(async) , result(result), data(NULL), - data_len(0) { } + data_len(0), sequence_number(0), time_stamp(base::Time::Now()) { } + + // Read failure (no data), with sequence information. + MockRead(bool async, int result, int seq) : async(async) , result(result), + data(NULL), data_len(0), sequence_number(seq), + time_stamp(base::Time::Now()) { } // Asynchronous read success (inferred data length). explicit MockRead(const char* data) : async(true), result(0), data(data), - data_len(strlen(data)) { } + data_len(strlen(data)), sequence_number(0), + time_stamp(base::Time::Now()) { } // Read success (inferred data length). MockRead(bool async, const char* data) : async(async), result(0), data(data), - data_len(strlen(data)) { } + data_len(strlen(data)), sequence_number(0), + time_stamp(base::Time::Now()) { } // Read success. MockRead(bool async, const char* data, int data_len) : async(async), - result(0), data(data), data_len(data_len) { } + result(0), data(data), data_len(data_len), sequence_number(0), + time_stamp(base::Time::Now()) { } + + // Read success with sequence information. + MockRead(bool async, const char* data, int data_len, int seq) : async(async), + result(0), data(data), data_len(data_len), sequence_number(seq), + time_stamp(base::Time::Now()) { } bool async; int result; const char* data; int data_len; + + // For OrderedSocketData in spdy_network_transaction_unittest.cc, which only + // allows reads to occur in a particular sequence. If a read occurs before + // the given |sequence_number| is reached, an ERR_IO_PENDING is returned. + int sequence_number; // The sequence number at which a read is allowed + // to occur. + base::Time time_stamp; // The time stamp at which the operation occurred. }; // MockWrite uses the same member fields as MockRead, but with different @@ -139,6 +165,17 @@ class StaticSocketDataProvider : public SocketDataProvider { virtual MockWriteResult OnWrite(const std::string& data); virtual void Reset(); + // These functions get access to the next available read and write data. + const MockRead& PeekRead() const; + const MockWrite& PeekWrite() const; + // These functions get random access to the read and write data, for timing. + const MockRead& PeekRead(size_t index) const; + const MockWrite& PeekWrite(size_t index) 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_; } |