| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/offline_page_utils.h" | 5 #include "chrome/browser/android/offline_pages/offline_page_utils.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 128 const base::FilePath& file_path) {} | 128 const base::FilePath& file_path) {} |
| 129 | 129 |
| 130 void OfflinePageUtilsTest::CreateOfflinePages() { | 130 void OfflinePageUtilsTest::CreateOfflinePages() { |
| 131 OfflinePageModel* model = | 131 OfflinePageModel* model = |
| 132 OfflinePageModelFactory::GetForBrowserContext(profile()); | 132 OfflinePageModelFactory::GetForBrowserContext(profile()); |
| 133 | 133 |
| 134 // Create page 1. | 134 // Create page 1. |
| 135 std::unique_ptr<OfflinePageTestArchiver> archiver(BuildArchiver( | 135 std::unique_ptr<OfflinePageTestArchiver> archiver(BuildArchiver( |
| 136 kTestPage1Url, base::FilePath(FILE_PATH_LITERAL("page1.mhtml")))); | 136 kTestPage1Url, base::FilePath(FILE_PATH_LITERAL("page1.mhtml")))); |
| 137 offline_pages::ClientId client_id; | 137 offline_pages::ClientId client_id; |
| 138 client_id.name_space = BOOKMARK_NAMESPACE; | 138 client_id.name_space = kBookmarkNamespace; |
| 139 client_id.id = kTestPage1ClientId; | 139 client_id.id = kTestPage1ClientId; |
| 140 model->SavePage( | 140 model->SavePage( |
| 141 kTestPage1Url, client_id, std::move(archiver), | 141 kTestPage1Url, client_id, std::move(archiver), |
| 142 base::Bind(&OfflinePageUtilsTest::OnSavePageDone, AsWeakPtr())); | 142 base::Bind(&OfflinePageUtilsTest::OnSavePageDone, AsWeakPtr())); |
| 143 RunUntilIdle(); | 143 RunUntilIdle(); |
| 144 int64_t offline1 = offline_id(); | 144 int64_t offline1 = offline_id(); |
| 145 | 145 |
| 146 client_id.id = kTestPage2ClientId; | 146 client_id.id = kTestPage2ClientId; |
| 147 // Create page 2. | 147 // Create page 2. |
| 148 archiver = BuildArchiver(kTestPage2Url, | 148 archiver = BuildArchiver(kTestPage2Url, |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 TEST_F(OfflinePageUtilsTest, HasOfflinePageForOnlineURL) { | 224 TEST_F(OfflinePageUtilsTest, HasOfflinePageForOnlineURL) { |
| 225 EXPECT_TRUE( | 225 EXPECT_TRUE( |
| 226 OfflinePageUtils::HasOfflinePageForOnlineURL(profile(), kTestPage1Url)); | 226 OfflinePageUtils::HasOfflinePageForOnlineURL(profile(), kTestPage1Url)); |
| 227 EXPECT_TRUE( | 227 EXPECT_TRUE( |
| 228 OfflinePageUtils::HasOfflinePageForOnlineURL(profile(), kTestPage2Url)); | 228 OfflinePageUtils::HasOfflinePageForOnlineURL(profile(), kTestPage2Url)); |
| 229 EXPECT_FALSE( | 229 EXPECT_FALSE( |
| 230 OfflinePageUtils::HasOfflinePageForOnlineURL(profile(), kTestPage3Url)); | 230 OfflinePageUtils::HasOfflinePageForOnlineURL(profile(), kTestPage3Url)); |
| 231 } | 231 } |
| 232 | 232 |
| 233 } // namespace offline_pages | 233 } // namespace offline_pages |
| OLD | NEW |