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

Side by Side 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 unified diff | 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/files/file_path.h" 5 #include "base/files/file_path.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "components/update_client/utils.h" 7 #include "components/update_client/utils.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 #include "url/gurl.h" 9 #include "url/gurl.h"
10 10
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 EXPECT_FALSE(IsValidBrand(std::string("TESTS"))); // Too long. 74 EXPECT_FALSE(IsValidBrand(std::string("TESTS"))); // Too long.
75 EXPECT_FALSE(IsValidBrand(std::string("TES1"))); // Has digit. 75 EXPECT_FALSE(IsValidBrand(std::string("TES1"))); // Has digit.
76 EXPECT_FALSE(IsValidBrand(std::string(" TES"))); // Begins with white space. 76 EXPECT_FALSE(IsValidBrand(std::string(" TES"))); // Begins with white space.
77 EXPECT_FALSE(IsValidBrand(std::string("TES "))); // Ends with white space. 77 EXPECT_FALSE(IsValidBrand(std::string("TES "))); // Ends with white space.
78 EXPECT_FALSE(IsValidBrand(std::string("T ES"))); // Contains white space. 78 EXPECT_FALSE(IsValidBrand(std::string("T ES"))); // Contains white space.
79 EXPECT_FALSE(IsValidBrand(std::string("<TE"))); // Has <. 79 EXPECT_FALSE(IsValidBrand(std::string("<TE"))); // Has <.
80 EXPECT_FALSE(IsValidBrand(std::string("TE>"))); // Has >. 80 EXPECT_FALSE(IsValidBrand(std::string("TE>"))); // Has >.
81 EXPECT_FALSE(IsValidBrand(std::string("\xaa"))); // Has non-ASCII char. 81 EXPECT_FALSE(IsValidBrand(std::string("\xaa"))); // Has non-ASCII char.
82 } 82 }
83 83
84 TEST(UpdateClientUtils, RemoveUnsecureUrls) {
85 const GURL test1[] = {GURL("http://foo"), GURL("https://foo")};
86 std::vector<GURL> urls(std::begin(test1), std::end(test1));
87 RemoveUnsecureUrls(&urls);
88 EXPECT_EQ(1u, urls.size());
89 EXPECT_EQ(urls[0], GURL("https://foo"));
90
91 const GURL test2[] = {GURL("https://foo"), GURL("http://foo")};
92 urls.assign(std::begin(test2), std::end(test2));
93 RemoveUnsecureUrls(&urls);
94 EXPECT_EQ(1u, urls.size());
95 EXPECT_EQ(urls[0], GURL("https://foo"));
96
97 const GURL test3[] = {GURL("https://foo"), GURL("https://bar")};
98 urls.assign(std::begin(test3), std::end(test3));
99 RemoveUnsecureUrls(&urls);
100 EXPECT_EQ(2u, urls.size());
101 EXPECT_EQ(urls[0], GURL("https://foo"));
102 EXPECT_EQ(urls[1], GURL("https://bar"));
103
104 const GURL test4[] = {GURL("http://foo")};
105 urls.assign(std::begin(test4), std::end(test4));
106 RemoveUnsecureUrls(&urls);
107 EXPECT_EQ(0u, urls.size());
108
109 const GURL test5[] = {GURL("http://foo"), GURL("http://bar")};
110 urls.assign(std::begin(test5), std::end(test5));
111 RemoveUnsecureUrls(&urls);
112 EXPECT_EQ(0u, urls.size());
113 }
114
84 } // namespace update_client 115 } // namespace update_client
OLDNEW
« 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