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/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/bind.h" | 9 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 TEST_F(HttpResponseBodyDrainerTest, DrainBodyTooLarge) { | 298 TEST_F(HttpResponseBodyDrainerTest, DrainBodyTooLarge) { |
299 int too_many_chunks = | 299 int too_many_chunks = |
300 HttpResponseBodyDrainer::kDrainBodyBufferSize / kMagicChunkSize; | 300 HttpResponseBodyDrainer::kDrainBodyBufferSize / kMagicChunkSize; |
301 too_many_chunks += 1; // Now it's too large. | 301 too_many_chunks += 1; // Now it's too large. |
302 | 302 |
303 mock_stream_->set_num_chunks(too_many_chunks); | 303 mock_stream_->set_num_chunks(too_many_chunks); |
304 drainer_->Start(session_.get()); | 304 drainer_->Start(session_.get()); |
305 EXPECT_TRUE(result_waiter_.WaitForResult()); | 305 EXPECT_TRUE(result_waiter_.WaitForResult()); |
306 } | 306 } |
307 | 307 |
308 TEST_F(HttpResponseBodyDrainerTest, StartBodyTooLarge) { | |
309 int too_many_chunks = | |
310 HttpResponseBodyDrainer::kDrainBodyBufferSize / kMagicChunkSize; | |
311 too_many_chunks += 1; // Now it's too large. | |
312 | |
313 mock_stream_->set_num_chunks(0); | |
314 drainer_->StartWithSize(session_.get(), too_many_chunks * kMagicChunkSize); | |
315 EXPECT_TRUE(result_waiter_.WaitForResult()); | |
316 } | |
317 | |
318 TEST_F(HttpResponseBodyDrainerTest, StartWithNothingToDo) { | |
319 mock_stream_->set_num_chunks(0); | |
320 drainer_->StartWithSize(session_.get(), 0); | |
321 EXPECT_FALSE(result_waiter_.WaitForResult()); | |
322 } | |
323 | |
324 } // namespace | 308 } // namespace |
325 | 309 |
326 } // namespace net | 310 } // namespace net |
OLD | NEW |