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 "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 14 matching lines...) Expand all Loading... |
25 virtual ~ClosingDelegate(); | 25 virtual ~ClosingDelegate(); |
26 | 26 |
27 // SpdyStream::Delegate implementation. | 27 // SpdyStream::Delegate implementation. |
28 virtual SpdySendStatus OnSendHeadersComplete() OVERRIDE; | 28 virtual SpdySendStatus OnSendHeadersComplete() OVERRIDE; |
29 virtual int OnSendBody() OVERRIDE; | 29 virtual int OnSendBody() OVERRIDE; |
30 virtual SpdySendStatus OnSendBodyComplete(size_t bytes_sent) OVERRIDE; | 30 virtual SpdySendStatus OnSendBodyComplete(size_t bytes_sent) OVERRIDE; |
31 virtual int OnResponseReceived(const SpdyHeaderBlock& response, | 31 virtual int OnResponseReceived(const SpdyHeaderBlock& response, |
32 base::Time response_time, | 32 base::Time response_time, |
33 int status) OVERRIDE; | 33 int status) OVERRIDE; |
34 virtual void OnHeadersSent() OVERRIDE; | 34 virtual void OnHeadersSent() OVERRIDE; |
35 virtual int OnDataReceived(const char* data, int length) OVERRIDE; | 35 virtual int OnDataReceived(scoped_ptr<SpdyBuffer> buffer) OVERRIDE; |
36 virtual void OnDataSent(size_t bytes_sent) OVERRIDE; | 36 virtual void OnDataSent(size_t bytes_sent) OVERRIDE; |
37 virtual void OnClose(int status) OVERRIDE; | 37 virtual void OnClose(int status) OVERRIDE; |
38 | 38 |
39 private: | 39 private: |
40 scoped_refptr<SpdyStream> stream_; | 40 scoped_refptr<SpdyStream> stream_; |
41 }; | 41 }; |
42 | 42 |
43 // Base class with shared functionality for test delegate | 43 // Base class with shared functionality for test delegate |
44 // implementations below. | 44 // implementations below. |
45 class StreamDelegateBase : public SpdyStream::Delegate { | 45 class StreamDelegateBase : public SpdyStream::Delegate { |
46 public: | 46 public: |
47 explicit StreamDelegateBase(const scoped_refptr<SpdyStream>& stream); | 47 explicit StreamDelegateBase(const scoped_refptr<SpdyStream>& stream); |
48 virtual ~StreamDelegateBase(); | 48 virtual ~StreamDelegateBase(); |
49 | 49 |
50 virtual SpdySendStatus OnSendHeadersComplete() OVERRIDE; | 50 virtual SpdySendStatus OnSendHeadersComplete() OVERRIDE; |
51 virtual int OnSendBody() = 0; | 51 virtual int OnSendBody() = 0; |
52 virtual SpdySendStatus OnSendBodyComplete(size_t bytes_sent) = 0; | 52 virtual SpdySendStatus OnSendBodyComplete(size_t bytes_sent) = 0; |
53 virtual int OnResponseReceived(const SpdyHeaderBlock& response, | 53 virtual int OnResponseReceived(const SpdyHeaderBlock& response, |
54 base::Time response_time, | 54 base::Time response_time, |
55 int status) OVERRIDE; | 55 int status) OVERRIDE; |
56 virtual void OnHeadersSent() OVERRIDE; | 56 virtual void OnHeadersSent() OVERRIDE; |
57 virtual int OnDataReceived(const char* buffer, int bytes) OVERRIDE; | 57 virtual int OnDataReceived(scoped_ptr<SpdyBuffer> buffer) OVERRIDE; |
58 virtual void OnDataSent(size_t bytes_sent) OVERRIDE; | 58 virtual void OnDataSent(size_t bytes_sent) OVERRIDE; |
59 virtual void OnClose(int status) OVERRIDE; | 59 virtual void OnClose(int status) 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 std::string GetResponseHeaderValue(const std::string& name) const; | 65 std::string GetResponseHeaderValue(const std::string& name) const; |
66 bool send_headers_completed() const { return send_headers_completed_; } | 66 bool send_headers_completed() const { return send_headers_completed_; } |
67 const std::string& received_data() const { return received_data_; } | 67 const std::string& received_data() const { return received_data_; } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 private: | 116 private: |
117 scoped_refptr<DrainableIOBuffer> buf_; | 117 scoped_refptr<DrainableIOBuffer> buf_; |
118 int body_data_sent_; | 118 int body_data_sent_; |
119 }; | 119 }; |
120 | 120 |
121 } // namespace test | 121 } // namespace test |
122 | 122 |
123 } // namespace net | 123 } // namespace net |
124 | 124 |
125 #endif // NET_SPDY_SPDY_STREAM_TEST_UTIL_H_ | 125 #endif // NET_SPDY_SPDY_STREAM_TEST_UTIL_H_ |
OLD | NEW |