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

Unified Diff: components/update_client/utils_unittest.cc

Issue 1823273002: Send the value of google_brand::GetBrand in component update checks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: minor unit test improvement. Created 4 years, 9 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: components/update_client/utils_unittest.cc
diff --git a/components/update_client/utils_unittest.cc b/components/update_client/utils_unittest.cc
index 24539e2946b1b76fbf3161f474b0dd1ca2a90aa9..8153070573d006e861e6c87a84c78461caa58cac 100644
--- a/components/update_client/utils_unittest.cc
+++ b/components/update_client/utils_unittest.cc
@@ -57,4 +57,28 @@ TEST(UpdateClientUtils, VerifyFileHash256) {
"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")));
}
+// Tests that the brand matches ^([a-zA-Z]{4})?$
+TEST(UpdateClientUtils, IsValidBrand) {
+ EXPECT_TRUE(IsValidBrand(std::string("")));
+ EXPECT_TRUE(IsValidBrand(std::string("T")));
+ EXPECT_TRUE(IsValidBrand(std::string("TE")));
+ EXPECT_TRUE(IsValidBrand(std::string("TES")));
+ EXPECT_TRUE(IsValidBrand(std::string("TEST")));
+ EXPECT_TRUE(IsValidBrand(std::string("")));
+ EXPECT_TRUE(IsValidBrand(std::string("t")));
+ EXPECT_TRUE(IsValidBrand(std::string("te")));
+ EXPECT_TRUE(IsValidBrand(std::string("tes")));
+ EXPECT_TRUE(IsValidBrand(std::string("test")));
+ EXPECT_TRUE(IsValidBrand(std::string("TEst")));
+
+ EXPECT_FALSE(IsValidBrand(std::string("TESTS"))); // Too long.
+ EXPECT_FALSE(IsValidBrand(std::string("TES1"))); // Has digit.
+ EXPECT_FALSE(IsValidBrand(std::string(" TES"))); // Begins with white space.
+ EXPECT_FALSE(IsValidBrand(std::string("TES "))); // Ends with white space.
+ EXPECT_FALSE(IsValidBrand(std::string("T ES"))); // Contains white space.
+ EXPECT_FALSE(IsValidBrand(std::string("<TE"))); // Has <.
+ EXPECT_FALSE(IsValidBrand(std::string("TE>"))); // Has >.
+ EXPECT_FALSE(IsValidBrand(std::string("\xaa"))); // Has non-ASCII char.
+}
+
} // namespace update_client
« no previous file with comments | « components/update_client/utils.cc ('k') | ios/chrome/browser/component_updater/ios_component_updater_configurator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698