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 17 matching lines...) Expand all Loading... |
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. | 37 // Ignores this. |
38 virtual void SetOffset(off_t offset) {} | 38 virtual void SetOffset(off_t offset) { |
| 39 sent_size_ = offset; |
| 40 if (delegate_) |
| 41 delegate_->SeekToOffset(offset); |
| 42 } |
39 | 43 |
40 // Begins the transfer if it hasn't already begun. | 44 // Begins the transfer if it hasn't already begun. |
41 virtual void BeginTransfer(const std::string& url); | 45 virtual void BeginTransfer(const std::string& url); |
42 | 46 |
43 // If the transfer is in progress, aborts the transfer early. | 47 // If the transfer is in progress, aborts the transfer early. |
44 // The transfer cannot be resumed. | 48 // The transfer cannot be resumed. |
45 virtual void TerminateTransfer(); | 49 virtual void TerminateTransfer(); |
46 | 50 |
47 // Suspend the mock transfer. | 51 // Suspend the mock transfer. |
48 virtual void Pause(); | 52 virtual void Pause(); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 91 |
88 // True iff the fetcher is paused. | 92 // True iff the fetcher is paused. |
89 bool paused_; | 93 bool paused_; |
90 | 94 |
91 DISALLOW_COPY_AND_ASSIGN(MockHttpFetcher); | 95 DISALLOW_COPY_AND_ASSIGN(MockHttpFetcher); |
92 }; | 96 }; |
93 | 97 |
94 } // namespace chromeos_update_engine | 98 } // namespace chromeos_update_engine |
95 | 99 |
96 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_MOCK_HTTP_FETCHER_H__ | 100 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_MOCK_HTTP_FETCHER_H__ |
OLD | NEW |