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

Side by Side Diff: net/spdy/spdy_stream_test_util.cc

Issue 10828129: SPDY: WriteHeaders should not invoke OnDataSent callback (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/spdy/spdy_stream_test_util.h ('k') | net/spdy/spdy_websocket_stream.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/spdy/spdy_stream_test_util.h" 5 #include "net/spdy/spdy_stream_test_util.h"
6 6
7 #include "net/base/completion_callback.h" 7 #include "net/base/completion_callback.h"
8 #include "net/spdy/spdy_stream.h" 8 #include "net/spdy/spdy_stream.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
11 namespace net { 11 namespace net {
12 12
13 namespace test { 13 namespace test {
14 14
15 TestSpdyStreamDelegate::TestSpdyStreamDelegate( 15 TestSpdyStreamDelegate::TestSpdyStreamDelegate(
16 SpdyStream* stream, 16 SpdyStream* stream,
17 SpdyHeaderBlock* headers, 17 SpdyHeaderBlock* headers,
18 IOBufferWithSize* buf, 18 IOBufferWithSize* buf,
19 const CompletionCallback& callback) 19 const CompletionCallback& callback)
20 : stream_(stream), 20 : stream_(stream),
21 headers_(headers), 21 headers_(headers),
22 buf_(buf), 22 buf_(buf),
23 callback_(callback), 23 callback_(callback),
24 send_headers_completed_(false), 24 send_headers_completed_(false),
25 response_(new SpdyHeaderBlock), 25 response_(new SpdyHeaderBlock),
26 headers_sent_(0),
26 data_sent_(0), 27 data_sent_(0),
27 closed_(false) { 28 closed_(false) {
28 } 29 }
29 30
30 TestSpdyStreamDelegate::~TestSpdyStreamDelegate() { 31 TestSpdyStreamDelegate::~TestSpdyStreamDelegate() {
31 } 32 }
32 33
33 bool TestSpdyStreamDelegate::OnSendHeadersComplete(int status) { 34 bool TestSpdyStreamDelegate::OnSendHeadersComplete(int status) {
34 send_headers_completed_ = true; 35 send_headers_completed_ = true;
35 return true; 36 return true;
(...skipping 18 matching lines...) Expand all
54 stream_->WriteHeaders(headers_.release())); 55 stream_->WriteHeaders(headers_.release()));
55 } 56 }
56 if (buf_) { 57 if (buf_) {
57 EXPECT_EQ(ERR_IO_PENDING, 58 EXPECT_EQ(ERR_IO_PENDING,
58 stream_->WriteStreamData(buf_.get(), buf_->size(), 59 stream_->WriteStreamData(buf_.get(), buf_->size(),
59 DATA_FLAG_NONE)); 60 DATA_FLAG_NONE));
60 } 61 }
61 return status; 62 return status;
62 } 63 }
63 64
65 void TestSpdyStreamDelegate::OnHeadersSent() {
66 headers_sent_++;
67 }
68
64 int TestSpdyStreamDelegate::OnDataReceived(const char* buffer, int bytes) { 69 int TestSpdyStreamDelegate::OnDataReceived(const char* buffer, int bytes) {
65 received_data_ += std::string(buffer, bytes); 70 received_data_ += std::string(buffer, bytes);
66 return OK; 71 return OK;
67 } 72 }
68 73
69 void TestSpdyStreamDelegate::OnDataSent(int length) { 74 void TestSpdyStreamDelegate::OnDataSent(int length) {
70 data_sent_ += length; 75 data_sent_ += length;
71 } 76 }
72 77
73 void TestSpdyStreamDelegate::OnClose(int status) { 78 void TestSpdyStreamDelegate::OnClose(int status) {
74 closed_ = true; 79 closed_ = true;
75 CompletionCallback callback = callback_; 80 CompletionCallback callback = callback_;
76 callback_.Reset(); 81 callback_.Reset();
77 callback.Run(OK); 82 callback.Run(OK);
78 } 83 }
79 84
80 } // namespace test 85 } // namespace test
81 86
82 } // namespace net 87 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_stream_test_util.h ('k') | net/spdy/spdy_websocket_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698