| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_STUB_H_ | 5 #ifndef COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_STUB_H_ |
| 6 #define COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_STUB_H_ | 6 #define COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_STUB_H_ |
| 7 | 7 |
| 8 #include "components/offline_pages/core/background/offliner.h" | 8 #include "components/offline_pages/core/background/offliner.h" |
| 9 | 9 |
| 10 namespace offline_pages { | 10 namespace offline_pages { |
| 11 | 11 |
| 12 // Test class stubbing out the functionality of Offliner. | 12 // Test class stubbing out the functionality of Offliner. |
| 13 // It is only used for test support. | 13 // It is only used for test support. |
| 14 class OfflinerStub : public Offliner { | 14 class OfflinerStub : public Offliner { |
| 15 public: | 15 public: |
| 16 OfflinerStub(); | 16 OfflinerStub(); |
| 17 ~OfflinerStub() override; | 17 ~OfflinerStub() override; |
| 18 | 18 |
| 19 bool LoadAndSave(const SavePageRequest& request, | 19 bool LoadAndSave(const SavePageRequest& request, |
| 20 const CompletionCallback& callback) override; | 20 const CompletionCallback& completion_callback, |
| 21 const ProgressCallback& progress_callback) override; |
| 21 | 22 |
| 22 void Cancel(const CancelCallback& callback) override; | 23 void Cancel(const CancelCallback& callback) override; |
| 23 | 24 |
| 24 void disable_loading() { disable_loading_ = true; } | 25 void disable_loading() { disable_loading_ = true; } |
| 25 | 26 |
| 26 void enable_callback(bool enable) { enable_callback_ = enable; } | 27 void enable_callback(bool enable) { enable_callback_ = enable; } |
| 27 | 28 |
| 28 bool cancel_called() { return cancel_called_; } | 29 bool cancel_called() { return cancel_called_; } |
| 29 | 30 |
| 30 void reset_cancel_called() { cancel_called_ = false; } | 31 void reset_cancel_called() { cancel_called_ = false; } |
| 31 | 32 |
| 32 bool HandleTimeout(const SavePageRequest& request) override; | 33 bool HandleTimeout(const SavePageRequest& request) override; |
| 33 | 34 |
| 34 void enable_snapshot_on_last_retry() { snapshot_on_last_retry_ = true; } | 35 void enable_snapshot_on_last_retry() { snapshot_on_last_retry_ = true; } |
| 35 | 36 |
| 36 private: | 37 private: |
| 37 CompletionCallback callback_; | 38 CompletionCallback completion_callback_; |
| 39 ProgressCallback progress_callback_; |
| 38 bool disable_loading_; | 40 bool disable_loading_; |
| 39 bool enable_callback_; | 41 bool enable_callback_; |
| 40 bool cancel_called_; | 42 bool cancel_called_; |
| 41 bool snapshot_on_last_retry_; | 43 bool snapshot_on_last_retry_; |
| 42 }; | 44 }; |
| 43 | 45 |
| 44 } // namespace offline_pages | 46 } // namespace offline_pages |
| 45 | 47 |
| 46 #endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_STUB_H_ | 48 #endif // COMPONENTS_OFFLINE_PAGES_CORE_BACKGROUND_OFFLINER_STUB_H_ |
| OLD | NEW |