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

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

Issue 1968563003: [Offline pages] Extracting callbacks from the Offline Page Model (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 public OfflinePageTestArchiver::Observer, 47 public OfflinePageTestArchiver::Observer,
48 public base::SupportsWeakPtr<OfflinePageUtilsTest> { 48 public base::SupportsWeakPtr<OfflinePageUtilsTest> {
49 public: 49 public:
50 OfflinePageUtilsTest(); 50 OfflinePageUtilsTest();
51 ~OfflinePageUtilsTest() override; 51 ~OfflinePageUtilsTest() override;
52 52
53 void SetUp() override; 53 void SetUp() override;
54 void RunUntilIdle(); 54 void RunUntilIdle();
55 55
56 // Necessary callbacks for the offline page model. 56 // Necessary callbacks for the offline page model.
57 void OnSavePageDone(OfflinePageModel::SavePageResult result, 57 void OnSavePageDone(SavePageResult result, int64_t offlineId);
58 int64_t offlineId);
59 void OnClearAllDone(); 58 void OnClearAllDone();
60 59
61 // OfflinePageTestArchiver::Observer implementation: 60 // OfflinePageTestArchiver::Observer implementation:
62 void SetLastPathCreatedByArchiver(const base::FilePath& file_path) override; 61 void SetLastPathCreatedByArchiver(const base::FilePath& file_path) override;
63 62
64 // Offline page URL for the first page. 63 // Offline page URL for the first page.
65 const GURL& offline_url_page_1() const { return offline_url_page_1_; } 64 const GURL& offline_url_page_1() const { return offline_url_page_1_; }
66 // Offline page URL for the second page. 65 // Offline page URL for the second page.
67 const GURL& offline_url_page_2() const { return offline_url_page_2_; } 66 const GURL& offline_url_page_2() const { return offline_url_page_2_; }
68 // Offline page URL not related to any page. 67 // Offline page URL not related to any page.
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 110
112 // Make sure the store contains the right offline pages before the load 111 // Make sure the store contains the right offline pages before the load
113 // happens. 112 // happens.
114 CreateOfflinePages(); 113 CreateOfflinePages();
115 } 114 }
116 115
117 void OfflinePageUtilsTest::RunUntilIdle() { 116 void OfflinePageUtilsTest::RunUntilIdle() {
118 task_runner_->RunUntilIdle(); 117 task_runner_->RunUntilIdle();
119 } 118 }
120 119
121 void OfflinePageUtilsTest::OnSavePageDone( 120 void OfflinePageUtilsTest::OnSavePageDone(SavePageResult result,
122 OfflinePageModel::SavePageResult result, 121 int64_t offline_id) {
123 int64_t offline_id) {
124 offline_id_ = offline_id; 122 offline_id_ = offline_id;
125 } 123 }
126 124
127 void OfflinePageUtilsTest::OnClearAllDone() { 125 void OfflinePageUtilsTest::OnClearAllDone() {
128 // Result ignored here. 126 // Result ignored here.
129 } 127 }
130 128
131 void OfflinePageUtilsTest::SetLastPathCreatedByArchiver( 129 void OfflinePageUtilsTest::SetLastPathCreatedByArchiver(
132 const base::FilePath& file_path) {} 130 const base::FilePath& file_path) {}
133 131
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 TEST_F(OfflinePageUtilsTest, HasOfflinePageForOnlineURL) { 228 TEST_F(OfflinePageUtilsTest, HasOfflinePageForOnlineURL) {
231 EXPECT_TRUE( 229 EXPECT_TRUE(
232 OfflinePageUtils::HasOfflinePageForOnlineURL(profile(), kTestPage1Url)); 230 OfflinePageUtils::HasOfflinePageForOnlineURL(profile(), kTestPage1Url));
233 EXPECT_TRUE( 231 EXPECT_TRUE(
234 OfflinePageUtils::HasOfflinePageForOnlineURL(profile(), kTestPage2Url)); 232 OfflinePageUtils::HasOfflinePageForOnlineURL(profile(), kTestPage2Url));
235 EXPECT_FALSE( 233 EXPECT_FALSE(
236 OfflinePageUtils::HasOfflinePageForOnlineURL(profile(), kTestPage3Url)); 234 OfflinePageUtils::HasOfflinePageForOnlineURL(profile(), kTestPage3Url));
237 } 235 }
238 236
239 } // namespace offline_pages 237 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698