summaryrefslogtreecommitdiffstats
path: root/net/socket/socket_test_util.cc
diff options
context:
space:
mode:
authorahendrickson@google.com <ahendrickson@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-25 19:56:12 +0000
committerahendrickson@google.com <ahendrickson@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-25 19:56:12 +0000
commit3f662f158a7ba94d3e1b235262a975474c117fad (patch)
treefbb8952a875ab16c3a6e766257548084e33aae9f /net/socket/socket_test_util.cc
parent8bb174c2d00c18fb682ab9bcbfa1f5f3f0ed2281 (diff)
downloadchromium_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.cc')
-rw-r--r--net/socket/socket_test_util.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/net/socket/socket_test_util.cc b/net/socket/socket_test_util.cc
index 8b8153e..4a8311c 100644
--- a/net/socket/socket_test_util.cc
+++ b/net/socket/socket_test_util.cc
@@ -9,6 +9,7 @@
#include "base/basictypes.h"
#include "base/compiler_specific.h"
#include "base/message_loop.h"
+#include "base/time.h"
#include "net/base/address_family.h"
#include "net/base/host_resolver_proc.h"
#include "net/base/ssl_info.h"
@@ -287,6 +288,7 @@ int MockSSLClientSocket::Write(net::IOBuffer* buf, int buf_len,
MockRead StaticSocketDataProvider::GetNextRead() {
DCHECK(!at_read_eof());
+ reads_[read_index_].time_stamp = base::Time::Now();
return reads_[read_index_++];
}
@@ -301,6 +303,7 @@ MockWriteResult StaticSocketDataProvider::OnWrite(const std::string& data) {
// Check that what we are writing matches the expectation.
// Then give the mocked return value.
net::MockWrite* w = &writes_[write_index_++];
+ w->time_stamp = base::Time::Now();
int result = w->result;
if (w->data) {
// Note - we can simulate a partial write here. If the expected data
@@ -321,6 +324,26 @@ MockWriteResult StaticSocketDataProvider::OnWrite(const std::string& data) {
return MockWriteResult(w->async, result);
}
+const MockRead& StaticSocketDataProvider::PeekRead() const {
+ DCHECK(!at_read_eof());
+ return reads_[read_index_];
+}
+
+const MockWrite& StaticSocketDataProvider::PeekWrite() const {
+ DCHECK(!at_write_eof());
+ return writes_[write_index_];
+}
+
+const MockRead& StaticSocketDataProvider::PeekRead(size_t index) const {
+ DCHECK_LT(index, read_count_);
+ return reads_[index];
+}
+
+const MockWrite& StaticSocketDataProvider::PeekWrite(size_t index) const {
+ DCHECK_LT(index, write_count_);
+ return writes_[index];
+}
+
void StaticSocketDataProvider::Reset() {
read_index_ = 0;
write_index_ = 0;