| 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 18 matching lines...) Expand all Loading... |
| 29 // Mock Loader for testing the Offliner calls. | 29 // Mock Loader for testing the Offliner calls. |
| 30 class MockPrerenderingLoader : public PrerenderingLoader { | 30 class MockPrerenderingLoader : public PrerenderingLoader { |
| 31 public: | 31 public: |
| 32 explicit MockPrerenderingLoader(content::BrowserContext* browser_context) | 32 explicit MockPrerenderingLoader(content::BrowserContext* browser_context) |
| 33 : PrerenderingLoader(browser_context), | 33 : PrerenderingLoader(browser_context), |
| 34 can_prerender_(true), | 34 can_prerender_(true), |
| 35 mock_loading_(false), | 35 mock_loading_(false), |
| 36 mock_loaded_(false) {} | 36 mock_loaded_(false) {} |
| 37 ~MockPrerenderingLoader() override {} | 37 ~MockPrerenderingLoader() override {} |
| 38 | 38 |
| 39 bool LoadPage(const GURL& url, const LoadPageCallback& callback) override { | 39 bool LoadPage(const GURL& url, LoadPageCallback callback) override { |
| 40 mock_loading_ = true; | 40 mock_loading_ = true; |
| 41 load_page_callback_ = callback; | 41 load_page_callback_ = callback; |
| 42 return mock_loading_; | 42 return mock_loading_; |
| 43 } | 43 } |
| 44 | 44 |
| 45 void StopLoading() override { | 45 void StopLoading() override { |
| 46 mock_loading_ = false; | 46 mock_loading_ = false; |
| 47 mock_loaded_ = false; | 47 mock_loaded_ = false; |
| 48 } | 48 } |
| 49 | 49 |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 322 loader()->CompleteLoadingAsCanceled(); | 322 loader()->CompleteLoadingAsCanceled(); |
| 323 PumpLoop(); | 323 PumpLoop(); |
| 324 EXPECT_TRUE(completion_callback_called()); | 324 EXPECT_TRUE(completion_callback_called()); |
| 325 EXPECT_EQ(Offliner::RequestStatus::CANCELED, request_status()); | 325 EXPECT_EQ(Offliner::RequestStatus::CANCELED, request_status()); |
| 326 EXPECT_FALSE(loader()->IsLoaded()); | 326 EXPECT_FALSE(loader()->IsLoaded()); |
| 327 // Note: save still in progress since it does not support canceling. | 327 // Note: save still in progress since it does not support canceling. |
| 328 EXPECT_TRUE(SaveInProgress()); | 328 EXPECT_TRUE(SaveInProgress()); |
| 329 } | 329 } |
| 330 | 330 |
| 331 } // namespace offline_pages | 331 } // namespace offline_pages |
| OLD | NEW |