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

Unified Diff: components/update_client/update_checker_unittest.cc

Issue 1872053002: Implement an API to allow passing an "ap" parameter to component updates. (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/update_checker.cc ('k') | components/update_client/update_client.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 334899611f8323b22e910f0645b5037572e22c1b..c41afdbf59826abf1a53a5ad294b8ae9a9cecb67 100644
--- a/components/update_client/update_checker_unittest.cc
+++ b/components/update_client/update_checker_unittest.cc
@@ -161,6 +161,7 @@ TEST_F(UpdateCheckerTest, UpdateCheckSuccess) {
update_checker_ = UpdateChecker::Create(config_);
CrxUpdateItem item(BuildCrxUpdateItem());
+ item.component.ap = "some_ap";
std::vector<CrxUpdateItem*> items_to_check;
items_to_check.push_back(&item);
@@ -185,8 +186,8 @@ TEST_F(UpdateCheckerTest, UpdateCheckSuccess) {
EXPECT_NE(
string::npos,
post_interceptor_->GetRequests()[0].find(
- "app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"0.9\" "
- "brand=\"TEST\"><updatecheck />"
+ "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"0.9\" "
+ "brand=\"TEST\" ap=\"some_ap\"><updatecheck />"
"<packages><package fp=\"fp1\"/></packages></app>"));
EXPECT_NE(string::npos,
@@ -200,6 +201,32 @@ TEST_F(UpdateCheckerTest, UpdateCheckSuccess) {
EXPECT_STREQ("1.0", results_.list[0].manifest.version.c_str());
}
+// Tests that an invalid "ap" is not serialized.
+TEST_F(UpdateCheckerTest, UpdateCheckInvalidAp) {
+ EXPECT_TRUE(post_interceptor_->ExpectRequest(
+ new PartialMatch("updatecheck"), test_file("updatecheck_reply_1.xml")));
+
+ update_checker_ = UpdateChecker::Create(config_);
+
+ CrxUpdateItem item(BuildCrxUpdateItem());
+ item.component.ap = std::string(257, 'a'); // Too long.
+ 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\" "
+ "brand=\"TEST\"><updatecheck />"
+ "<packages><package fp=\"fp1\"/></packages></app>"));
+}
+
TEST_F(UpdateCheckerTest, UpdateCheckSuccessNoBrand) {
EXPECT_TRUE(post_interceptor_->ExpectRequest(
new PartialMatch("updatecheck"), test_file("updatecheck_reply_1.xml")));
@@ -220,7 +247,7 @@ TEST_F(UpdateCheckerTest, UpdateCheckSuccessNoBrand) {
EXPECT_NE(
string::npos,
post_interceptor_->GetRequests()[0].find(
- "app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"0.9\">"
+ "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"0.9\">"
"<updatecheck /><packages><package fp=\"fp1\"/></packages></app>"));
}
@@ -302,7 +329,7 @@ TEST_F(UpdateCheckerTest, UpdateCheckCupError) {
EXPECT_NE(
string::npos,
post_interceptor_->GetRequests()[0].find(
- "app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"0.9\" "
+ "<app appid=\"jebgalgnebhfojomionfpkfelancnnkf\" version=\"0.9\" "
"brand=\"TEST\"><updatecheck />"
"<packages><package fp=\"fp1\"/></packages></app>"));
« no previous file with comments | « components/update_client/update_checker.cc ('k') | components/update_client/update_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698