| 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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 } | 129 } |
| 130 | 130 |
| 131 void OfflinePageUtilsTest::RunUntilIdle() { | 131 void OfflinePageUtilsTest::RunUntilIdle() { |
| 132 base::RunLoop().RunUntilIdle(); | 132 base::RunLoop().RunUntilIdle(); |
| 133 } | 133 } |
| 134 | 134 |
| 135 void OfflinePageUtilsTest::SavePage( | 135 void OfflinePageUtilsTest::SavePage( |
| 136 const GURL& url, | 136 const GURL& url, |
| 137 const ClientId& client_id, | 137 const ClientId& client_id, |
| 138 std::unique_ptr<OfflinePageArchiver> archiver) { | 138 std::unique_ptr<OfflinePageArchiver> archiver) { |
| 139 std::vector<std::string> signal_data; |
| 139 OfflinePageModel::SavePageParams save_page_params; | 140 OfflinePageModel::SavePageParams save_page_params; |
| 140 save_page_params.url = url; | 141 save_page_params.url = url; |
| 141 save_page_params.client_id = client_id; | 142 save_page_params.client_id = client_id; |
| 142 OfflinePageModelFactory::GetForBrowserContext(profile())->SavePage( | 143 OfflinePageModelFactory::GetForBrowserContext(profile())->SavePage( |
| 143 save_page_params, | 144 save_page_params, |
| 144 std::move(archiver), | 145 std::move(archiver), |
| 146 signal_data, |
| 145 base::Bind(&OfflinePageUtilsTest::OnSavePageDone, AsWeakPtr())); | 147 base::Bind(&OfflinePageUtilsTest::OnSavePageDone, AsWeakPtr())); |
| 146 RunUntilIdle(); | 148 RunUntilIdle(); |
| 147 } | 149 } |
| 148 | 150 |
| 149 void OfflinePageUtilsTest::OnSavePageDone(SavePageResult result, | 151 void OfflinePageUtilsTest::OnSavePageDone(SavePageResult result, |
| 150 int64_t offline_id) { | 152 int64_t offline_id) { |
| 151 offline_id_ = offline_id; | 153 offline_id_ = offline_id; |
| 152 } | 154 } |
| 153 | 155 |
| 154 void OfflinePageUtilsTest::OnExpirePageDone(bool success) { | 156 void OfflinePageUtilsTest::OnExpirePageDone(bool success) { |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 GURL("http://example.com/"), GURL("http://example.com/#test"))); | 256 GURL("http://example.com/"), GURL("http://example.com/#test"))); |
| 255 EXPECT_TRUE(OfflinePageUtils::EqualsIgnoringFragment( | 257 EXPECT_TRUE(OfflinePageUtils::EqualsIgnoringFragment( |
| 256 GURL("http://example.com/#test"), GURL("http://example.com/"))); | 258 GURL("http://example.com/#test"), GURL("http://example.com/"))); |
| 257 EXPECT_TRUE(OfflinePageUtils::EqualsIgnoringFragment( | 259 EXPECT_TRUE(OfflinePageUtils::EqualsIgnoringFragment( |
| 258 GURL("http://example.com/#test"), GURL("http://example.com/#test2"))); | 260 GURL("http://example.com/#test"), GURL("http://example.com/#test2"))); |
| 259 EXPECT_FALSE(OfflinePageUtils::EqualsIgnoringFragment( | 261 EXPECT_FALSE(OfflinePageUtils::EqualsIgnoringFragment( |
| 260 GURL("http://example.com/"), GURL("http://test.com/#test"))); | 262 GURL("http://example.com/"), GURL("http://test.com/#test"))); |
| 261 } | 263 } |
| 262 | 264 |
| 263 } // namespace offline_pages | 265 } // namespace offline_pages |
| OLD | NEW |