diff options
author | eustas@chromium.org <eustas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-09 23:03:36 +0000 |
---|---|---|
committer | eustas@chromium.org <eustas@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-09 23:03:36 +0000 |
commit | 533f0de0fc40cb838c8ca32b83775fc41864e859 (patch) | |
tree | 6b394a8a6044fbf09dbe35862d68d9dffd493ccc /net/tools/flip_server | |
parent | f33ca361b0b6e699b91f89ea8d55bac82d622fb0 (diff) | |
download | chromium_src-533f0de0fc40cb838c8ca32b83775fc41864e859.zip chromium_src-533f0de0fc40cb838c8ca32b83775fc41864e859.tar.gz chromium_src-533f0de0fc40cb838c8ca32b83775fc41864e859.tar.bz2 |
Add "raw_received_bytes" getter to SpdyStream.
The final goal is to add "GetTransferSize" to url request,
so DevTools could reliably report it to user.
See: https://codereview.chromium.org/46223003/
In SpdyStream we calculate raw_received_bytes as a sum
of lengths of frame headers and payloads.
BUG=111052
Review URL: https://codereview.chromium.org/85413005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@239585 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/tools/flip_server')
-rw-r--r-- | net/tools/flip_server/spdy_interface.h | 5 | ||||
-rw-r--r-- | net/tools/flip_server/spdy_interface_test.cc | 21 |
2 files changed, 22 insertions, 4 deletions
diff --git a/net/tools/flip_server/spdy_interface.h b/net/tools/flip_server/spdy_interface.h index 6abbdb9..05e1d85 100644 --- a/net/tools/flip_server/spdy_interface.h +++ b/net/tools/flip_server/spdy_interface.h @@ -82,6 +82,11 @@ class SpdySM : public BufferedSpdyFramerVisitorInterface, bool fin, const SpdyHeaderBlock& headers) OVERRIDE; + // Called when data frame header is received. + virtual void OnDataFrameHeader(SpdyStreamId stream_id, + size_t length, + bool fin) OVERRIDE {} + // Called when data is received. // |stream_id| The stream receiving data. // |data| A buffer containing the data received. diff --git a/net/tools/flip_server/spdy_interface_test.cc b/net/tools/flip_server/spdy_interface_test.cc index bbe7455..25d9505 100644 --- a/net/tools/flip_server/spdy_interface_test.cc +++ b/net/tools/flip_server/spdy_interface_test.cc @@ -56,6 +56,7 @@ class SpdyFramerVisitor : public BufferedSpdyFramerVisitorInterface { MOCK_METHOD3(OnSynStream, void(SpdyStreamId, bool, const SpdyHeaderBlock&)); MOCK_METHOD3(OnSynReply, void(SpdyStreamId, bool, const SpdyHeaderBlock&)); MOCK_METHOD3(OnHeaders, void(SpdyStreamId, bool, const SpdyHeaderBlock&)); + MOCK_METHOD3(OnDataFrameHeader, void(SpdyStreamId, size_t, bool)); MOCK_METHOD4(OnStreamFrameData, void(SpdyStreamId, const char*, size_t, @@ -469,6 +470,8 @@ TEST_P(SpdySMProxyTest, SendErrorNotFound_SPDY2) { .WillOnce(SaveArg<2>(&actual_header_block)); EXPECT_CALL(checkpoint, Call(0)); EXPECT_CALL(*spdy_framer_visitor_, + OnDataFrameHeader(stream_id, _, true)); + EXPECT_CALL(*spdy_framer_visitor_, OnStreamFrameData(stream_id, _, _, false)).Times(1) .WillOnce(DoAll(SaveArg<1>(&actual_data), SaveArg<2>(&actual_size))); @@ -512,6 +515,8 @@ TEST_P(SpdySMProxyTest, SendErrorNotFound) { .WillOnce(SaveArg<2>(&actual_header_block)); EXPECT_CALL(checkpoint, Call(0)); EXPECT_CALL(*spdy_framer_visitor_, + OnDataFrameHeader(stream_id, _, true)); + EXPECT_CALL(*spdy_framer_visitor_, OnStreamFrameData(stream_id, _, _, false)).Times(1) .WillOnce(DoAll(SaveArg<1>(&actual_data), SaveArg<2>(&actual_size))); @@ -678,6 +683,8 @@ TEST_P(SpdySMProxyTest, SendDataFrame) { { InSequence s; EXPECT_CALL(*spdy_framer_visitor_, + OnDataFrameHeader(stream_id, _, false)); + EXPECT_CALL(*spdy_framer_visitor_, OnStreamFrameData(stream_id, _, _, false)) .WillOnce(DoAll(SaveArg<1>(&actual_data), SaveArg<2>(&actual_size))); @@ -702,10 +709,14 @@ TEST_P(SpdySMProxyTest, SendLongDataFrame) { { InSequence s; - EXPECT_CALL(*spdy_framer_visitor_, - OnStreamFrameData(stream_id, _, _, false)).Times(3) - .WillRepeatedly(DoAll(SaveArg<1>(&actual_data), - SaveArg<2>(&actual_size))); + for (int i = 0; i < 3; ++i) { + EXPECT_CALL(*spdy_framer_visitor_, + OnDataFrameHeader(stream_id, _, false)); + EXPECT_CALL(*spdy_framer_visitor_, + OnStreamFrameData(stream_id, _, _, false)) + .WillOnce(DoAll(SaveArg<1>(&actual_data), + SaveArg<2>(&actual_size))); + } } ASSERT_EQ(3u, connection_->output_list()->size()); @@ -825,6 +836,8 @@ TEST_P(SpdySMServerTest, NewStreamError) { .WillOnce(SaveArg<2>(&actual_header_block)); EXPECT_CALL(checkpoint, Call(0)); EXPECT_CALL(*spdy_framer_visitor_, + OnDataFrameHeader(stream_id, _, true)); + EXPECT_CALL(*spdy_framer_visitor_, OnStreamFrameData(stream_id, _, _, false)).Times(1) .WillOnce(DoAll(SaveArg<1>(&actual_data), SaveArg<2>(&actual_size))); |