Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(543)

Side by Side Diff: net/http/http_response_body_drainer_unittest.cc

Issue 8591037: Implement Drain() on HttpPipelinedStream. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More tests Created 9 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 TestOldCompletionCallback callback; 248 TestOldCompletionCallback callback;
249 int too_many_chunks = 249 int too_many_chunks =
250 HttpResponseBodyDrainer::kDrainBodyBufferSize / kMagicChunkSize; 250 HttpResponseBodyDrainer::kDrainBodyBufferSize / kMagicChunkSize;
251 too_many_chunks += 1; // Now it's too large. 251 too_many_chunks += 1; // Now it's too large.
252 252
253 mock_stream_->set_num_chunks(too_many_chunks); 253 mock_stream_->set_num_chunks(too_many_chunks);
254 drainer_->Start(session_); 254 drainer_->Start(session_);
255 EXPECT_TRUE(result_waiter_.WaitForResult()); 255 EXPECT_TRUE(result_waiter_.WaitForResult());
256 } 256 }
257 257
258 TEST_F(HttpResponseBodyDrainerTest, StartBodyTooLarge) {
259 TestOldCompletionCallback callback;
260 int too_many_chunks =
261 HttpResponseBodyDrainer::kDrainBodyBufferSize / kMagicChunkSize;
262 too_many_chunks += 1; // Now it's too large.
263
264 mock_stream_->set_num_chunks(0);
265 drainer_->StartWithSize(session_, too_many_chunks * kMagicChunkSize);
266 EXPECT_TRUE(result_waiter_.WaitForResult());
267 }
268
269 TEST_F(HttpResponseBodyDrainerTest, StartWithNothingToDo) {
270 TestOldCompletionCallback callback;
271 mock_stream_->set_num_chunks(0);
272 drainer_->StartWithSize(session_, 0);
273 EXPECT_FALSE(result_waiter_.WaitForResult());
274 }
275
258 } // namespace 276 } // namespace
259 277
260 } // namespace net 278 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698