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 15 matching lines...) Expand all Loading... |
26 | 26 |
27 SpdyResponseHeadersStatus ClosingDelegate::OnResponseHeadersUpdated( | 27 SpdyResponseHeadersStatus ClosingDelegate::OnResponseHeadersUpdated( |
28 const SpdyHeaderBlock& response_headers) { | 28 const SpdyHeaderBlock& response_headers) { |
29 return RESPONSE_HEADERS_ARE_COMPLETE; | 29 return RESPONSE_HEADERS_ARE_COMPLETE; |
30 } | 30 } |
31 | 31 |
32 void ClosingDelegate::OnDataReceived(scoped_ptr<SpdyBuffer> buffer) {} | 32 void ClosingDelegate::OnDataReceived(scoped_ptr<SpdyBuffer> buffer) {} |
33 | 33 |
34 void ClosingDelegate::OnDataSent() {} | 34 void ClosingDelegate::OnDataSent() {} |
35 | 35 |
| 36 void ClosingDelegate::OnTrailers(const SpdyHeaderBlock& trailers) {} |
| 37 |
36 void ClosingDelegate::OnClose(int status) { | 38 void ClosingDelegate::OnClose(int status) { |
37 DCHECK(stream_); | 39 DCHECK(stream_); |
38 stream_->Close(); | 40 stream_->Close(); |
39 // The |stream_| may still be alive (if it is our delegate). | 41 // The |stream_| may still be alive (if it is our delegate). |
40 } | 42 } |
41 | 43 |
42 StreamDelegateBase::StreamDelegateBase( | 44 StreamDelegateBase::StreamDelegateBase( |
43 const base::WeakPtr<SpdyStream>& stream) | 45 const base::WeakPtr<SpdyStream>& stream) |
44 : stream_(stream), | 46 : stream_(stream), |
45 stream_id_(0), | 47 stream_id_(0), |
(...skipping 16 matching lines...) Expand all Loading... |
62 return RESPONSE_HEADERS_ARE_COMPLETE; | 64 return RESPONSE_HEADERS_ARE_COMPLETE; |
63 } | 65 } |
64 | 66 |
65 void StreamDelegateBase::OnDataReceived(scoped_ptr<SpdyBuffer> buffer) { | 67 void StreamDelegateBase::OnDataReceived(scoped_ptr<SpdyBuffer> buffer) { |
66 if (buffer) | 68 if (buffer) |
67 received_data_queue_.Enqueue(buffer.Pass()); | 69 received_data_queue_.Enqueue(buffer.Pass()); |
68 } | 70 } |
69 | 71 |
70 void StreamDelegateBase::OnDataSent() {} | 72 void StreamDelegateBase::OnDataSent() {} |
71 | 73 |
| 74 void StreamDelegateBase::OnTrailers(const SpdyHeaderBlock& trailers) {} |
| 75 |
72 void StreamDelegateBase::OnClose(int status) { | 76 void StreamDelegateBase::OnClose(int status) { |
73 if (!stream_.get()) | 77 if (!stream_.get()) |
74 return; | 78 return; |
75 stream_id_ = stream_->stream_id(); | 79 stream_id_ = stream_->stream_id(); |
76 stream_.reset(); | 80 stream_.reset(); |
77 callback_.callback().Run(status); | 81 callback_.callback().Run(status); |
78 } | 82 } |
79 | 83 |
80 int StreamDelegateBase::WaitForClose() { | 84 int StreamDelegateBase::WaitForClose() { |
81 int result = callback_.WaitForResult(); | 85 int result = callback_.WaitForResult(); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 SpdyResponseHeadersStatus | 156 SpdyResponseHeadersStatus |
153 StreamDelegateCloseOnHeaders::OnResponseHeadersUpdated( | 157 StreamDelegateCloseOnHeaders::OnResponseHeadersUpdated( |
154 const SpdyHeaderBlock& response_headers) { | 158 const SpdyHeaderBlock& response_headers) { |
155 stream()->Cancel(); | 159 stream()->Cancel(); |
156 return RESPONSE_HEADERS_ARE_COMPLETE; | 160 return RESPONSE_HEADERS_ARE_COMPLETE; |
157 } | 161 } |
158 | 162 |
159 } // namespace test | 163 } // namespace test |
160 | 164 |
161 } // namespace net | 165 } // namespace net |
OLD | NEW |