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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 NetLogSource StreamDelegateBase::source_dependency() const { | 86 NetLogSource StreamDelegateBase::source_dependency() const { |
87 return NetLogSource(); | 87 return NetLogSource(); |
88 } | 88 } |
89 | 89 |
90 int StreamDelegateBase::WaitForClose() { | 90 int StreamDelegateBase::WaitForClose() { |
91 int result = callback_.WaitForResult(); | 91 int result = callback_.WaitForResult(); |
92 EXPECT_TRUE(!stream_.get()); | 92 EXPECT_TRUE(!stream_.get()); |
93 return result; | 93 return result; |
94 } | 94 } |
95 | 95 |
96 std::string StreamDelegateBase::TakeReceivedData() { | 96 SpdyString StreamDelegateBase::TakeReceivedData() { |
97 size_t len = received_data_queue_.GetTotalSize(); | 97 size_t len = received_data_queue_.GetTotalSize(); |
98 std::string received_data(len, '\0'); | 98 SpdyString received_data(len, '\0'); |
99 if (len > 0) { | 99 if (len > 0) { |
100 EXPECT_EQ(len, received_data_queue_.Dequeue( | 100 EXPECT_EQ(len, received_data_queue_.Dequeue( |
101 base::string_as_array(&received_data), len)); | 101 base::string_as_array(&received_data), len)); |
102 } | 102 } |
103 return received_data; | 103 return received_data; |
104 } | 104 } |
105 | 105 |
106 std::string StreamDelegateBase::GetResponseHeaderValue( | 106 SpdyString StreamDelegateBase::GetResponseHeaderValue( |
107 const std::string& name) const { | 107 const SpdyString& name) const { |
108 SpdyHeaderBlock::const_iterator it = response_headers_.find(name); | 108 SpdyHeaderBlock::const_iterator it = response_headers_.find(name); |
109 return (it == response_headers_.end()) ? std::string() | 109 return (it == response_headers_.end()) ? SpdyString() |
110 : it->second.as_string(); | 110 : it->second.as_string(); |
111 } | 111 } |
112 | 112 |
113 StreamDelegateDoNothing::StreamDelegateDoNothing( | 113 StreamDelegateDoNothing::StreamDelegateDoNothing( |
114 const base::WeakPtr<SpdyStream>& stream) | 114 const base::WeakPtr<SpdyStream>& stream) |
115 : StreamDelegateBase(stream) {} | 115 : StreamDelegateBase(stream) {} |
116 | 116 |
117 StreamDelegateDoNothing::~StreamDelegateDoNothing() { | 117 StreamDelegateDoNothing::~StreamDelegateDoNothing() { |
118 } | 118 } |
119 | 119 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 } | 156 } |
157 | 157 |
158 void StreamDelegateCloseOnHeaders::OnHeadersReceived( | 158 void StreamDelegateCloseOnHeaders::OnHeadersReceived( |
159 const SpdyHeaderBlock& response_headers) { | 159 const SpdyHeaderBlock& response_headers) { |
160 stream()->Cancel(); | 160 stream()->Cancel(); |
161 } | 161 } |
162 | 162 |
163 } // namespace test | 163 } // namespace test |
164 | 164 |
165 } // namespace net | 165 } // namespace net |
OLD | NEW |