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

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

Issue 6292013: Add chunked uploads support to SPDY (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 9 years, 11 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
« net/spdy/spdy_stream.h ('K') | « net/spdy/spdy_stream.cc ('k') | no next file » | 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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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.h" 5 #include "net/spdy/spdy_stream.h"
6 #include "base/ref_counted.h" 6 #include "base/ref_counted.h"
7 #include "net/spdy/spdy_session.h" 7 #include "net/spdy/spdy_session.h"
8 #include "net/spdy/spdy_test_util.h" 8 #include "net/spdy/spdy_test_util.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 virtual ~TestSpdyStreamDelegate() {} 43 virtual ~TestSpdyStreamDelegate() {}
44 44
45 virtual bool OnSendHeadersComplete(int status) { 45 virtual bool OnSendHeadersComplete(int status) {
46 send_headers_completed_ = true; 46 send_headers_completed_ = true;
47 return true; 47 return true;
48 } 48 }
49 virtual int OnSendBody() { 49 virtual int OnSendBody() {
50 ADD_FAILURE() << "OnSendBody should not be called"; 50 ADD_FAILURE() << "OnSendBody should not be called";
51 return ERR_UNEXPECTED; 51 return ERR_UNEXPECTED;
52 } 52 }
53 virtual bool OnSendBodyComplete(int status) { 53 virtual bool OnSendBodyComplete(int* status) {
54 ADD_FAILURE() << "OnSendBodyComplete should not be called"; 54 ADD_FAILURE() << "OnSendBodyComplete should not be called";
55 return true; 55 return true;
56 } 56 }
57 57
58 virtual int OnResponseReceived(const spdy::SpdyHeaderBlock& response, 58 virtual int OnResponseReceived(const spdy::SpdyHeaderBlock& response,
59 base::Time response_time, 59 base::Time response_time,
60 int status) { 60 int status) {
61 EXPECT_TRUE(send_headers_completed_); 61 EXPECT_TRUE(send_headers_completed_);
62 *response_ = response; 62 *response_ = response;
63 if (buf_) { 63 if (buf_) {
64 EXPECT_EQ(ERR_IO_PENDING, 64 EXPECT_EQ(ERR_IO_PENDING,
65 stream_->WriteStreamData(buf_.get(), buf_->size(), 65 stream_->WriteStreamData(buf_.get(), buf_->size(),
66 spdy::DATA_FLAG_NONE)); 66 spdy::DATA_FLAG_NONE));
67 } 67 }
68 return status; 68 return status;
69 } 69 }
70 virtual void OnDataReceived(const char* buffer, int bytes) { 70 virtual void OnDataReceived(const char* buffer, int bytes) {
71 received_data_ += std::string(buffer, bytes); 71 received_data_ += std::string(buffer, bytes);
72 } 72 }
73 virtual void OnDataSent(int length) { 73 virtual void OnDataSent(int length) {
74 data_sent_ += length; 74 data_sent_ += length;
75 } 75 }
76 virtual void OnClose(int status) { 76 virtual void OnClose(int status) {
77 closed_ = true; 77 closed_ = true;
78 CompletionCallback* callback = callback_; 78 CompletionCallback* callback = callback_;
79 callback_ = NULL; 79 callback_ = NULL;
80 callback->Run(OK); 80 callback->Run(OK);
81 } 81 }
82 virtual void set_chunk_callback(net::ChunkCallback *) {}
82 83
83 bool send_headers_completed() const { return send_headers_completed_; } 84 bool send_headers_completed() const { return send_headers_completed_; }
84 const linked_ptr<spdy::SpdyHeaderBlock>& response() const { 85 const linked_ptr<spdy::SpdyHeaderBlock>& response() const {
85 return response_; 86 return response_;
86 } 87 }
87 const std::string& received_data() const { return received_data_; } 88 const std::string& received_data() const { return received_data_; }
88 int data_sent() const { return data_sent_; } 89 int data_sent() const { return data_sent_; }
89 bool closed() const { return closed_; } 90 bool closed() const { return closed_; }
90 91
91 private: 92 private:
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 stream->OnHeaders(headers); 272 stream->OnHeaders(headers);
272 273
273 stream->set_response_received(); 274 stream->set_response_received();
274 EXPECT_TRUE(stream->response_received()); 275 EXPECT_TRUE(stream->response_received());
275 EXPECT_TRUE(stream->HasUrl()); 276 EXPECT_TRUE(stream->HasUrl());
276 EXPECT_EQ(kStreamUrl, stream->GetUrl().spec()); 277 EXPECT_EQ(kStreamUrl, stream->GetUrl().spec());
277 } 278 }
278 279
279 280
280 } // namespace net 281 } // namespace net
OLDNEW
« net/spdy/spdy_stream.h ('K') | « net/spdy/spdy_stream.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698