OLD | NEW |
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 <cstddef> | 7 #include <cstddef> |
8 | 8 |
9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
10 #include "net/base/completion_callback.h" | 10 #include "net/base/completion_callback.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 | 122 |
123 int StreamDelegateSendImmediate::OnResponseHeadersReceived( | 123 int StreamDelegateSendImmediate::OnResponseHeadersReceived( |
124 const SpdyHeaderBlock& response, | 124 const SpdyHeaderBlock& response, |
125 base::Time response_time, | 125 base::Time response_time, |
126 int status) { | 126 int status) { |
127 status = | 127 status = |
128 StreamDelegateBase::OnResponseHeadersReceived( | 128 StreamDelegateBase::OnResponseHeadersReceived( |
129 response, response_time, status); | 129 response, response_time, status); |
130 if (data_.data()) { | 130 if (data_.data()) { |
131 scoped_refptr<StringIOBuffer> buf(new StringIOBuffer(data_.as_string())); | 131 scoped_refptr<StringIOBuffer> buf(new StringIOBuffer(data_.as_string())); |
132 stream()->SendData(buf, buf->size(), MORE_DATA_TO_SEND); | 132 stream()->SendData(buf.get(), buf->size(), MORE_DATA_TO_SEND); |
133 } | 133 } |
134 return status; | 134 return status; |
135 } | 135 } |
136 | 136 |
137 StreamDelegateWithBody::StreamDelegateWithBody( | 137 StreamDelegateWithBody::StreamDelegateWithBody( |
138 const base::WeakPtr<SpdyStream>& stream, | 138 const base::WeakPtr<SpdyStream>& stream, |
139 base::StringPiece data) | 139 base::StringPiece data) |
140 : StreamDelegateBase(stream), | 140 : StreamDelegateBase(stream), |
141 buf_(new StringIOBuffer(data.as_string())) {} | 141 buf_(new StringIOBuffer(data.as_string())) {} |
142 | 142 |
143 StreamDelegateWithBody::~StreamDelegateWithBody() { | 143 StreamDelegateWithBody::~StreamDelegateWithBody() { |
144 } | 144 } |
145 | 145 |
146 void StreamDelegateWithBody::OnRequestHeadersSent() { | 146 void StreamDelegateWithBody::OnRequestHeadersSent() { |
147 StreamDelegateBase::OnRequestHeadersSent(); | 147 StreamDelegateBase::OnRequestHeadersSent(); |
148 stream()->SendData(buf_.get(), buf_->size(), NO_MORE_DATA_TO_SEND); | 148 stream()->SendData(buf_.get(), buf_->size(), NO_MORE_DATA_TO_SEND); |
149 } | 149 } |
150 | 150 |
151 } // namespace test | 151 } // namespace test |
152 | 152 |
153 } // namespace net | 153 } // namespace net |
OLD | NEW |