| 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 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_MOCK_HTTP_FETCHER_H__ | 5 #ifndef CHROMEOS_PLATFORM_UPDATE_ENGINE_MOCK_HTTP_FETCHER_H__ |
| 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_MOCK_HTTP_FETCHER_H__ | 6 #define CHROMEOS_PLATFORM_UPDATE_ENGINE_MOCK_HTTP_FETCHER_H__ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 #include <glib.h> | 9 #include <glib.h> |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 // The data passed in here is copied and then passed to the delegate after | 27 // The data passed in here is copied and then passed to the delegate after |
| 28 // the transfer begins. | 28 // the transfer begins. |
| 29 MockHttpFetcher(const char* data, size_t size) | 29 MockHttpFetcher(const char* data, size_t size) |
| 30 : sent_size_(0), timeout_source_(NULL), timout_tag_(0), paused_(false) { | 30 : sent_size_(0), timeout_source_(NULL), timout_tag_(0), paused_(false) { |
| 31 data_.insert(data_.end(), data, data + size); | 31 data_.insert(data_.end(), data, data + size); |
| 32 } | 32 } |
| 33 | 33 |
| 34 // Cleans up all internal state. Does not notify delegate | 34 // Cleans up all internal state. Does not notify delegate |
| 35 ~MockHttpFetcher(); | 35 ~MockHttpFetcher(); |
| 36 | 36 |
| 37 // Ignores this. |
| 38 virtual void SetOffset(off_t offset) {} |
| 39 |
| 37 // Begins the transfer if it hasn't already begun. | 40 // Begins the transfer if it hasn't already begun. |
| 38 virtual void BeginTransfer(const std::string& url); | 41 virtual void BeginTransfer(const std::string& url); |
| 39 | 42 |
| 40 // If the transfer is in progress, aborts the transfer early. | 43 // If the transfer is in progress, aborts the transfer early. |
| 41 // The transfer cannot be resumed. | 44 // The transfer cannot be resumed. |
| 42 virtual void TerminateTransfer(); | 45 virtual void TerminateTransfer(); |
| 43 | 46 |
| 44 // Suspend the mock transfer. | 47 // Suspend the mock transfer. |
| 45 virtual void Pause(); | 48 virtual void Pause(); |
| 46 | 49 |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 | 87 |
| 85 // True iff the fetcher is paused. | 88 // True iff the fetcher is paused. |
| 86 bool paused_; | 89 bool paused_; |
| 87 | 90 |
| 88 DISALLOW_COPY_AND_ASSIGN(MockHttpFetcher); | 91 DISALLOW_COPY_AND_ASSIGN(MockHttpFetcher); |
| 89 }; | 92 }; |
| 90 | 93 |
| 91 } // namespace chromeos_update_engine | 94 } // namespace chromeos_update_engine |
| 92 | 95 |
| 93 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_MOCK_HTTP_FETCHER_H__ | 96 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_MOCK_HTTP_FETCHER_H__ |
| OLD | NEW |