| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 private: | 56 private: |
| 57 int result_; | 57 int result_; |
| 58 bool have_result_; | 58 bool have_result_; |
| 59 bool waiting_for_result_; | 59 bool waiting_for_result_; |
| 60 | 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(CloseResultWaiter); | 61 DISALLOW_COPY_AND_ASSIGN(CloseResultWaiter); |
| 62 }; | 62 }; |
| 63 | 63 |
| 64 class MockHttpStream : public HttpStream { | 64 class MockHttpStream : public HttpStream { |
| 65 public: | 65 public: |
| 66 MockHttpStream(CloseResultWaiter* result_waiter) | 66 explicit MockHttpStream(CloseResultWaiter* result_waiter) |
| 67 : result_waiter_(result_waiter), | 67 : result_waiter_(result_waiter), |
| 68 buf_len_(0), | 68 buf_len_(0), |
| 69 closed_(false), | 69 closed_(false), |
| 70 stall_reads_forever_(false), | 70 stall_reads_forever_(false), |
| 71 num_chunks_(0), | 71 num_chunks_(0), |
| 72 is_sync_(false), | 72 is_sync_(false), |
| 73 is_last_chunk_zero_size_(false), | 73 is_last_chunk_zero_size_(false), |
| 74 is_complete_(false), | 74 is_complete_(false), |
| 75 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {} | 75 ALLOW_THIS_IN_INITIALIZER_LIST(weak_factory_(this)) {} |
| 76 virtual ~MockHttpStream() {} | 76 virtual ~MockHttpStream() {} |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 | 313 |
| 314 TEST_F(HttpResponseBodyDrainerTest, StartWithNothingToDo) { | 314 TEST_F(HttpResponseBodyDrainerTest, StartWithNothingToDo) { |
| 315 mock_stream_->set_num_chunks(0); | 315 mock_stream_->set_num_chunks(0); |
| 316 drainer_->StartWithSize(session_, 0); | 316 drainer_->StartWithSize(session_, 0); |
| 317 EXPECT_FALSE(result_waiter_.WaitForResult()); | 317 EXPECT_FALSE(result_waiter_.WaitForResult()); |
| 318 } | 318 } |
| 319 | 319 |
| 320 } // namespace | 320 } // namespace |
| 321 | 321 |
| 322 } // namespace net | 322 } // namespace net |
| OLD | NEW |