| 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 #include "chrome/browser/android/offline_pages/prerendering_offliner.h" | 5 #include "chrome/browser/android/offline_pages/prerendering_offliner.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 }; | 100 }; |
| 101 | 101 |
| 102 // Mock OfflinePageModel for testing the SavePage calls. | 102 // Mock OfflinePageModel for testing the SavePage calls. |
| 103 class MockOfflinePageModel : public StubOfflinePageModel { | 103 class MockOfflinePageModel : public StubOfflinePageModel { |
| 104 public: | 104 public: |
| 105 MockOfflinePageModel() : mock_saving_(false) {} | 105 MockOfflinePageModel() : mock_saving_(false) {} |
| 106 ~MockOfflinePageModel() override {} | 106 ~MockOfflinePageModel() override {} |
| 107 | 107 |
| 108 void SavePage(const SavePageParams& save_page_params, | 108 void SavePage(const SavePageParams& save_page_params, |
| 109 std::unique_ptr<OfflinePageArchiver> archiver, | 109 std::unique_ptr<OfflinePageArchiver> archiver, |
| 110 const std::vector<std::string>& signal_data, |
| 110 const SavePageCallback& callback) override { | 111 const SavePageCallback& callback) override { |
| 111 mock_saving_ = true; | 112 mock_saving_ = true; |
| 112 save_page_callback_ = callback; | 113 save_page_callback_ = callback; |
| 113 } | 114 } |
| 114 | 115 |
| 115 void CompleteSavingAsArchiveCreationFailed() { | 116 void CompleteSavingAsArchiveCreationFailed() { |
| 116 DCHECK(mock_saving_); | 117 DCHECK(mock_saving_); |
| 117 mock_saving_ = false; | 118 mock_saving_ = false; |
| 118 base::ThreadTaskRunnerHandle::Get()->PostTask( | 119 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| 119 FROM_HERE, base::Bind(save_page_callback_, | 120 FROM_HERE, base::Bind(save_page_callback_, |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 393 EXPECT_FALSE(loader()->IsIdle()); | 394 EXPECT_FALSE(loader()->IsIdle()); |
| 394 | 395 |
| 395 offliner()->SetApplicationStateForTesting( | 396 offliner()->SetApplicationStateForTesting( |
| 396 base::android::APPLICATION_STATE_HAS_RUNNING_ACTIVITIES); | 397 base::android::APPLICATION_STATE_HAS_RUNNING_ACTIVITIES); |
| 397 | 398 |
| 398 // Loader still loading since not low-end device. | 399 // Loader still loading since not low-end device. |
| 399 EXPECT_FALSE(loader()->IsIdle()); | 400 EXPECT_FALSE(loader()->IsIdle()); |
| 400 } | 401 } |
| 401 | 402 |
| 402 } // namespace offline_pages | 403 } // namespace offline_pages |
| OLD | NEW |