| 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 int OnDataReceived(const char* data, int length) OVERRIDE { | 47 virtual int OnDataReceived(const char* data, int length) OVERRIDE { |
| 47 return OK; | 48 return OK; |
| 48 } | 49 } |
| 49 virtual void OnDataSent(int length) OVERRIDE {} | 50 virtual void OnDataSent(int length) OVERRIDE {} |
| 50 virtual void OnClose(int status) OVERRIDE { | 51 virtual void OnClose(int status) OVERRIDE { |
| 51 stream_->Close(); | 52 stream_->Close(); |
| 52 } | 53 } |
| 53 private: | 54 private: |
| 54 SpdyStream* stream_; | 55 SpdyStream* stream_; |
| 55 }; | 56 }; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 67 private: | 68 private: |
| 68 SpdyTestStateHelper spdy_state_; | 69 SpdyTestStateHelper spdy_state_; |
| 69 }; | 70 }; |
| 70 | 71 |
| 71 class TestSpdyStreamDelegate : public net::SpdyStream::Delegate { | 72 class TestSpdyStreamDelegate : public net::SpdyStream::Delegate { |
| 72 public: | 73 public: |
| 73 explicit TestSpdyStreamDelegate(const CompletionCallback& callback) | 74 explicit TestSpdyStreamDelegate(const CompletionCallback& callback) |
| 74 : callback_(callback) {} | 75 : callback_(callback) {} |
| 75 virtual ~TestSpdyStreamDelegate() {} | 76 virtual ~TestSpdyStreamDelegate() {} |
| 76 | 77 |
| 77 virtual bool OnSendHeadersComplete(int status) { return true; } | 78 virtual bool OnSendHeadersComplete(int status) OVERRIDE { return true; } |
| 78 | 79 |
| 79 virtual int OnSendBody() { | 80 virtual int OnSendBody() OVERRIDE { |
| 80 return ERR_UNEXPECTED; | 81 return ERR_UNEXPECTED; |
| 81 } | 82 } |
| 82 | 83 |
| 83 virtual int OnSendBodyComplete(int /*status*/, bool* /*eof*/) { | 84 virtual int OnSendBodyComplete(int /*status*/, bool* /*eof*/) OVERRIDE { |
| 84 return ERR_UNEXPECTED; | 85 return ERR_UNEXPECTED; |
| 85 } | 86 } |
| 86 | 87 |
| 87 virtual int OnResponseReceived(const SpdyHeaderBlock& response, | 88 virtual int OnResponseReceived(const SpdyHeaderBlock& response, |
| 88 base::Time response_time, | 89 base::Time response_time, |
| 89 int status) { | 90 int status) OVERRIDE { |
| 90 return status; | 91 return status; |
| 91 } | 92 } |
| 92 | 93 |
| 93 virtual int OnDataReceived(const char* buffer, int bytes) { | 94 virtual void OnHeadersSent() OVERRIDE {} |
| 95 |
| 96 virtual int OnDataReceived(const char* buffer, int bytes) OVERRIDE { |
| 94 return OK; | 97 return OK; |
| 95 } | 98 } |
| 96 | 99 |
| 97 virtual void OnDataSent(int length) { | 100 virtual void OnDataSent(int length) OVERRIDE {} |
| 98 } | |
| 99 | 101 |
| 100 virtual void OnClose(int status) { | 102 virtual void OnClose(int status) OVERRIDE { |
| 101 CompletionCallback callback = callback_; | 103 CompletionCallback callback = callback_; |
| 102 callback_.Reset(); | 104 callback_.Reset(); |
| 103 callback.Run(OK); | 105 callback.Run(OK); |
| 104 } | 106 } |
| 105 | 107 |
| 106 private: | 108 private: |
| 107 CompletionCallback callback_; | 109 CompletionCallback callback_; |
| 108 }; | 110 }; |
| 109 | 111 |
| 110 // Test the SpdyIOBuffer class. | 112 // Test the SpdyIOBuffer class. |
| (...skipping 1403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1514 session->CloseSessionOnError(ERR_ABORTED, true, ""); | 1516 session->CloseSessionOnError(ERR_ABORTED, true, ""); |
| 1515 | 1517 |
| 1516 EXPECT_TRUE(spdy_stream1->closed()); | 1518 EXPECT_TRUE(spdy_stream1->closed()); |
| 1517 EXPECT_TRUE(spdy_stream2->closed()); | 1519 EXPECT_TRUE(spdy_stream2->closed()); |
| 1518 | 1520 |
| 1519 spdy_stream1 = NULL; | 1521 spdy_stream1 = NULL; |
| 1520 spdy_stream2 = NULL; | 1522 spdy_stream2 = NULL; |
| 1521 } | 1523 } |
| 1522 | 1524 |
| 1523 } // namespace net | 1525 } // namespace net |
| OLD | NEW |