| 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 <cstddef> | 7 #include <cstddef> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 int StreamDelegateBase::WaitForClose() { | 85 int StreamDelegateBase::WaitForClose() { |
| 86 int result = callback_.WaitForResult(); | 86 int result = callback_.WaitForResult(); |
| 87 EXPECT_TRUE(!stream_.get()); | 87 EXPECT_TRUE(!stream_.get()); |
| 88 return result; | 88 return result; |
| 89 } | 89 } |
| 90 | 90 |
| 91 std::string StreamDelegateBase::TakeReceivedData() { | 91 std::string StreamDelegateBase::TakeReceivedData() { |
| 92 size_t len = received_data_queue_.GetTotalSize(); | 92 size_t len = received_data_queue_.GetTotalSize(); |
| 93 std::string received_data(len, '\0'); | 93 std::string received_data(len, '\0'); |
| 94 if (len > 0) { | 94 if (len > 0) { |
| 95 EXPECT_EQ( | 95 EXPECT_EQ(len, received_data_queue_.Dequeue( |
| 96 len, | 96 base::string_as_array(&received_data), len)); |
| 97 received_data_queue_.Dequeue(string_as_array(&received_data), len)); | |
| 98 } | 97 } |
| 99 return received_data; | 98 return received_data; |
| 100 } | 99 } |
| 101 | 100 |
| 102 std::string StreamDelegateBase::GetResponseHeaderValue( | 101 std::string StreamDelegateBase::GetResponseHeaderValue( |
| 103 const std::string& name) const { | 102 const std::string& name) const { |
| 104 SpdyHeaderBlock::const_iterator it = response_headers_.find(name); | 103 SpdyHeaderBlock::const_iterator it = response_headers_.find(name); |
| 105 return (it == response_headers_.end()) ? std::string() | 104 return (it == response_headers_.end()) ? std::string() |
| 106 : it->second.as_string(); | 105 : it->second.as_string(); |
| 107 } | 106 } |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 158 SpdyResponseHeadersStatus | 157 SpdyResponseHeadersStatus |
| 159 StreamDelegateCloseOnHeaders::OnResponseHeadersUpdated( | 158 StreamDelegateCloseOnHeaders::OnResponseHeadersUpdated( |
| 160 const SpdyHeaderBlock& response_headers) { | 159 const SpdyHeaderBlock& response_headers) { |
| 161 stream()->Cancel(); | 160 stream()->Cancel(); |
| 162 return RESPONSE_HEADERS_ARE_COMPLETE; | 161 return RESPONSE_HEADERS_ARE_COMPLETE; |
| 163 } | 162 } |
| 164 | 163 |
| 165 } // namespace test | 164 } // namespace test |
| 166 | 165 |
| 167 } // namespace net | 166 } // namespace net |
| OLD | NEW |