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

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

Issue 2683493002: Get signals working in the EXTRA_DATA section of MHTML (Closed)
Patch Set: Approach for writing to the file afterwards instead. Created 3 years, 9 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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 ~OfflinePageUtilsTest() override; 69 ~OfflinePageUtilsTest() override;
70 70
71 void SetUp() override; 71 void SetUp() override;
72 void RunUntilIdle(); 72 void RunUntilIdle();
73 73
74 void SavePage(const GURL& url, 74 void SavePage(const GURL& url,
75 const ClientId& client_id, 75 const ClientId& client_id,
76 std::unique_ptr<OfflinePageArchiver> archiver); 76 std::unique_ptr<OfflinePageArchiver> archiver);
77 77
78 // Necessary callbacks for the offline page model. 78 // Necessary callbacks for the offline page model.
79 void OnSavePageDone(SavePageResult result, int64_t offlineId); 79 void OnSavePageDone(SavePageResult result,
80 int64_t offlineId,
81 const base::FilePath& saved_filepath);
80 void OnClearAllDone(); 82 void OnClearAllDone();
81 void OnExpirePageDone(bool success); 83 void OnExpirePageDone(bool success);
82 void OnGetURLDone(const GURL& url); 84 void OnGetURLDone(const GURL& url);
83 85
84 // OfflinePageTestArchiver::Observer implementation: 86 // OfflinePageTestArchiver::Observer implementation:
85 void SetLastPathCreatedByArchiver(const base::FilePath& file_path) override; 87 void SetLastPathCreatedByArchiver(const base::FilePath& file_path) override;
86 88
87 TestingProfile* profile() { return &profile_; } 89 TestingProfile* profile() { return &profile_; }
88 90
89 int64_t offline_id() const { return offline_id_; } 91 int64_t offline_id() const { return offline_id_; }
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 OfflinePageModel::SavePageParams save_page_params; 141 OfflinePageModel::SavePageParams save_page_params;
140 save_page_params.url = url; 142 save_page_params.url = url;
141 save_page_params.client_id = client_id; 143 save_page_params.client_id = client_id;
142 OfflinePageModelFactory::GetForBrowserContext(profile())->SavePage( 144 OfflinePageModelFactory::GetForBrowserContext(profile())->SavePage(
143 save_page_params, 145 save_page_params,
144 std::move(archiver), 146 std::move(archiver),
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(
150 int64_t offline_id) { 152 SavePageResult result,
153 int64_t offline_id,
154 const base::FilePath& saved_filepath) {
151 offline_id_ = offline_id; 155 offline_id_ = offline_id;
152 } 156 }
153 157
154 void OfflinePageUtilsTest::OnExpirePageDone(bool success) { 158 void OfflinePageUtilsTest::OnExpirePageDone(bool success) {
155 // Result ignored here. 159 // Result ignored here.
156 } 160 }
157 161
158 void OfflinePageUtilsTest::OnClearAllDone() { 162 void OfflinePageUtilsTest::OnClearAllDone() {
159 // Result ignored here. 163 // Result ignored here.
160 } 164 }
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 GURL("http://example.com/"), GURL("http://example.com/#test"))); 258 GURL("http://example.com/"), GURL("http://example.com/#test")));
255 EXPECT_TRUE(OfflinePageUtils::EqualsIgnoringFragment( 259 EXPECT_TRUE(OfflinePageUtils::EqualsIgnoringFragment(
256 GURL("http://example.com/#test"), GURL("http://example.com/"))); 260 GURL("http://example.com/#test"), GURL("http://example.com/")));
257 EXPECT_TRUE(OfflinePageUtils::EqualsIgnoringFragment( 261 EXPECT_TRUE(OfflinePageUtils::EqualsIgnoringFragment(
258 GURL("http://example.com/#test"), GURL("http://example.com/#test2"))); 262 GURL("http://example.com/#test"), GURL("http://example.com/#test2")));
259 EXPECT_FALSE(OfflinePageUtils::EqualsIgnoringFragment( 263 EXPECT_FALSE(OfflinePageUtils::EqualsIgnoringFragment(
260 GURL("http://example.com/"), GURL("http://test.com/#test"))); 264 GURL("http://example.com/"), GURL("http://test.com/#test")));
261 } 265 }
262 266
263 } // namespace offline_pages 267 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698