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

Unified Diff: components/update_client/update_checker_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
« no previous file with comments | « components/update_client/update_checker.cc ('k') | components/update_client/utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/update_client/update_checker_unittest.cc
diff --git a/components/update_client/update_checker_unittest.cc b/components/update_client/update_checker_unittest.cc
index 85457b9248f53241bb5d6e4f4a6bb635b79d228f..26873c7a1118e3277d76f938caebf596a160d2b3 100644
--- a/components/update_client/update_checker_unittest.cc
+++ b/components/update_client/update_checker_unittest.cc
@@ -182,8 +182,9 @@ TEST_F(UpdateCheckerTest, UpdateCheckSuccess) {
EXPECT_NE(
string::npos,
post_interceptor_->GetRequests()[0].find(
- "app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"0.9\">"
- "<updatecheck /><packages><package fp=\"fp1\"/></packages></app>"));
+ "app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"0.9\" "
+ "brand=\"TEST\"><updatecheck />"
+ "<packages><package fp=\"fp1\"/></packages></app>"));
EXPECT_NE(string::npos,
post_interceptor_->GetRequests()[0].find("<hw physmemory="));
@@ -196,6 +197,30 @@ TEST_F(UpdateCheckerTest, UpdateCheckSuccess) {
EXPECT_STREQ("1.0", results_.list[0].manifest.version.c_str());
}
+TEST_F(UpdateCheckerTest, UpdateCheckSuccessNoBrand) {
+ EXPECT_TRUE(post_interceptor_->ExpectRequest(
+ new PartialMatch("updatecheck"), test_file("updatecheck_reply_1.xml")));
+
+ config_->SetBrand("TOOLONG"); // Sets an invalid brand code.
+ update_checker_ = UpdateChecker::Create(config_);
+
+ CrxUpdateItem item(BuildCrxUpdateItem());
+ std::vector<CrxUpdateItem*> items_to_check;
+ items_to_check.push_back(&item);
+
+ update_checker_->CheckForUpdates(
+ items_to_check, "", base::Bind(&UpdateCheckerTest::UpdateCheckComplete,
+ base::Unretained(this)));
+
+ RunThreads();
+
+ EXPECT_NE(
+ string::npos,
+ post_interceptor_->GetRequests()[0].find(
+ "app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"0.9\">"
+ "<updatecheck /><packages><package fp=\"fp1\"/></packages></app>"));
+}
+
// Simulates a 403 server response error.
TEST_F(UpdateCheckerTest, UpdateCheckError) {
EXPECT_TRUE(
@@ -274,8 +299,9 @@ TEST_F(UpdateCheckerTest, UpdateCheckCupError) {
EXPECT_NE(
string::npos,
post_interceptor_->GetRequests()[0].find(
- "app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"0.9\">"
- "<updatecheck /><packages><package fp=\"fp1\"/></packages></app>"));
+ "app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"0.9\" "
+ "brand=\"TEST\"><updatecheck />"
+ "<packages><package fp=\"fp1\"/></packages></app>"));
// Expect an error since the response is not trusted.
EXPECT_EQ(-10000, error_);
« no previous file with comments | « components/update_client/update_checker.cc ('k') | components/update_client/utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698