Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(410)

Side by Side Diff: chrome/browser/android/offline_pages/offline_page_utils_unittest.cc

Issue 2713013002: Track original URL when downloading a redirected page (Closed)
Patch Set: A little update Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 archiver = BuildArchiver(kTestPage2Url, 179 archiver = BuildArchiver(kTestPage2Url,
180 base::FilePath(FILE_PATH_LITERAL("page2.mhtml"))); 180 base::FilePath(FILE_PATH_LITERAL("page2.mhtml")));
181 client_id.id = kTestPage2ClientId; 181 client_id.id = kTestPage2ClientId;
182 SavePage(kTestPage2Url, client_id, std::move(archiver)); 182 SavePage(kTestPage2Url, client_id, std::move(archiver));
183 } 183 }
184 184
185 void OfflinePageUtilsTest::CreateRequests() { 185 void OfflinePageUtilsTest::CreateRequests() {
186 RequestCoordinator* request_coordinator = 186 RequestCoordinator* request_coordinator =
187 RequestCoordinatorFactory::GetForBrowserContext(profile()); 187 RequestCoordinatorFactory::GetForBrowserContext(profile());
188 188
189 offline_pages::ClientId client_id; 189 RequestCoordinator::SavePageLaterParams params;
190 client_id.name_space = kDownloadNamespace; 190 params.url = kTestPage3Url;
191 client_id.id = kTestPage3ClientId; 191 params.client_id =
192 request_coordinator->SavePageLater( 192 offline_pages::ClientId(kDownloadNamespace, kTestPage3ClientId);
fgorski 2017/02/27 17:34:36 are you missing availability here?
jianli 2017/02/27 23:20:06 ditto.
193 kTestPage3Url, client_id, true, 193 request_coordinator->SavePageLater(params);
194 RequestCoordinator::RequestAvailability::ENABLED_FOR_OFFLINER);
195 RunUntilIdle(); 194 RunUntilIdle();
196 } 195 }
197 196
198 std::unique_ptr<OfflinePageTestArchiver> OfflinePageUtilsTest::BuildArchiver( 197 std::unique_ptr<OfflinePageTestArchiver> OfflinePageUtilsTest::BuildArchiver(
199 const GURL& url, 198 const GURL& url,
200 const base::FilePath& file_name) { 199 const base::FilePath& file_name) {
201 std::unique_ptr<OfflinePageTestArchiver> archiver(new OfflinePageTestArchiver( 200 std::unique_ptr<OfflinePageTestArchiver> archiver(new OfflinePageTestArchiver(
202 this, url, OfflinePageArchiver::ArchiverResult::SUCCESSFULLY_CREATED, 201 this, url, OfflinePageArchiver::ArchiverResult::SUCCESSFULLY_CREATED,
203 base::string16(), kTestFileSize, base::ThreadTaskRunnerHandle::Get())); 202 base::string16(), kTestFileSize, base::ThreadTaskRunnerHandle::Get()));
204 archiver->set_filename(file_name); 203 archiver->set_filename(file_name);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 GURL("http://example.com/"), GURL("http://example.com/#test"))); 253 GURL("http://example.com/"), GURL("http://example.com/#test")));
255 EXPECT_TRUE(OfflinePageUtils::EqualsIgnoringFragment( 254 EXPECT_TRUE(OfflinePageUtils::EqualsIgnoringFragment(
256 GURL("http://example.com/#test"), GURL("http://example.com/"))); 255 GURL("http://example.com/#test"), GURL("http://example.com/")));
257 EXPECT_TRUE(OfflinePageUtils::EqualsIgnoringFragment( 256 EXPECT_TRUE(OfflinePageUtils::EqualsIgnoringFragment(
258 GURL("http://example.com/#test"), GURL("http://example.com/#test2"))); 257 GURL("http://example.com/#test"), GURL("http://example.com/#test2")));
259 EXPECT_FALSE(OfflinePageUtils::EqualsIgnoringFragment( 258 EXPECT_FALSE(OfflinePageUtils::EqualsIgnoringFragment(
260 GURL("http://example.com/"), GURL("http://test.com/#test"))); 259 GURL("http://example.com/"), GURL("http://test.com/#test")));
261 } 260 }
262 261
263 } // namespace offline_pages 262 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698