Chromium Code Reviews| Index: chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_unittest.cc |
| diff --git a/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_unittest.cc b/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_unittest.cc |
| index 85b503fa46e322a1fbe3488ed7cad137922b3a24..f81ce09390c55f4f28abb47ccc72dba1a024c43b 100644 |
| --- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_unittest.cc |
| +++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_condition_unittest.cc |
| @@ -24,6 +24,7 @@ TEST(WebRequestConditionTest, CreateCondition) { |
| // Necessary for TestURLRequest. |
| MessageLoop message_loop(MessageLoop::TYPE_IO); |
| URLMatcher matcher; |
| + URLMatcher first_party_matcher; |
|
battre
2012/12/06 19:53:26
I would suggest using a single URLMatcher to incre
|
| std::string error; |
| scoped_ptr<WebRequestCondition> result; |
| @@ -42,15 +43,19 @@ TEST(WebRequestConditionTest, CreateCondition) { |
| resource_type_list->Append(Value::CreateStringValue("main_frame")); |
| DictionaryValue* url_filter = new DictionaryValue(); |
| url_filter->SetString(keys2::kHostSuffixKey, "example.com"); |
| + DictionaryValue* first_party_url_filter = new DictionaryValue(); |
| DictionaryValue valid_condition; |
| valid_condition.Set(keys::kResourceTypeKey, resource_type_list); |
| valid_condition.Set(keys::kUrlKey, url_filter); |
| + valid_condition.Set(keys::kFirstPartyForCookiesUrlKey, |
| + first_party_url_filter); |
| valid_condition.SetString(keys::kInstanceTypeKey, |
| keys::kRequestMatcherType); |
| // Test wrong condition name passed. |
| error.clear(); |
| result = WebRequestCondition::Create(matcher.condition_factory(), |
| + first_party_matcher.condition_factory(), |
| invalid_condition, &error); |
| EXPECT_FALSE(error.empty()); |
| EXPECT_FALSE(result.get()); |
| @@ -58,6 +63,7 @@ TEST(WebRequestConditionTest, CreateCondition) { |
| // Test wrong datatype in host_suffix. |
| error.clear(); |
| result = WebRequestCondition::Create(matcher.condition_factory(), |
| + first_party_matcher.condition_factory(), |
| invalid_condition2, &error); |
| EXPECT_FALSE(error.empty()); |
| EXPECT_FALSE(result.get()); |
| @@ -65,6 +71,7 @@ TEST(WebRequestConditionTest, CreateCondition) { |
| // Test success (can we support multiple criteria?) |
| error.clear(); |
| result = WebRequestCondition::Create(matcher.condition_factory(), |
| + first_party_matcher.condition_factory(), |
| valid_condition, &error); |
| EXPECT_EQ("", error); |
| ASSERT_TRUE(result.get()); |
| @@ -89,6 +96,7 @@ TEST(WebRequestConditionTest, CreateConditionSet) { |
| // Necessary for TestURLRequest. |
| MessageLoop message_loop(MessageLoop::TYPE_IO); |
| URLMatcher matcher; |
| + URLMatcher first_party_matcher; |
| ListValue* http_scheme_list = new ListValue(); |
| http_scheme_list->Append(Value::CreateStringValue("http")); |
| @@ -125,6 +133,7 @@ TEST(WebRequestConditionTest, CreateConditionSet) { |
| std::string error; |
| scoped_ptr<WebRequestConditionSet> result = |
| WebRequestConditionSet::Create(matcher.condition_factory(), |
| + first_party_matcher.condition_factory(), |
| conditions, &error); |
| EXPECT_EQ("", error); |
| ASSERT_TRUE(result.get()); |
| @@ -183,6 +192,7 @@ TEST(WebRequestConditionTest, TestPortFilter) { |
| // Necessary for TestURLRequest. |
| MessageLoop message_loop(MessageLoop::TYPE_IO); |
| URLMatcher matcher; |
| + URLMatcher first_party_matcher; |
| // Allow 80;1000-1010. |
| ListValue* port_range = new ListValue(); |
| @@ -210,6 +220,7 @@ TEST(WebRequestConditionTest, TestPortFilter) { |
| std::string error; |
| scoped_ptr<WebRequestConditionSet> result = |
| WebRequestConditionSet::Create(matcher.condition_factory(), |
| + first_party_matcher.condition_factory(), |
| conditions, &error); |
| EXPECT_EQ("", error); |
| ASSERT_TRUE(result.get()); |
| @@ -252,6 +263,7 @@ TEST(WebRequestConditionTest, ConditionsWithConflictingStages) { |
| // Necessary for TestURLRequest. |
| MessageLoop message_loop(MessageLoop::TYPE_IO); |
| URLMatcher matcher; |
| + URLMatcher first_party_matcher; |
| std::string error; |
| scoped_ptr<WebRequestCondition> result; |
| @@ -274,6 +286,7 @@ TEST(WebRequestConditionTest, ConditionsWithConflictingStages) { |
| // Test error on incompatible application stages for involved attributes. |
| error.clear(); |
| result = WebRequestCondition::Create(matcher.condition_factory(), |
| + first_party_matcher.condition_factory(), |
| condition_value, &error); |
| EXPECT_FALSE(error.empty()); |
| EXPECT_FALSE(result.get()); |