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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include <cstring> | 9 #include <cstring> |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 base::MessageLoop::current()->Run(); | 49 base::MessageLoop::current()->Run(); |
50 waiting_for_result_ = false; | 50 waiting_for_result_ = false; |
51 } | 51 } |
52 return result_; | 52 return result_; |
53 } | 53 } |
54 | 54 |
55 void set_result(bool result) { | 55 void set_result(bool result) { |
56 result_ = result; | 56 result_ = result; |
57 have_result_ = true; | 57 have_result_ = true; |
58 if (waiting_for_result_) | 58 if (waiting_for_result_) |
59 base::MessageLoop::current()->Quit(); | 59 base::MessageLoop::current()->QuitWhenIdle(); |
60 } | 60 } |
61 | 61 |
62 private: | 62 private: |
63 int result_; | 63 int result_; |
64 bool have_result_; | 64 bool have_result_; |
65 bool waiting_for_result_; | 65 bool waiting_for_result_; |
66 | 66 |
67 DISALLOW_COPY_AND_ASSIGN(CloseResultWaiter); | 67 DISALLOW_COPY_AND_ASSIGN(CloseResultWaiter); |
68 }; | 68 }; |
69 | 69 |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
303 too_many_chunks += 1; // Now it's too large. | 303 too_many_chunks += 1; // Now it's too large. |
304 | 304 |
305 mock_stream_->set_num_chunks(too_many_chunks); | 305 mock_stream_->set_num_chunks(too_many_chunks); |
306 drainer_->Start(session_.get()); | 306 drainer_->Start(session_.get()); |
307 EXPECT_TRUE(result_waiter_.WaitForResult()); | 307 EXPECT_TRUE(result_waiter_.WaitForResult()); |
308 } | 308 } |
309 | 309 |
310 } // namespace | 310 } // namespace |
311 | 311 |
312 } // namespace net | 312 } // namespace net |
OLD | NEW |