| Index: components/update_client/update_response_unittest.cc
|
| diff --git a/components/update_client/update_response_unittest.cc b/components/update_client/update_response_unittest.cc
|
| index 20f08b074e7e8da73a9444bc27afc3039ff1c18d..b41602403414eaf57b5bcfc5eb750792870bbe96 100644
|
| --- a/components/update_client/update_response_unittest.cc
|
| +++ b/components/update_client/update_response_unittest.cc
|
| @@ -220,6 +220,27 @@ const char* kTwoAppsOneError =
|
| " </app>"
|
| "</response>";
|
|
|
| +// Includes two <app> tags, both of which set the cohort.
|
| +const char* kTwoAppsSetCohort =
|
| + "<?xml version='1.0' encoding='UTF-8'?>"
|
| + "<response protocol='3.0'>"
|
| + " <app appid='aaaaaaaa' cohort='1:2q3/'>"
|
| + " <updatecheck status='noupdate'/>"
|
| + " </app>"
|
| + " <app appid='bbbbbbbb' cohort='1:33z@0.33' cohortname='cname'>"
|
| + " <updatecheck status='ok'>"
|
| + " <urls>"
|
| + " <url codebase='http://example.com/'/>"
|
| + " </urls>"
|
| + " <manifest version='1.2.3.4' prodversionmin='2.0.143.0'>"
|
| + " <packages>"
|
| + " <package name='extension_1_2_3_4.crx'/>"
|
| + " </packages>"
|
| + " </manifest>"
|
| + " </updatecheck>"
|
| + " </app>"
|
| + "</response>";
|
| +
|
| TEST(ComponentUpdaterUpdateResponseTest, TestParser) {
|
| UpdateResponse parser;
|
|
|
| @@ -312,6 +333,30 @@ TEST(ComponentUpdaterUpdateResponseTest, TestParser) {
|
| EXPECT_EQ(1u, parser.results().list.size());
|
| firstResult = &parser.results().list[0];
|
| EXPECT_EQ(firstResult->extension_id, "bbbbbbbb");
|
| +
|
| + // Parse xml with two apps setting the cohort info.
|
| + EXPECT_TRUE(parser.Parse(kTwoAppsSetCohort));
|
| + EXPECT_TRUE(parser.errors().empty());
|
| + EXPECT_EQ(2u, parser.results().list.size());
|
| + firstResult = &parser.results().list[0];
|
| + EXPECT_EQ(firstResult->extension_id, "aaaaaaaa");
|
| + EXPECT_NE(firstResult->cohort_attrs.find("cohort"),
|
| + firstResult->cohort_attrs.end());
|
| + EXPECT_EQ(firstResult->cohort_attrs.find("cohort")->second, "1:2q3/");
|
| + EXPECT_EQ(firstResult->cohort_attrs.find("cohortname"),
|
| + firstResult->cohort_attrs.end());
|
| + EXPECT_EQ(firstResult->cohort_attrs.find("cohorthint"),
|
| + firstResult->cohort_attrs.end());
|
| + const UpdateResponse::Result* secondResult = &parser.results().list[1];
|
| + EXPECT_EQ(secondResult->extension_id, "bbbbbbbb");
|
| + EXPECT_NE(secondResult->cohort_attrs.find("cohort"),
|
| + secondResult->cohort_attrs.end());
|
| + EXPECT_EQ(secondResult->cohort_attrs.find("cohort")->second, "1:33z@0.33");
|
| + EXPECT_NE(secondResult->cohort_attrs.find("cohortname"),
|
| + secondResult->cohort_attrs.end());
|
| + EXPECT_EQ(secondResult->cohort_attrs.find("cohortname")->second, "cname");
|
| + EXPECT_EQ(secondResult->cohort_attrs.find("cohorthint"),
|
| + secondResult->cohort_attrs.end());
|
| }
|
|
|
| } // namespace update_client
|
|
|