OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/http/http_response_body_drainer.h" | 5 #include "net/http/http_response_body_drainer.h" |
6 | 6 |
7 #include <cstring> | 7 #include <cstring> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
164 if (!num_chunks_) | 164 if (!num_chunks_) |
165 is_complete_ = true; | 165 is_complete_ = true; |
166 callback->Run(kMagicChunkSize); | 166 callback->Run(kMagicChunkSize); |
167 } | 167 } |
168 | 168 |
169 class HttpResponseBodyDrainerTest : public testing::Test { | 169 class HttpResponseBodyDrainerTest : public testing::Test { |
170 protected: | 170 protected: |
171 HttpResponseBodyDrainerTest() | 171 HttpResponseBodyDrainerTest() |
172 : session_(new HttpNetworkSession( | 172 : session_(new HttpNetworkSession( |
173 NULL, | 173 NULL, |
| 174 NULL, |
174 ProxyService::CreateDirect(), | 175 ProxyService::CreateDirect(), |
175 NULL, | 176 NULL, |
176 new SSLConfigServiceDefaults, | 177 new SSLConfigServiceDefaults, |
177 new SpdySessionPool(NULL), | 178 new SpdySessionPool(NULL), |
178 NULL, | 179 NULL, |
179 NULL, | 180 NULL, |
180 NULL)), | 181 NULL)), |
181 mock_stream_(new MockHttpStream(&result_waiter_)), | 182 mock_stream_(new MockHttpStream(&result_waiter_)), |
182 drainer_(new HttpResponseBodyDrainer(mock_stream_)) {} | 183 drainer_(new HttpResponseBodyDrainer(mock_stream_)) {} |
183 ~HttpResponseBodyDrainerTest() {} | 184 ~HttpResponseBodyDrainerTest() {} |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 too_many_chunks += 1; // Now it's too large. | 229 too_many_chunks += 1; // Now it's too large. |
229 | 230 |
230 mock_stream_->set_num_chunks(too_many_chunks); | 231 mock_stream_->set_num_chunks(too_many_chunks); |
231 drainer_->Start(session_); | 232 drainer_->Start(session_); |
232 EXPECT_TRUE(result_waiter_.WaitForResult()); | 233 EXPECT_TRUE(result_waiter_.WaitForResult()); |
233 } | 234 } |
234 | 235 |
235 } // namespace | 236 } // namespace |
236 | 237 |
237 } // namespace net | 238 } // namespace net |
OLD | NEW |