| 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 27 matching lines...) Expand all Loading... |
| 38 virtual bool OnSendHeadersComplete(int status) { return true; } | 38 virtual bool OnSendHeadersComplete(int status) { return true; } |
| 39 | 39 |
| 40 virtual int OnSendBody() { | 40 virtual int OnSendBody() { |
| 41 return ERR_UNEXPECTED; | 41 return ERR_UNEXPECTED; |
| 42 } | 42 } |
| 43 | 43 |
| 44 virtual int OnSendBodyComplete(int /*status*/, bool* /*eof*/) { | 44 virtual int OnSendBodyComplete(int /*status*/, bool* /*eof*/) { |
| 45 return ERR_UNEXPECTED; | 45 return ERR_UNEXPECTED; |
| 46 } | 46 } |
| 47 | 47 |
| 48 virtual int OnSendChunkedBody() { |
| 49 return ERR_UNEXPECTED; |
| 50 } |
| 51 |
| 52 virtual int OnSendChunkedBodyComplete(int /*status*/, bool* /*eof*/) { |
| 53 return ERR_UNEXPECTED; |
| 54 } |
| 55 |
| 48 virtual int OnResponseReceived(const SpdyHeaderBlock& response, | 56 virtual int OnResponseReceived(const SpdyHeaderBlock& response, |
| 49 base::Time response_time, | 57 base::Time response_time, |
| 50 int status) { | 58 int status) { |
| 51 return status; | 59 return status; |
| 52 } | 60 } |
| 53 | 61 |
| 54 virtual void OnDataReceived(const char* buffer, int bytes) { | 62 virtual void OnDataReceived(const char* buffer, int bytes) { |
| 55 } | 63 } |
| 56 | 64 |
| 57 virtual void OnDataSent(int length) { | 65 virtual void OnDataSent(int length) { |
| 58 } | 66 } |
| 59 | 67 |
| 60 virtual void OnClose(int status) { | 68 virtual void OnClose(int status) { |
| 61 CompletionCallback callback = callback_; | 69 CompletionCallback callback = callback_; |
| 62 callback_.Reset(); | 70 callback_.Reset(); |
| 63 callback.Run(OK); | 71 callback.Run(OK); |
| 64 } | 72 } |
| 65 | 73 |
| 66 virtual void set_chunk_callback(net::ChunkCallback *) {} | 74 virtual void set_chunk_callback(net::ChunkCallback *) {} |
| 67 | 75 |
| 76 virtual bool IsRequestBodyChunked() { return false; } |
| 77 |
| 68 private: | 78 private: |
| 69 CompletionCallback callback_; | 79 CompletionCallback callback_; |
| 70 }; | 80 }; |
| 71 | 81 |
| 72 // Test the SpdyIOBuffer class. | 82 // Test the SpdyIOBuffer class. |
| 73 TEST_F(SpdySessionSpdy2Test, SpdyIOBuffer) { | 83 TEST_F(SpdySessionSpdy2Test, SpdyIOBuffer) { |
| 74 std::priority_queue<SpdyIOBuffer> queue_; | 84 std::priority_queue<SpdyIOBuffer> queue_; |
| 75 const size_t kQueueSize = 100; | 85 const size_t kQueueSize = 100; |
| 76 | 86 |
| 77 // Insert items with random priority and increasing buffer size. | 87 // Insert items with random priority and increasing buffer size. |
| (...skipping 1125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1203 EXPECT_EQ(3u, spdy_stream2->stream_id()); | 1213 EXPECT_EQ(3u, spdy_stream2->stream_id()); |
| 1204 | 1214 |
| 1205 spdy_stream1->Cancel(); | 1215 spdy_stream1->Cancel(); |
| 1206 spdy_stream1 = NULL; | 1216 spdy_stream1 = NULL; |
| 1207 | 1217 |
| 1208 spdy_stream2->Cancel(); | 1218 spdy_stream2->Cancel(); |
| 1209 spdy_stream2 = NULL; | 1219 spdy_stream2 = NULL; |
| 1210 } | 1220 } |
| 1211 | 1221 |
| 1212 } // namespace net | 1222 } // namespace net |
| OLD | NEW |