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

Unified Diff: components/update_client/utils_unittest.cc

Issue 1740333002: Allow fallback from https to http for component update checks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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/update_client/utils.cc ('k') | extensions/browser/updater/update_data_provider.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/update_client/utils_unittest.cc
diff --git a/components/update_client/utils_unittest.cc b/components/update_client/utils_unittest.cc
index 8153070573d006e861e6c87a84c78461caa58cac..b15fcac4b5e73b2ada38c1581eb9b24273132c60 100644
--- a/components/update_client/utils_unittest.cc
+++ b/components/update_client/utils_unittest.cc
@@ -81,4 +81,35 @@ TEST(UpdateClientUtils, IsValidBrand) {
EXPECT_FALSE(IsValidBrand(std::string("\xaa"))); // Has non-ASCII char.
}
+TEST(UpdateClientUtils, RemoveUnsecureUrls) {
+ const GURL test1[] = {GURL("http://foo"), GURL("https://foo")};
+ std::vector<GURL> urls(std::begin(test1), std::end(test1));
+ RemoveUnsecureUrls(&urls);
+ EXPECT_EQ(1u, urls.size());
+ EXPECT_EQ(urls[0], GURL("https://foo"));
+
+ const GURL test2[] = {GURL("https://foo"), GURL("http://foo")};
+ urls.assign(std::begin(test2), std::end(test2));
+ RemoveUnsecureUrls(&urls);
+ EXPECT_EQ(1u, urls.size());
+ EXPECT_EQ(urls[0], GURL("https://foo"));
+
+ const GURL test3[] = {GURL("https://foo"), GURL("https://bar")};
+ urls.assign(std::begin(test3), std::end(test3));
+ RemoveUnsecureUrls(&urls);
+ EXPECT_EQ(2u, urls.size());
+ EXPECT_EQ(urls[0], GURL("https://foo"));
+ EXPECT_EQ(urls[1], GURL("https://bar"));
+
+ const GURL test4[] = {GURL("http://foo")};
+ urls.assign(std::begin(test4), std::end(test4));
+ RemoveUnsecureUrls(&urls);
+ EXPECT_EQ(0u, urls.size());
+
+ const GURL test5[] = {GURL("http://foo"), GURL("http://bar")};
+ urls.assign(std::begin(test5), std::end(test5));
+ RemoveUnsecureUrls(&urls);
+ EXPECT_EQ(0u, urls.size());
+}
+
} // namespace update_client
« no previous file with comments | « components/update_client/utils.cc ('k') | extensions/browser/updater/update_data_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698