| 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(scoped_ptr<SpdyBuffer> buffer) { | 40 int ClosingDelegate::OnDataReceived(const char* data, int length) { |
| 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(scoped_ptr<SpdyBuffer> buffer) { | 80 int StreamDelegateBase::OnDataReceived(const char* buffer, int bytes) { |
| 81 if (buffer) { | 81 received_data_ += std::string(buffer, bytes); |
| 82 received_data_ += std::string(buffer->GetRemainingData(), | |
| 83 buffer->GetRemainingSize()); | |
| 84 } | |
| 85 return OK; | 82 return OK; |
| 86 } | 83 } |
| 87 | 84 |
| 88 void StreamDelegateBase::OnDataSent(size_t bytes_sent) { | 85 void StreamDelegateBase::OnDataSent(size_t bytes_sent) { |
| 89 data_sent_ += bytes_sent; | 86 data_sent_ += bytes_sent; |
| 90 } | 87 } |
| 91 | 88 |
| 92 void StreamDelegateBase::OnClose(int status) { | 89 void StreamDelegateBase::OnClose(int status) { |
| 93 if (!stream_) | 90 if (!stream_) |
| 94 return; | 91 return; |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 // Go back to OnSendBody() to send the remaining data. | 168 // Go back to OnSendBody() to send the remaining data. |
| 172 return MORE_DATA_TO_SEND; | 169 return MORE_DATA_TO_SEND; |
| 173 } | 170 } |
| 174 | 171 |
| 175 return NO_MORE_DATA_TO_SEND; | 172 return NO_MORE_DATA_TO_SEND; |
| 176 } | 173 } |
| 177 | 174 |
| 178 } // namespace test | 175 } // namespace test |
| 179 | 176 |
| 180 } // namespace net | 177 } // namespace net |
| OLD | NEW |