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