| 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 "chromeos/obsolete_logging.h" | 10 #include "chromeos/obsolete_logging.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // loop and when that's called, another chunk is sent down. | 22 // loop and when that's called, another chunk is sent down. |
| 23 const size_t kMockHttpFetcherChunkSize(65536); | 23 const size_t kMockHttpFetcherChunkSize(65536); |
| 24 | 24 |
| 25 class MockHttpFetcher : public HttpFetcher { | 25 class MockHttpFetcher : public HttpFetcher { |
| 26 public: | 26 public: |
| 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 LOG(INFO) << "timeout_source_ = " << (int)timeout_source_; | |
| 33 } | 32 } |
| 34 | 33 |
| 35 // Cleans up all internal state. Does not notify delegate | 34 // Cleans up all internal state. Does not notify delegate |
| 36 ~MockHttpFetcher(); | 35 ~MockHttpFetcher(); |
| 37 | 36 |
| 38 // Begins the transfer if it hasn't already begun. | 37 // Begins the transfer if it hasn't already begun. |
| 39 virtual void BeginTransfer(const std::string& url); | 38 virtual void BeginTransfer(const std::string& url); |
| 40 | 39 |
| 41 // If the transfer is in progress, aborts the transfer early. | 40 // If the transfer is in progress, aborts the transfer early. |
| 42 // The transfer cannot be resumed. | 41 // The transfer cannot be resumed. |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 84 |
| 86 // True iff the fetcher is paused. | 85 // True iff the fetcher is paused. |
| 87 bool paused_; | 86 bool paused_; |
| 88 | 87 |
| 89 DISALLOW_COPY_AND_ASSIGN(MockHttpFetcher); | 88 DISALLOW_COPY_AND_ASSIGN(MockHttpFetcher); |
| 90 }; | 89 }; |
| 91 | 90 |
| 92 } // namespace chromeos_update_engine | 91 } // namespace chromeos_update_engine |
| 93 | 92 |
| 94 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_MOCK_HTTP_FETCHER_H__ | 93 #endif // CHROMEOS_PLATFORM_UPDATE_ENGINE_MOCK_HTTP_FETCHER_H__ |
| OLD | NEW |