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

Unified Diff: ios/chrome/browser/reading_list/offline_url_utils_unittest.cc

Issue 2644293002: [Reading List iOS] Display distilled URL instead of entry URL in omnibox (Closed)
Patch Set: Created 3 years, 11 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
Index: ios/chrome/browser/reading_list/offline_url_utils_unittest.cc
diff --git a/ios/chrome/browser/reading_list/offline_url_utils_unittest.cc b/ios/chrome/browser/reading_list/offline_url_utils_unittest.cc
index e8b5ee24ae5ee40024ffeaa442cdedfb8aa8091d..b61774601d2ae3ea50e53c013b53a062849e7bad 100644
--- a/ios/chrome/browser/reading_list/offline_url_utils_unittest.cc
+++ b/ios/chrome/browser/reading_list/offline_url_utils_unittest.cc
@@ -15,36 +15,68 @@
// Checks the distilled URL for the page is chrome://offline/MD5/page.html;
TEST(OfflineURLUtilsTest, DistilledURLForPathTest) {
base::FilePath page_path("MD5/page.html");
- GURL distilled_url = reading_list::DistilledURLForPath(page_path, GURL());
+ GURL distilled_url =
+ reading_list::OfflineURLForPath(page_path, GURL(), GURL());
EXPECT_EQ("chrome://offline/MD5/page.html", distilled_url.spec());
}
// Checks the distilled URL for the page with an onlineURL is
// chrome://offline/MD5/page.html?virtualURL=encorded%20URL;
gambard 2017/01/20 14:49:34 Update comment
Olivier 2017/01/20 16:09:14 Done.
-TEST(OfflineURLUtilsTest, DistilledURLForPathWithVirtualURLTest) {
+TEST(OfflineURLUtilsTest, OfflineURLForPathWithEntryURLTest) {
gambard 2017/01/20 14:49:34 s/OfflineURLForPathWithEntryURLTest/OfflineURLForP
Olivier 2017/01/20 16:09:14 Done.
base::FilePath page_path("MD5/page.html");
- GURL online_url = GURL("http://foo.bar");
- GURL distilled_url = reading_list::DistilledURLForPath(page_path, online_url);
- EXPECT_EQ("chrome://offline/MD5/page.html?virtualURL=http%3A%2F%2Ffoo.bar%2F",
- distilled_url.spec());
+ GURL entry_url = GURL("http://foo.bar");
+ GURL virtual_url = GURL("http://foo.bar/virtual");
+ GURL distilled_url =
+ reading_list::OfflineURLForPath(page_path, entry_url, virtual_url);
+ EXPECT_EQ(
+ "chrome://offline/MD5/page.html?"
+ "entryURL=http%3A%2F%2Ffoo.bar%2F&"
+ "virtualURL=http%3A%2F%2Ffoo.bar%2Fvirtual",
+ distilled_url.spec());
}
// Checks the distilled URL for the page is chrome://offline/MD5/page.html;
gambard 2017/01/20 14:49:34 Update this comment. You are checking that the ent
Olivier 2017/01/20 16:09:14 Done.
-TEST(OfflineURLUtilsTest, VirtualURLForDistilledURLTest) {
+TEST(OfflineURLUtilsTest, ParseOfflineURLTest) {
GURL distilled_url("chrome://offline/MD5/page.html");
- GURL virtual_url = reading_list::VirtualURLForDistilledURL(distilled_url);
- EXPECT_EQ("chrome://offline/MD5/page.html", virtual_url.spec());
+ GURL entry_url = reading_list::EntryURLForOfflineURL(distilled_url);
+ EXPECT_EQ("chrome://offline/MD5/page.html", entry_url.spec());
}
// Checks the distilled URL for the page with an onlineURL is
-// chrome://offline/MD5/page.html?virtualURL=encorded%20URL;
-TEST(OfflineURLUtilsTest, VirtualURLForDistilledURLWithVirtualURLTest) {
- GURL distilled_url(
+// chrome://offline/MD5/page.html?entryURL=encorded%20URL
gambard 2017/01/20 14:49:34 WDYT of: // Checks that the entry URL and the virt
Olivier 2017/01/20 16:09:14 Normalized all comments.
+TEST(OfflineURLUtilsTest, ParseOfflineURLWithEntryURLTest) {
+ GURL offline_url(
+ "chrome://offline/MD5/page.html?entryURL=http%3A%2F%2Ffoo.bar%2F");
+ GURL entry_url = reading_list::EntryURLForOfflineURL(offline_url);
+ EXPECT_EQ("http://foo.bar/", entry_url.spec());
+ GURL virtual_url = reading_list::VirtualURLForOfflineURL(offline_url);
+ EXPECT_EQ("http://foo.bar/", virtual_url.spec());
+}
+
+// Checks the distilled URL for the page with an onlineURL is
+// chrome://offline/MD5/page.html?virtualURL=encorded%20URL
gambard 2017/01/20 14:49:34 WDYT: // Checks that if the only parameter present
Olivier 2017/01/20 16:09:14 Normalized all comments.
+TEST(OfflineURLUtilsTest, ParseOfflineURLWithVirtualURLTest) {
+ GURL offline_url(
"chrome://offline/MD5/page.html?virtualURL=http%3A%2F%2Ffoo.bar%2F");
- GURL virtual_url = reading_list::VirtualURLForDistilledURL(distilled_url);
+ GURL entry_url = reading_list::EntryURLForOfflineURL(offline_url);
+ EXPECT_EQ(offline_url, entry_url);
+ GURL virtual_url = reading_list::VirtualURLForOfflineURL(offline_url);
EXPECT_EQ("http://foo.bar/", virtual_url.spec());
}
+// Checks the distilled URL for the page with an onlineURL is
+// chrome://offline/MD5/page.html?entryURL=...&virtualURL=...
gambard 2017/01/20 14:49:34 WDYT: // Checks that the entry URL and the virtual
Olivier 2017/01/20 16:09:14 Normalized all comments.
+TEST(OfflineURLUtilsTest, ParseOfflineURLWithVirtualAndEntryURLTest) {
+ GURL offline_url(
+ "chrome://offline/MD5/"
+ "page.html?virtualURL=http%3A%2F%2Ffoo.bar%2Fvirtual&entryURL=http%3A%2F%"
+ "2Ffoo.bar%2Fentry");
+ GURL entry_url = reading_list::EntryURLForOfflineURL(offline_url);
+ EXPECT_EQ("http://foo.bar/entry", entry_url.spec());
+ GURL virtual_url = reading_list::VirtualURLForOfflineURL(offline_url);
+ EXPECT_EQ("http://foo.bar/virtual", virtual_url.spec());
+}
+
// Checks the file path for chrome://offline/MD5/page.html is
// file://profile_path/Offline/MD5/page.html.
// Checks the resource root for chrome://offline/MD5/page.html is

Powered by Google App Engine
This is Rietveld 408576698