| Index: chrome/common/extensions/manifest_handlers/externally_connectable_unittest.cc
|
| diff --git a/chrome/common/extensions/manifest_handlers/externally_connectable_unittest.cc b/chrome/common/extensions/manifest_handlers/externally_connectable_unittest.cc
|
| index 379c6774f11dcd7319ff0c9babab720e0b147c0a..c2da186b59b5bdb8da8b2830b38bb58aa4720225 100644
|
| --- a/chrome/common/extensions/manifest_handlers/externally_connectable_unittest.cc
|
| +++ b/chrome/common/extensions/manifest_handlers/externally_connectable_unittest.cc
|
| @@ -40,7 +40,7 @@ TEST_F(ExternallyConnectableTest, IDsAndMatches) {
|
| EXPECT_THAT(info->ids, ElementsAre("abcdefghijklmnopabcdefghijklmnop",
|
| "ponmlkjihgfedcbaponmlkjihgfedcba"));
|
|
|
| - EXPECT_FALSE(info->matches_all_ids);
|
| + EXPECT_FALSE(info->all_ids);
|
|
|
| EXPECT_TRUE(info->matches.MatchesURL(GURL("http://example.com")));
|
| EXPECT_TRUE(info->matches.MatchesURL(GURL("http://example.com/")));
|
| @@ -100,7 +100,7 @@ TEST_F(ExternallyConnectableTest, IDs) {
|
| EXPECT_THAT(info->ids, ElementsAre("abcdefghijklmnopabcdefghijklmnop",
|
| "ponmlkjihgfedcbaponmlkjihgfedcba"));
|
|
|
| - EXPECT_FALSE(info->matches_all_ids);
|
| + EXPECT_FALSE(info->all_ids);
|
|
|
| EXPECT_FALSE(info->matches.MatchesURL(GURL("http://google.com/index.html")));
|
| }
|
| @@ -118,7 +118,7 @@ TEST_F(ExternallyConnectableTest, Matches) {
|
|
|
| EXPECT_THAT(info->ids, ElementsAre());
|
|
|
| - EXPECT_FALSE(info->matches_all_ids);
|
| + EXPECT_FALSE(info->all_ids);
|
|
|
| EXPECT_TRUE(info->matches.MatchesURL(GURL("http://example.com")));
|
| EXPECT_TRUE(info->matches.MatchesURL(GURL("http://example.com/")));
|
| @@ -159,11 +159,38 @@ TEST_F(ExternallyConnectableTest, AllIDs) {
|
| EXPECT_THAT(info->ids, ElementsAre("abcdefghijklmnopabcdefghijklmnop",
|
| "ponmlkjihgfedcbaponmlkjihgfedcba"));
|
|
|
| - EXPECT_TRUE(info->matches_all_ids);
|
| + EXPECT_TRUE(info->all_ids);
|
|
|
| EXPECT_FALSE(info->matches.MatchesURL(GURL("http://google.com/index.html")));
|
| }
|
|
|
| +TEST_F(ExternallyConnectableTest, IdCanConnect) {
|
| + // Not in order to test that ExternallyConnectableInfo sorts it.
|
| + std::string matches_ids_array[] = { "g", "h", "c", "i", "a", "z", "b" };
|
| + std::vector<std::string> matches_ids(
|
| + matches_ids_array, matches_ids_array + arraysize(matches_ids_array));
|
| +
|
| + std::string nomatches_ids_array[] = { "2", "3", "1" };
|
| +
|
| + // all_ids = false.
|
| + {
|
| + ExternallyConnectableInfo info(URLPatternSet(), matches_ids, false);
|
| + for (size_t i = 0; i < matches_ids.size(); ++i)
|
| + EXPECT_TRUE(info.IdCanConnect(matches_ids[i]));
|
| + for (size_t i = 0; i < arraysize(nomatches_ids_array); ++i)
|
| + EXPECT_FALSE(info.IdCanConnect(nomatches_ids_array[i]));
|
| + }
|
| +
|
| + // all_ids = true.
|
| + {
|
| + ExternallyConnectableInfo info(URLPatternSet(), matches_ids, true);
|
| + for (size_t i = 0; i < matches_ids.size(); ++i)
|
| + EXPECT_TRUE(info.IdCanConnect(matches_ids[i]));
|
| + for (size_t i = 0; i < arraysize(nomatches_ids_array); ++i)
|
| + EXPECT_TRUE(info.IdCanConnect(nomatches_ids_array[i]));
|
| + }
|
| +}
|
| +
|
| TEST_F(ExternallyConnectableTest, ErrorWrongFormat) {
|
| RunTestcase(Testcase("externally_connectable_error_wrong_format.json",
|
| errors::kErrorInvalid),
|
|
|