Index: chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc |
diff --git a/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc b/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc |
index 3d6895c559d3856079aab304eb38a3142c7e4d0d..7dbc6b285e7c75b871b695caaf7f0c67a48a0085 100644 |
--- a/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc |
+++ b/chrome/browser/extensions/api/declarative_webrequest/webrequest_rules_registry_unittest.cc |
@@ -101,28 +101,19 @@ class WebRequestRulesRegistryTest : public testing::Test { |
https_condition_url_filter.SetString(keys::kInstanceTypeKey, |
keys::kRequestMatcherType); |
- linked_ptr<json_schema_compiler::any::Any> condition1 = make_linked_ptr( |
- new json_schema_compiler::any::Any); |
- condition1->Init(http_condition_url_filter); |
- |
- linked_ptr<json_schema_compiler::any::Any> condition2 = make_linked_ptr( |
- new json_schema_compiler::any::Any); |
- condition2->Init(https_condition_url_filter); |
- |
DictionaryValue action_dict; |
action_dict.SetString(keys::kInstanceTypeKey, keys::kCancelRequestType); |
- linked_ptr<json_schema_compiler::any::Any> action1 = make_linked_ptr( |
- new json_schema_compiler::any::Any); |
- action1->Init(action_dict); |
- |
linked_ptr<RulesRegistry::Rule> rule = |
make_linked_ptr(new RulesRegistry::Rule); |
rule->id.reset(new std::string(kRuleId1)); |
rule->priority.reset(new int(100)); |
- rule->actions.push_back(action1); |
- rule->conditions.push_back(condition1); |
- rule->conditions.push_back(condition2); |
+ rule->actions.push_back( |
+ make_linked_ptr<base::Value>(action_dict.DeepCopy())); |
+ rule->conditions.push_back( |
+ linked_ptr<base::Value>(http_condition_url_filter.DeepCopy())); |
+ rule->conditions.push_back( |
+ linked_ptr<base::Value>(https_condition_url_filter.DeepCopy())); |
return rule; |
} |
@@ -131,23 +122,17 @@ class WebRequestRulesRegistryTest : public testing::Test { |
DictionaryValue condition_dict; |
condition_dict.SetString(keys::kInstanceTypeKey, keys::kRequestMatcherType); |
- linked_ptr<json_schema_compiler::any::Any> condition = make_linked_ptr( |
- new json_schema_compiler::any::Any); |
- condition->Init(condition_dict); |
- |
DictionaryValue action_dict; |
action_dict.SetString(keys::kInstanceTypeKey, keys::kCancelRequestType); |
- linked_ptr<json_schema_compiler::any::Any> action = make_linked_ptr( |
- new json_schema_compiler::any::Any); |
- action->Init(action_dict); |
- |
linked_ptr<RulesRegistry::Rule> rule = |
make_linked_ptr(new RulesRegistry::Rule); |
rule->id.reset(new std::string(kRuleId2)); |
rule->priority.reset(new int(100)); |
- rule->actions.push_back(action); |
- rule->conditions.push_back(condition); |
+ rule->actions.push_back( |
+ linked_ptr<base::Value>(action_dict.DeepCopy())); |
+ rule->conditions.push_back( |
+ linked_ptr<base::Value>(condition_dict.DeepCopy())); |
return rule; |
} |
@@ -156,52 +141,42 @@ class WebRequestRulesRegistryTest : public testing::Test { |
DictionaryValue condition_dict; |
condition_dict.SetString(keys::kInstanceTypeKey, keys::kRequestMatcherType); |
- linked_ptr<json_schema_compiler::any::Any> condition = make_linked_ptr( |
- new json_schema_compiler::any::Any); |
- condition->Init(condition_dict); |
- |
DictionaryValue action_dict; |
action_dict.SetString(keys::kInstanceTypeKey, keys::kRedirectRequestType); |
action_dict.SetString(keys::kRedirectUrlKey, destination); |
- linked_ptr<json_schema_compiler::any::Any> action = make_linked_ptr( |
- new json_schema_compiler::any::Any); |
- action->Init(action_dict); |
- |
linked_ptr<RulesRegistry::Rule> rule = |
make_linked_ptr(new RulesRegistry::Rule); |
rule->id.reset(new std::string(kRuleId3)); |
rule->priority.reset(new int(100)); |
- rule->actions.push_back(action); |
- rule->conditions.push_back(condition); |
+ rule->actions.push_back( |
+ linked_ptr<base::Value>(action_dict.DeepCopy())); |
+ rule->conditions.push_back( |
+ linked_ptr<base::Value>(condition_dict.DeepCopy())); |
return rule; |
} |
// Create a rule to ignore all other rules for a destination that |
// contains index.html. |
linked_ptr<RulesRegistry::Rule> CreateIgnoreRule() { |
- linked_ptr<json_schema_compiler::any::Any> condition = make_linked_ptr( |
- new json_schema_compiler::any::Any); |
DictionaryValue condition_dict; |
DictionaryValue* http_condition_dict = new DictionaryValue(); |
http_condition_dict->SetString(keys2::kPathContainsKey, "index.html"); |
condition_dict.SetString(keys::kInstanceTypeKey, keys::kRequestMatcherType); |
condition_dict.Set(keys::kUrlKey, http_condition_dict); |
- condition->Init(condition_dict); |
DictionaryValue action_dict; |
action_dict.SetString(keys::kInstanceTypeKey, keys::kIgnoreRulesType); |
action_dict.SetInteger(keys::kLowerPriorityThanKey, 150); |
- linked_ptr<json_schema_compiler::any::Any> action = make_linked_ptr( |
- new json_schema_compiler::any::Any); |
- action->Init(action_dict); |
linked_ptr<RulesRegistry::Rule> rule = |
make_linked_ptr(new RulesRegistry::Rule); |
rule->id.reset(new std::string(kRuleId4)); |
rule->priority.reset(new int(200)); |
- rule->actions.push_back(action); |
- rule->conditions.push_back(condition); |
+ rule->actions.push_back( |
+ linked_ptr<base::Value>(action_dict.DeepCopy())); |
+ rule->conditions.push_back( |
+ linked_ptr<base::Value>(condition_dict.DeepCopy())); |
return rule; |
} |