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

Unified Diff: chrome/browser/android/offline_pages/offline_page_utils_unittest.cc

Issue 2059513002: Remove obsoleted function and add test (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove empty lines Created 4 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/android/offline_pages/offline_page_utils.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/android/offline_pages/offline_page_utils_unittest.cc
diff --git a/chrome/browser/android/offline_pages/offline_page_utils_unittest.cc b/chrome/browser/android/offline_pages/offline_page_utils_unittest.cc
index 801897962e6fd0693648bf7aa14b875a18332b36..c46dcea11a1a2dcf0871e09c9464c3e05f5dd732 100644
--- a/chrome/browser/android/offline_pages/offline_page_utils_unittest.cc
+++ b/chrome/browser/android/offline_pages/offline_page_utils_unittest.cc
@@ -53,11 +53,13 @@ class OfflinePageUtilsTest
void SetUp() override;
void RunUntilIdle();
+ GURL GetOfflineURLForOnlineURL(GURL online_url);
// Necessary callbacks for the offline page model.
void OnSavePageDone(SavePageResult result, int64_t offlineId);
void OnClearAllDone();
void OnExpirePageDone(bool success);
+ void OnGetURLDone(const GURL& url);
// OfflinePageTestArchiver::Observer implementation:
void SetLastPathCreatedByArchiver(const base::FilePath& file_path) override;
@@ -87,6 +89,7 @@ class OfflinePageUtilsTest
GURL offline_url_expired_;
int64_t offline_id_;
+ GURL url_;
scoped_refptr<base::TestSimpleTaskRunner> task_runner_;
base::ThreadTaskRunnerHandle task_runner_handle_;
@@ -135,6 +138,18 @@ void OfflinePageUtilsTest::OnClearAllDone() {
// Result ignored here.
}
+void OfflinePageUtilsTest::OnGetURLDone(const GURL& url) {
+ url_ = url;
+}
+
+GURL OfflinePageUtilsTest::GetOfflineURLForOnlineURL(GURL online_url) {
+ OfflinePageUtils::GetOfflineURLForOnlineURL(
+ profile(), online_url,
+ base::Bind(&OfflinePageUtilsTest::OnGetURLDone, AsWeakPtr()));
+ RunUntilIdle();
+ return url_;
+}
+
void OfflinePageUtilsTest::SetLastPathCreatedByArchiver(
const base::FilePath& file_path) {}
@@ -211,17 +226,15 @@ TEST_F(OfflinePageUtilsTest, MightBeOfflineURL) {
EXPECT_TRUE(OfflinePageUtils::MightBeOfflineURL(GURL("file:///test.mhtml")));
}
-TEST_F(OfflinePageUtilsTest, MaybeGetOfflineURLForOnlineURL) {
+TEST_F(OfflinePageUtilsTest, GetOfflineURLForOnlineURL) {
EXPECT_EQ(offline_url_page_1(),
- OfflinePageUtils::MaybeGetOfflineURLForOnlineURL(profile(),
- kTestPage1Url));
+ OfflinePageUtilsTest::GetOfflineURLForOnlineURL(kTestPage1Url));
EXPECT_EQ(offline_url_page_2(),
- OfflinePageUtils::MaybeGetOfflineURLForOnlineURL(profile(),
- kTestPage2Url));
- EXPECT_EQ(GURL::EmptyGURL(), OfflinePageUtils::MaybeGetOfflineURLForOnlineURL(
- profile(), kTestPage3Url));
- EXPECT_EQ(GURL::EmptyGURL(), OfflinePageUtils::MaybeGetOfflineURLForOnlineURL(
- profile(), kTestPage4Url));
+ OfflinePageUtilsTest::GetOfflineURLForOnlineURL(kTestPage2Url));
+ EXPECT_EQ(GURL::EmptyGURL(),
+ OfflinePageUtilsTest::GetOfflineURLForOnlineURL(kTestPage3Url));
+ EXPECT_EQ(GURL::EmptyGURL(),
+ OfflinePageUtilsTest::GetOfflineURLForOnlineURL(kTestPage4Url));
}
TEST_F(OfflinePageUtilsTest, MaybeGetOnlineURLForOfflineURL) {
« no previous file with comments | « chrome/browser/android/offline_pages/offline_page_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698