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

Unified Diff: components/offline_pages/offline_page_model_impl_unittest.cc

Issue 2353813002: Match offline page url with fragment identifier stripped (Closed)
Patch Set: Created 4 years, 3 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 | « components/offline_pages/offline_page_model_impl.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/offline_pages/offline_page_model_impl_unittest.cc
diff --git a/components/offline_pages/offline_page_model_impl_unittest.cc b/components/offline_pages/offline_page_model_impl_unittest.cc
index 3c988f6de248eef72cecd7eb3f9dfc8704f69cee..ffefec6f5ede6da4ea5adcf914c87e39519bfed3 100644
--- a/components/offline_pages/offline_page_model_impl_unittest.cc
+++ b/components/offline_pages/offline_page_model_impl_unittest.cc
@@ -45,6 +45,9 @@ const GURL kTestUrl2("http://other.page.com");
const GURL kTestUrl3("http://test.xyz");
const GURL kTestUrl4("http://page.net");
const GURL kFileUrl("file:///foo");
+const GURL kTestUrlWithFragment("http://example.com#frag");
+const GURL kTestUrl2WithFragment("http://other.page.com#frag");
+const GURL kTestUrl2WithFragment2("http://other.page.com#frag2");
const ClientId kTestClientId1(kTestClientNamespace, "1234");
const ClientId kTestClientId2(kTestClientNamespace, "5678");
const ClientId kTestClientId3(kTestClientNamespace, "42");
@@ -933,6 +936,27 @@ TEST_F(OfflinePageModelImplTest, GetPagesByOnlineURL) {
EXPECT_EQ(0U, pages.size());
}
+TEST_F(OfflinePageModelImplTest, GetPagesByOnlineURLWithFragment) {
+ SavePage(kTestUrl, kTestClientId1);
+ SavePage(kTestUrl2WithFragment, kTestClientId2);
+
+ MultipleOfflinePageItemResult pages =
+ GetPagesByOnlineURL(kTestUrlWithFragment);
+ EXPECT_EQ(1U, pages.size());
+ EXPECT_EQ(kTestUrl, pages[0].url);
+ EXPECT_EQ(kTestClientId1, pages[0].client_id);
+
+ pages = GetPagesByOnlineURL(kTestUrl2);
+ EXPECT_EQ(1U, pages.size());
+ EXPECT_EQ(kTestUrl2WithFragment, pages[0].url);
+ EXPECT_EQ(kTestClientId2, pages[0].client_id);
+
+ pages = GetPagesByOnlineURL(kTestUrl2WithFragment2);
+ EXPECT_EQ(1U, pages.size());
+ EXPECT_EQ(kTestUrl2WithFragment, pages[0].url);
+ EXPECT_EQ(kTestClientId2, pages[0].client_id);
+}
+
TEST_F(OfflinePageModelImplTest, CheckPagesExistOffline) {
SavePage(kTestUrl, kTestClientId1);
SavePage(kTestUrl2, kTestClientId2);
« no previous file with comments | « components/offline_pages/offline_page_model_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698