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

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

Issue 2606873002: Move the offline URL trimming to GetFormattedURL. (Closed)
Patch Set: clean Created 4 years 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 d711ca55f8687cfd89185ff1dc079551e6c1f68e..f2fdef168eb37aeed5ef6a42e789abfccf3b4b5b 100644
--- a/ios/chrome/browser/reading_list/offline_url_utils_unittest.cc
+++ b/ios/chrome/browser/reading_list/offline_url_utils_unittest.cc
@@ -7,6 +7,8 @@
#include <string>
#include "base/files/file_path.h"
+#include "base/strings/utf_string_conversions.h"
+#include "base/test/gtest_util.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "url/gurl.h"
@@ -80,3 +82,21 @@ TEST(OfflineURLUtilsTest, IsOfflineURL) {
EXPECT_TRUE(
reading_list::IsOfflineURL(GURL("chrome://offline/foobar?foo=bar")));
}
+
+TEST(OfflineURLUtilsTest, StripSchemeFromOnlineUrlTest) {
Eugene But (OOO till 7-30) 2016/12/28 17:02:59 Could you please add comments for test method.
Olivier 2016/12/29 12:37:20 Done.
+ base::string16 empty_url = base::UTF8ToUTF16("");
Eugene But (OOO till 7-30) 2016/12/28 17:02:59 Should this be just |base::string16 empty_url;|?
Olivier 2016/12/29 12:37:20 Done.
+ EXPECT_EQ(reading_list::StripSchemeFromOnlineUrl(empty_url), empty_url);
+ base::string16 https_url = base::UTF8ToUTF16("https://www.chromium.org/");
+ base::string16 trimmed_https_url = base::UTF8ToUTF16("www.chromium.org/");
+ EXPECT_EQ(reading_list::StripSchemeFromOnlineUrl(https_url),
+ trimmed_https_url);
+ base::string16 http_url = base::UTF8ToUTF16("http://www.chromium.org/");
+ EXPECT_DCHECK_DEATH(reading_list::StripSchemeFromOnlineUrl(http_url));
+ base::string16 other_scheme_url =
+ base::UTF8ToUTF16("scheme://www.chromium.org/");
+ EXPECT_EQ(reading_list::StripSchemeFromOnlineUrl(other_scheme_url),
+ other_scheme_url);
+ base::string16 no_scheme_url = base::UTF8ToUTF16("www.chromium.org/");
+ EXPECT_EQ(reading_list::StripSchemeFromOnlineUrl(no_scheme_url),
+ no_scheme_url);
+}

Powered by Google App Engine
This is Rietveld 408576698