| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium OS Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium OS 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 "base/logging.h" | |
| 6 #include "update_engine/mock_http_fetcher.h" | 5 #include "update_engine/mock_http_fetcher.h" |
| 6 #include <algorithm> |
| 7 #include "chromeos/obsolete_logging.h" |
| 7 | 8 |
| 8 // This is a mac implementation of HttpFetcher which is useful for testing. | 9 // This is a mac implementation of HttpFetcher which is useful for testing. |
| 9 | 10 |
| 11 using std::min; |
| 12 |
| 10 namespace chromeos_update_engine { | 13 namespace chromeos_update_engine { |
| 11 | 14 |
| 12 MockHttpFetcher::~MockHttpFetcher() { | 15 MockHttpFetcher::~MockHttpFetcher() { |
| 13 CHECK(!timeout_source_) << "Call TerminateTransfer() before dtor."; | 16 CHECK(!timeout_source_) << "Call TerminateTransfer() before dtor."; |
| 14 } | 17 } |
| 15 | 18 |
| 16 void MockHttpFetcher::BeginTransfer(const std::string& url) { | 19 void MockHttpFetcher::BeginTransfer(const std::string& url) { |
| 17 if (sent_size_ < data_.size()) | 20 if (sent_size_ < data_.size()) |
| 18 SendData(true); | 21 SendData(true); |
| 19 } | 22 } |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 | 93 |
| 91 void MockHttpFetcher::Unpause() { | 94 void MockHttpFetcher::Unpause() { |
| 92 CHECK(paused_) << "You must pause before unpause."; | 95 CHECK(paused_) << "You must pause before unpause."; |
| 93 paused_ = false; | 96 paused_ = false; |
| 94 if (sent_size_ < data_.size()) { | 97 if (sent_size_ < data_.size()) { |
| 95 SendData(false); | 98 SendData(false); |
| 96 } | 99 } |
| 97 } | 100 } |
| 98 | 101 |
| 99 } // namespace chromeos_update_engine | 102 } // namespace chromeos_update_engine |
| OLD | NEW |