| 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 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 | 156 |
| 157 // Make a copy of local paths of the two pages stored in the model. | 157 // Make a copy of local paths of the two pages stored in the model. |
| 158 offline_url_page_1_ = | 158 offline_url_page_1_ = |
| 159 model->MaybeGetPageByOfflineId(offline1)->GetOfflineURL(); | 159 model->MaybeGetPageByOfflineId(offline1)->GetOfflineURL(); |
| 160 offline_url_page_2_ = | 160 offline_url_page_2_ = |
| 161 model->MaybeGetPageByOfflineId(offline2)->GetOfflineURL(); | 161 model->MaybeGetPageByOfflineId(offline2)->GetOfflineURL(); |
| 162 // Create a file path that is not associated with any offline page. | 162 // Create a file path that is not associated with any offline page. |
| 163 offline_url_missing_ = net::FilePathToFileURL( | 163 offline_url_missing_ = net::FilePathToFileURL( |
| 164 profile() | 164 profile() |
| 165 ->GetPath() | 165 ->GetPath() |
| 166 .Append(chrome::kOfflinePageArchviesDirname) | 166 .Append(chrome::kOfflinePageArchivesDirname) |
| 167 .Append(FILE_PATH_LITERAL("missing_file.mhtml"))); | 167 .Append(FILE_PATH_LITERAL("missing_file.mhtml"))); |
| 168 } | 168 } |
| 169 | 169 |
| 170 std::unique_ptr<OfflinePageTestArchiver> OfflinePageUtilsTest::BuildArchiver( | 170 std::unique_ptr<OfflinePageTestArchiver> OfflinePageUtilsTest::BuildArchiver( |
| 171 const GURL& url, | 171 const GURL& url, |
| 172 const base::FilePath& file_name) { | 172 const base::FilePath& file_name) { |
| 173 std::unique_ptr<OfflinePageTestArchiver> archiver(new OfflinePageTestArchiver( | 173 std::unique_ptr<OfflinePageTestArchiver> archiver(new OfflinePageTestArchiver( |
| 174 this, url, OfflinePageArchiver::ArchiverResult::SUCCESSFULLY_CREATED, | 174 this, url, OfflinePageArchiver::ArchiverResult::SUCCESSFULLY_CREATED, |
| 175 kTestFileSize, base::ThreadTaskRunnerHandle::Get())); | 175 kTestFileSize, base::ThreadTaskRunnerHandle::Get())); |
| 176 archiver->set_filename(file_name); | 176 archiver->set_filename(file_name); |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 TEST_F(OfflinePageUtilsTest, HasOfflinePageForOnlineURL) { | 220 TEST_F(OfflinePageUtilsTest, HasOfflinePageForOnlineURL) { |
| 221 EXPECT_TRUE( | 221 EXPECT_TRUE( |
| 222 OfflinePageUtils::HasOfflinePageForOnlineURL(profile(), kTestPage1Url)); | 222 OfflinePageUtils::HasOfflinePageForOnlineURL(profile(), kTestPage1Url)); |
| 223 EXPECT_TRUE( | 223 EXPECT_TRUE( |
| 224 OfflinePageUtils::HasOfflinePageForOnlineURL(profile(), kTestPage2Url)); | 224 OfflinePageUtils::HasOfflinePageForOnlineURL(profile(), kTestPage2Url)); |
| 225 EXPECT_FALSE( | 225 EXPECT_FALSE( |
| 226 OfflinePageUtils::HasOfflinePageForOnlineURL(profile(), kTestPage3Url)); | 226 OfflinePageUtils::HasOfflinePageForOnlineURL(profile(), kTestPage3Url)); |
| 227 } | 227 } |
| 228 | 228 |
| 229 } // namespace offline_pages | 229 } // namespace offline_pages |
| OLD | NEW |