diff options
author | sorin <sorin@chromium.org> | 2015-05-28 16:49:03 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-05-28 23:49:28 +0000 |
commit | 7af7f8effdfd7ac1ae70a42de081351004e02b29 (patch) | |
tree | 6e3cc78746a7feff237aab22d1ab40f5d685fcd6 /components/update_client | |
parent | c2e02096ed99e51f8ea229386721e0304b1d2dd3 (diff) | |
download | chromium_src-7af7f8effdfd7ac1ae70a42de081351004e02b29.zip chromium_src-7af7f8effdfd7ac1ae70a42de081351004e02b29.tar.gz chromium_src-7af7f8effdfd7ac1ae70a42de081351004e02b29.tar.bz2 |
Fix copy and paste error when parsing component update responses.
BUG=493393
Review URL: https://codereview.chromium.org/1159923009
Cr-Commit-Position: refs/heads/master@{#331884}
Diffstat (limited to 'components/update_client')
-rw-r--r-- | components/update_client/update_response.cc | 4 | ||||
-rw-r--r-- | components/update_client/update_response_unittest.cc | 16 |
2 files changed, 18 insertions, 2 deletions
diff --git a/components/update_client/update_response.cc b/components/update_client/update_response.cc index 8677fe6..c0996fc 100644 --- a/components/update_client/update_response.cc +++ b/components/update_client/update_response.cc @@ -250,8 +250,8 @@ bool ParseUpdateCheckTag(xmlNode* updatecheck, } std::vector<xmlNode*> manifests = GetChildren(updatecheck, "manifest"); - if (urls.empty()) { - *error = "Missing urls on updatecheck."; + if (manifests.empty()) { + *error = "Missing manifest on updatecheck."; return false; } diff --git a/components/update_client/update_response_unittest.cc b/components/update_client/update_response_unittest.cc index e106916..2e12ce3 100644 --- a/components/update_client/update_response_unittest.cc +++ b/components/update_client/update_response_unittest.cc @@ -83,6 +83,18 @@ const char* kInvalidValidXmlMissingCodebase = " </app>" "</response>"; +const char* kInvalidValidXmlMissingManifest = + "<?xml version='1.0' encoding='UTF-8'?>" + "<response protocol='3.0'>" + " <app appid='12345'>" + " <updatecheck status='ok'>" + " <urls>" + " <url codebase='http://example.com/'/>" + " </urls>" + " </updatecheck>" + " </app>" + "</response>"; + const char* kMissingAppId = "<?xml version='1.0'?>" "<response protocol='3.0'>" @@ -236,6 +248,10 @@ TEST(ComponentUpdaterUpdateResponseTest, TestParser) { EXPECT_TRUE(parser.results().list.empty()); EXPECT_FALSE(parser.errors().empty()); + EXPECT_TRUE(parser.Parse(kInvalidValidXmlMissingManifest)); + EXPECT_TRUE(parser.results().list.empty()); + EXPECT_FALSE(parser.errors().empty()); + // Parse some valid XML, and check that all params came out as expected EXPECT_TRUE(parser.Parse(kValidXml)); EXPECT_TRUE(parser.errors().empty()); |