| 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_stream_test_util.h" | 5 #include "net/spdy/spdy_stream_test_util.h" |
| 6 | 6 |
| 7 #include "net/base/completion_callback.h" | 7 #include "net/base/completion_callback.h" |
| 8 #include "net/spdy/spdy_stream.h" | 8 #include "net/spdy/spdy_stream.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 } | 30 } |
| 31 | 31 |
| 32 int ClosingDelegate::OnResponseReceived(const SpdyHeaderBlock& response, | 32 int ClosingDelegate::OnResponseReceived(const SpdyHeaderBlock& response, |
| 33 base::Time response_time, | 33 base::Time response_time, |
| 34 int status) { | 34 int status) { |
| 35 return OK; | 35 return OK; |
| 36 } | 36 } |
| 37 | 37 |
| 38 void ClosingDelegate::OnHeadersSent() {} | 38 void ClosingDelegate::OnHeadersSent() {} |
| 39 | 39 |
| 40 int ClosingDelegate::OnDataReceived(const char* data, int length) { | 40 int ClosingDelegate::OnDataReceived(scoped_ptr<SpdyBuffer> buffer) { |
| 41 return OK; | 41 return OK; |
| 42 } | 42 } |
| 43 | 43 |
| 44 void ClosingDelegate::OnDataSent(size_t bytes_sent) {} | 44 void ClosingDelegate::OnDataSent(size_t bytes_sent) {} |
| 45 | 45 |
| 46 void ClosingDelegate::OnClose(int status) { | 46 void ClosingDelegate::OnClose(int status) { |
| 47 if (stream_) | 47 if (stream_) |
| 48 stream_->Close(); | 48 stream_->Close(); |
| 49 stream_ = NULL; | 49 stream_ = NULL; |
| 50 } | 50 } |
| (...skipping 19 matching lines...) Expand all Loading... |
| 70 int status) { | 70 int status) { |
| 71 EXPECT_TRUE(send_headers_completed_); | 71 EXPECT_TRUE(send_headers_completed_); |
| 72 response_ = response; | 72 response_ = response; |
| 73 return status; | 73 return status; |
| 74 } | 74 } |
| 75 | 75 |
| 76 void StreamDelegateBase::OnHeadersSent() { | 76 void StreamDelegateBase::OnHeadersSent() { |
| 77 headers_sent_++; | 77 headers_sent_++; |
| 78 } | 78 } |
| 79 | 79 |
| 80 int StreamDelegateBase::OnDataReceived(const char* buffer, int bytes) { | 80 int StreamDelegateBase::OnDataReceived(scoped_ptr<SpdyBuffer> buffer) { |
| 81 received_data_ += std::string(buffer, bytes); | 81 if (buffer) { |
| 82 received_data_ += std::string(buffer->GetRemainingData(), |
| 83 buffer->GetRemainingSize()); |
| 84 } |
| 82 return OK; | 85 return OK; |
| 83 } | 86 } |
| 84 | 87 |
| 85 void StreamDelegateBase::OnDataSent(size_t bytes_sent) { | 88 void StreamDelegateBase::OnDataSent(size_t bytes_sent) { |
| 86 data_sent_ += bytes_sent; | 89 data_sent_ += bytes_sent; |
| 87 } | 90 } |
| 88 | 91 |
| 89 void StreamDelegateBase::OnClose(int status) { | 92 void StreamDelegateBase::OnClose(int status) { |
| 90 if (!stream_) | 93 if (!stream_) |
| 91 return; | 94 return; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 // Go back to OnSendBody() to send the remaining data. | 171 // Go back to OnSendBody() to send the remaining data. |
| 169 return MORE_DATA_TO_SEND; | 172 return MORE_DATA_TO_SEND; |
| 170 } | 173 } |
| 171 | 174 |
| 172 return NO_MORE_DATA_TO_SEND; | 175 return NO_MORE_DATA_TO_SEND; |
| 173 } | 176 } |
| 174 | 177 |
| 175 } // namespace test | 178 } // namespace test |
| 176 | 179 |
| 177 } // namespace net | 180 } // namespace net |
| OLD | NEW |