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_session.h" | 5 #include "net/spdy/spdy_session.h" |
6 | 6 |
7 #include "net/base/host_cache.h" | 7 #include "net/base/host_cache.h" |
8 #include "net/base/ip_endpoint.h" | 8 #include "net/base/ip_endpoint.h" |
9 #include "net/base/net_log_unittest.h" | 9 #include "net/base/net_log_unittest.h" |
10 #include "net/spdy/spdy_io_buffer.h" | 10 #include "net/spdy/spdy_io_buffer.h" |
(...skipping 25 matching lines...) Expand all Loading... |
36 return OK; | 36 return OK; |
37 } | 37 } |
38 virtual int OnSendBodyComplete(int status, bool* eof) OVERRIDE { | 38 virtual int OnSendBodyComplete(int status, bool* eof) OVERRIDE { |
39 return OK; | 39 return OK; |
40 } | 40 } |
41 virtual int OnResponseReceived(const SpdyHeaderBlock& response, | 41 virtual int OnResponseReceived(const SpdyHeaderBlock& response, |
42 base::Time response_time, | 42 base::Time response_time, |
43 int status) OVERRIDE { | 43 int status) OVERRIDE { |
44 return OK; | 44 return OK; |
45 } | 45 } |
| 46 virtual void OnHeadersSent() OVERRIDE {} |
46 virtual void OnDataReceived(const char* data, int length) OVERRIDE {} | 47 virtual void OnDataReceived(const char* data, int length) OVERRIDE {} |
47 virtual void OnDataSent(int length) OVERRIDE {} | 48 virtual void OnDataSent(int length) OVERRIDE {} |
48 virtual void OnClose(int status) OVERRIDE { | 49 virtual void OnClose(int status) OVERRIDE { |
49 stream_->Close(); | 50 stream_->Close(); |
50 } | 51 } |
51 private: | 52 private: |
52 SpdyStream* stream_; | 53 SpdyStream* stream_; |
53 }; | 54 }; |
54 | 55 |
55 | 56 |
56 class TestSpdyStreamDelegate : public net::SpdyStream::Delegate { | 57 class TestSpdyStreamDelegate : public SpdyStream::Delegate { |
57 public: | 58 public: |
58 explicit TestSpdyStreamDelegate(const CompletionCallback& callback) | 59 explicit TestSpdyStreamDelegate(const CompletionCallback& callback) |
59 : callback_(callback) {} | 60 : callback_(callback) {} |
60 virtual ~TestSpdyStreamDelegate() {} | 61 virtual ~TestSpdyStreamDelegate() {} |
61 | 62 |
62 virtual bool OnSendHeadersComplete(int status) { return true; } | 63 virtual bool OnSendHeadersComplete(int status) OVERRIDE { return true; } |
63 | 64 |
64 virtual int OnSendBody() { | 65 virtual int OnSendBody() OVERRIDE { |
65 return ERR_UNEXPECTED; | 66 return ERR_UNEXPECTED; |
66 } | 67 } |
67 | 68 |
68 virtual int OnSendBodyComplete(int /*status*/, bool* /*eof*/) { | 69 virtual int OnSendBodyComplete(int /*status*/, bool* /*eof*/) OVERRIDE { |
69 return ERR_UNEXPECTED; | 70 return ERR_UNEXPECTED; |
70 } | 71 } |
71 | 72 |
72 virtual int OnResponseReceived(const SpdyHeaderBlock& response, | 73 virtual int OnResponseReceived(const SpdyHeaderBlock& response, |
73 base::Time response_time, | 74 base::Time response_time, |
74 int status) { | 75 int status) OVERRIDE { |
75 return status; | 76 return status; |
76 } | 77 } |
77 | 78 |
78 virtual void OnDataReceived(const char* buffer, int bytes) { | 79 virtual void OnHeadersSent() OVERRIDE {} |
79 } | |
80 | 80 |
81 virtual void OnDataSent(int length) { | 81 virtual void OnDataReceived(const char* buffer, int bytes) OVERRIDE {} |
82 } | |
83 | 82 |
84 virtual void OnClose(int status) { | 83 virtual void OnDataSent(int length) OVERRIDE {} |
| 84 |
| 85 virtual void OnClose(int status) OVERRIDE { |
85 CompletionCallback callback = callback_; | 86 CompletionCallback callback = callback_; |
86 callback_.Reset(); | 87 callback_.Reset(); |
87 callback.Run(OK); | 88 callback.Run(OK); |
88 } | 89 } |
89 | 90 |
90 private: | 91 private: |
91 CompletionCallback callback_; | 92 CompletionCallback callback_; |
92 }; | 93 }; |
93 | 94 |
94 } // namespace | 95 } // namespace |
(...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1681 session->CloseSessionOnError(ERR_ABORTED, true, ""); | 1682 session->CloseSessionOnError(ERR_ABORTED, true, ""); |
1682 | 1683 |
1683 EXPECT_TRUE(spdy_stream1->closed()); | 1684 EXPECT_TRUE(spdy_stream1->closed()); |
1684 EXPECT_TRUE(spdy_stream2->closed()); | 1685 EXPECT_TRUE(spdy_stream2->closed()); |
1685 | 1686 |
1686 spdy_stream1 = NULL; | 1687 spdy_stream1 = NULL; |
1687 spdy_stream2 = NULL; | 1688 spdy_stream2 = NULL; |
1688 } | 1689 } |
1689 | 1690 |
1690 } // namespace net | 1691 } // namespace net |
OLD | NEW |