| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_transaction_test_util.h" | 5 #include "net/http/http_transaction_test_util.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 200 } else { | 200 } else { |
| 201 content_.append(read_buf_->data(), result); | 201 content_.append(read_buf_->data(), result); |
| 202 Read(); | 202 Read(); |
| 203 } | 203 } |
| 204 } | 204 } |
| 205 | 205 |
| 206 void TestTransactionConsumer::DidFinish(int result) { | 206 void TestTransactionConsumer::DidFinish(int result) { |
| 207 state_ = DONE; | 207 state_ = DONE; |
| 208 error_ = result; | 208 error_ = result; |
| 209 if (--quit_counter_ == 0) | 209 if (--quit_counter_ == 0) |
| 210 base::MessageLoop::current()->Quit(); | 210 base::MessageLoop::current()->QuitWhenIdle(); |
| 211 } | 211 } |
| 212 | 212 |
| 213 void TestTransactionConsumer::Read() { | 213 void TestTransactionConsumer::Read() { |
| 214 state_ = READING; | 214 state_ = READING; |
| 215 read_buf_ = new IOBuffer(1024); | 215 read_buf_ = new IOBuffer(1024); |
| 216 int result = trans_->Read(read_buf_.get(), | 216 int result = trans_->Read(read_buf_.get(), |
| 217 1024, | 217 1024, |
| 218 base::Bind(&TestTransactionConsumer::OnIOComplete, | 218 base::Bind(&TestTransactionConsumer::OnIOComplete, |
| 219 base::Unretained(this))); | 219 base::Unretained(this))); |
| 220 if (result != ERR_IO_PENDING) | 220 if (result != ERR_IO_PENDING) |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 content.append(buf->data(), rv); | 561 content.append(buf->data(), rv); |
| 562 else if (rv < 0) | 562 else if (rv < 0) |
| 563 return rv; | 563 return rv; |
| 564 } while (rv > 0); | 564 } while (rv > 0); |
| 565 | 565 |
| 566 result->swap(content); | 566 result->swap(content); |
| 567 return OK; | 567 return OK; |
| 568 } | 568 } |
| 569 | 569 |
| 570 } // namespace net | 570 } // namespace net |
| OLD | NEW |