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

Side by Side 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 unified diff | Download patch
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 EXPECT_FALSE(VerifyFileHash256( 50 EXPECT_FALSE(VerifyFileHash256(
51 MakeTestFilePath("jebgalgnebhfojomionfpkfelancnnkf.crx"), 51 MakeTestFilePath("jebgalgnebhfojomionfpkfelancnnkf.crx"),
52 std::string("abcd"))); 52 std::string("abcd")));
53 53
54 EXPECT_FALSE(VerifyFileHash256( 54 EXPECT_FALSE(VerifyFileHash256(
55 MakeTestFilePath("jebgalgnebhfojomionfpkfelancnnkf.crx"), 55 MakeTestFilePath("jebgalgnebhfojomionfpkfelancnnkf.crx"),
56 std::string( 56 std::string(
57 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"))); 57 "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")));
58 } 58 }
59 59
60 // Tests that the brand matches ^([a-zA-Z]{4})?$
61 TEST(UpdateClientUtils, IsValidBrand) {
62 EXPECT_TRUE(IsValidBrand(std::string("")));
63 EXPECT_TRUE(IsValidBrand(std::string("T")));
64 EXPECT_TRUE(IsValidBrand(std::string("TE")));
65 EXPECT_TRUE(IsValidBrand(std::string("TES")));
66 EXPECT_TRUE(IsValidBrand(std::string("TEST")));
67 EXPECT_TRUE(IsValidBrand(std::string("")));
68 EXPECT_TRUE(IsValidBrand(std::string("t")));
69 EXPECT_TRUE(IsValidBrand(std::string("te")));
70 EXPECT_TRUE(IsValidBrand(std::string("tes")));
71 EXPECT_TRUE(IsValidBrand(std::string("test")));
72 EXPECT_TRUE(IsValidBrand(std::string("TEst")));
73
74 EXPECT_FALSE(IsValidBrand(std::string("TESTS"))); // Too long.
75 EXPECT_FALSE(IsValidBrand(std::string("TES1"))); // Has digit.
76 EXPECT_FALSE(IsValidBrand(std::string(" TES"))); // Begins 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.
79 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.
82 }
83
60 } // namespace update_client 84 } // namespace update_client
OLDNEW
« 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