Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Unified Diff: extensions/browser/api/declarative/declarative_rule_unittest.cc

Issue 822453002: Introduce HostID and de-couple Extensions from "script injection System" [browser side] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: extensions/browser/api/declarative/declarative_rule_unittest.cc
diff --git a/extensions/browser/api/declarative/declarative_rule_unittest.cc b/extensions/browser/api/declarative/declarative_rule_unittest.cc
index 552145d1fe612e74754d6b7fc5f4d99e75859eab..3c4163ba2df6ff37a960bd638dbd5952b89dbed9 100644
--- a/extensions/browser/api/declarative/declarative_rule_unittest.cc
+++ b/extensions/browser/api/declarative/declarative_rule_unittest.cc
@@ -219,6 +219,7 @@ class SummingAction : public base::RefCounted<SummingAction> {
static scoped_refptr<const SummingAction> Create(
content::BrowserContext* browser_context,
+ const HostID& host_id,
const Extension* extension,
const base::Value& action,
std::string* error,
@@ -270,7 +271,7 @@ TEST(DeclarativeActionTest, ErrorActionSet) {
std::string error;
bool bad = false;
scoped_ptr<SummingActionSet> result =
- SummingActionSet::Create(NULL, NULL, actions, &error, &bad);
+ SummingActionSet::Create(NULL, HostID(), NULL, actions, &error, &bad);
EXPECT_EQ("the error", error);
EXPECT_FALSE(bad);
EXPECT_FALSE(result);
@@ -278,7 +279,8 @@ TEST(DeclarativeActionTest, ErrorActionSet) {
actions.clear();
actions.push_back(ScopedToLinkedPtr(ParseJson("{\"value\": 1}")));
actions.push_back(ScopedToLinkedPtr(ParseJson("{\"bad\": 3}")));
- result = SummingActionSet::Create(NULL, NULL, actions, &error, &bad);
+ result = SummingActionSet::Create(
+ NULL, HostID(), NULL, actions, &error, &bad);
EXPECT_EQ("", error);
EXPECT_TRUE(bad);
EXPECT_FALSE(result);
@@ -295,7 +297,7 @@ TEST(DeclarativeActionTest, ApplyActionSet) {
std::string error;
bool bad = false;
scoped_ptr<SummingActionSet> result =
- SummingActionSet::Create(NULL, NULL, actions, &error, &bad);
+ SummingActionSet::Create(NULL, HostID(), NULL, actions, &error, &bad);
EXPECT_EQ("", error);
EXPECT_FALSE(bad);
ASSERT_TRUE(result);
@@ -336,13 +338,15 @@ TEST(DeclarativeRuleTest, Create) {
URLMatcher matcher;
std::string error;
- scoped_ptr<Rule> rule(Rule::Create(matcher.condition_factory(),
- NULL,
- extension.get(),
- install_time,
- json_rule,
- Rule::ConsistencyChecker(),
- &error));
+ scoped_ptr<Rule> rule(
+ Rule::Create(matcher.condition_factory(),
+ NULL,
+ HostID(HostID::EXTENSIONS, extension.get()->id()),
+ extension.get(),
+ install_time,
+ json_rule,
+ Rule::ConsistencyChecker(),
+ &error));
EXPECT_EQ("", error);
ASSERT_TRUE(rule.get());
@@ -405,13 +409,15 @@ TEST(DeclarativeRuleTest, CheckConsistency) {
" \"priority\": 200 \n"
"}"),
json_rule.get()));
- scoped_ptr<Rule> rule(Rule::Create(matcher.condition_factory(),
- NULL,
- extension.get(),
- base::Time(),
- json_rule,
- base::Bind(AtLeastOneCondition),
- &error));
+ scoped_ptr<Rule> rule(
+ Rule::Create(matcher.condition_factory(),
+ NULL,
+ HostID(HostID::EXTENSIONS, extension.get()->id()),
+ extension.get(),
+ base::Time(),
+ json_rule,
+ base::Bind(AtLeastOneCondition),
+ &error));
EXPECT_TRUE(rule);
EXPECT_EQ("", error);
@@ -430,6 +436,7 @@ TEST(DeclarativeRuleTest, CheckConsistency) {
json_rule.get()));
rule = Rule::Create(matcher.condition_factory(),
NULL,
+ HostID(HostID::EXTENSIONS, extension.get()->id()),
extension.get(),
base::Time(),
json_rule,

Powered by Google App Engine
This is Rietveld 408576698