| 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 #ifndef NET_SPDY_SPDY_STREAM_TEST_UTIL_H_ | 5 #ifndef NET_SPDY_SPDY_STREAM_TEST_UTIL_H_ |
| 6 #define NET_SPDY_SPDY_STREAM_TEST_UTIL_H_ | 6 #define NET_SPDY_SPDY_STREAM_TEST_UTIL_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 void OnTrailers(const SpdyHeaderBlock& trailers) override; | 57 void OnTrailers(const SpdyHeaderBlock& trailers) override; |
| 58 void OnClose(int status) override; | 58 void OnClose(int status) override; |
| 59 NetLogSource source_dependency() const override; | 59 NetLogSource source_dependency() const override; |
| 60 | 60 |
| 61 // Waits for the stream to be closed and returns the status passed | 61 // Waits for the stream to be closed and returns the status passed |
| 62 // to OnClose(). | 62 // to OnClose(). |
| 63 int WaitForClose(); | 63 int WaitForClose(); |
| 64 | 64 |
| 65 // Drains all data from the underlying read queue and returns it as | 65 // Drains all data from the underlying read queue and returns it as |
| 66 // a string. | 66 // a string. |
| 67 std::string TakeReceivedData(); | 67 SpdyString TakeReceivedData(); |
| 68 | 68 |
| 69 // Returns whether or not the stream is closed. | 69 // Returns whether or not the stream is closed. |
| 70 bool StreamIsClosed() const { return !stream_.get(); } | 70 bool StreamIsClosed() const { return !stream_.get(); } |
| 71 | 71 |
| 72 // Returns the stream's ID. If called when the stream is closed, | 72 // Returns the stream's ID. If called when the stream is closed, |
| 73 // returns the stream's ID when it was open. | 73 // returns the stream's ID when it was open. |
| 74 SpdyStreamId stream_id() const { return stream_id_; } | 74 SpdyStreamId stream_id() const { return stream_id_; } |
| 75 | 75 |
| 76 std::string GetResponseHeaderValue(const std::string& name) const; | 76 SpdyString GetResponseHeaderValue(const SpdyString& name) const; |
| 77 bool send_headers_completed() const { return send_headers_completed_; } | 77 bool send_headers_completed() const { return send_headers_completed_; } |
| 78 | 78 |
| 79 protected: | 79 protected: |
| 80 const base::WeakPtr<SpdyStream>& stream() { return stream_; } | 80 const base::WeakPtr<SpdyStream>& stream() { return stream_; } |
| 81 | 81 |
| 82 private: | 82 private: |
| 83 base::WeakPtr<SpdyStream> stream_; | 83 base::WeakPtr<SpdyStream> stream_; |
| 84 SpdyStreamId stream_id_; | 84 SpdyStreamId stream_id_; |
| 85 TestCompletionCallback callback_; | 85 TestCompletionCallback callback_; |
| 86 bool send_headers_completed_; | 86 bool send_headers_completed_; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 ~StreamDelegateCloseOnHeaders() override; | 131 ~StreamDelegateCloseOnHeaders() override; |
| 132 | 132 |
| 133 void OnHeadersReceived(const SpdyHeaderBlock& response_headers) override; | 133 void OnHeadersReceived(const SpdyHeaderBlock& response_headers) override; |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 } // namespace test | 136 } // namespace test |
| 137 | 137 |
| 138 } // namespace net | 138 } // namespace net |
| 139 | 139 |
| 140 #endif // NET_SPDY_SPDY_STREAM_TEST_UTIL_H_ | 140 #endif // NET_SPDY_SPDY_STREAM_TEST_UTIL_H_ |
| OLD | NEW |