| 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 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 is_complete_ = true; | 167 is_complete_ = true; |
| 168 callback->Run(kMagicChunkSize); | 168 callback->Run(kMagicChunkSize); |
| 169 } | 169 } |
| 170 | 170 |
| 171 class HttpResponseBodyDrainerTest : public testing::Test { | 171 class HttpResponseBodyDrainerTest : public testing::Test { |
| 172 protected: | 172 protected: |
| 173 HttpResponseBodyDrainerTest() | 173 HttpResponseBodyDrainerTest() |
| 174 : session_(new HttpNetworkSession( | 174 : session_(new HttpNetworkSession( |
| 175 NULL, | 175 NULL, |
| 176 NULL, | 176 NULL, |
| 177 NULL /* ssl_host_info_factory */, |
| 177 ProxyService::CreateDirect(), | 178 ProxyService::CreateDirect(), |
| 178 NULL, | 179 NULL, |
| 179 new SSLConfigServiceDefaults, | 180 new SSLConfigServiceDefaults, |
| 180 new SpdySessionPool(NULL), | 181 new SpdySessionPool(NULL), |
| 181 NULL, | 182 NULL, |
| 182 NULL, | 183 NULL, |
| 183 NULL)), | 184 NULL)), |
| 184 mock_stream_(new MockHttpStream(&result_waiter_)), | 185 mock_stream_(new MockHttpStream(&result_waiter_)), |
| 185 drainer_(new HttpResponseBodyDrainer(mock_stream_)) {} | 186 drainer_(new HttpResponseBodyDrainer(mock_stream_)) {} |
| 186 ~HttpResponseBodyDrainerTest() {} | 187 ~HttpResponseBodyDrainerTest() {} |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 too_many_chunks += 1; // Now it's too large. | 232 too_many_chunks += 1; // Now it's too large. |
| 232 | 233 |
| 233 mock_stream_->set_num_chunks(too_many_chunks); | 234 mock_stream_->set_num_chunks(too_many_chunks); |
| 234 drainer_->Start(session_); | 235 drainer_->Start(session_); |
| 235 EXPECT_TRUE(result_waiter_.WaitForResult()); | 236 EXPECT_TRUE(result_waiter_.WaitForResult()); |
| 236 } | 237 } |
| 237 | 238 |
| 238 } // namespace | 239 } // namespace |
| 239 | 240 |
| 240 } // namespace net | 241 } // namespace net |
| OLD | NEW |