| 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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 }; | 97 }; |
| 98 | 98 |
| 99 // Mock OfflinePageModel for testing the SavePage calls. | 99 // Mock OfflinePageModel for testing the SavePage calls. |
| 100 class MockOfflinePageModel : public StubOfflinePageModel { | 100 class MockOfflinePageModel : public StubOfflinePageModel { |
| 101 public: | 101 public: |
| 102 MockOfflinePageModel() : mock_saving_(false) {} | 102 MockOfflinePageModel() : mock_saving_(false) {} |
| 103 ~MockOfflinePageModel() override {} | 103 ~MockOfflinePageModel() override {} |
| 104 | 104 |
| 105 void SavePage(const GURL& url, | 105 void SavePage(const GURL& url, |
| 106 const ClientId& client_id, | 106 const ClientId& client_id, |
| 107 int64_t proposed_offline_id, |
| 107 std::unique_ptr<OfflinePageArchiver> archiver, | 108 std::unique_ptr<OfflinePageArchiver> archiver, |
| 108 const SavePageCallback& callback) override { | 109 const SavePageCallback& callback) override { |
| 109 mock_saving_ = true; | 110 mock_saving_ = true; |
| 110 save_page_callback_ = callback; | 111 save_page_callback_ = callback; |
| 111 } | 112 } |
| 112 | 113 |
| 113 void CompleteSavingAsArchiveCreationFailed() { | 114 void CompleteSavingAsArchiveCreationFailed() { |
| 114 DCHECK(mock_saving_); | 115 DCHECK(mock_saving_); |
| 115 mock_saving_ = false; | 116 mock_saving_ = false; |
| 116 base::ThreadTaskRunnerHandle::Get()->PostTask( | 117 base::ThreadTaskRunnerHandle::Get()->PostTask( |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 365 EXPECT_FALSE(loader()->IsIdle()); | 366 EXPECT_FALSE(loader()->IsIdle()); |
| 366 | 367 |
| 367 offliner()->SetApplicationStateForTesting( | 368 offliner()->SetApplicationStateForTesting( |
| 368 base::android::APPLICATION_STATE_HAS_RUNNING_ACTIVITIES); | 369 base::android::APPLICATION_STATE_HAS_RUNNING_ACTIVITIES); |
| 369 | 370 |
| 370 // Loader still loading since not low-end device. | 371 // Loader still loading since not low-end device. |
| 371 EXPECT_FALSE(loader()->IsIdle()); | 372 EXPECT_FALSE(loader()->IsIdle()); |
| 372 } | 373 } |
| 373 | 374 |
| 374 } // namespace offline_pages | 375 } // namespace offline_pages |
| OLD | NEW |