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

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

Issue 1902873002: Convert //extensions/browser/api from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 93ec58b4026fbf83c5a689c1caf380f87e5bcf11..fae5a6ebf5a433b63dc69f067380603364db2a9a 100644
--- a/extensions/browser/api/declarative/declarative_rule_unittest.cc
+++ b/extensions/browser/api/declarative/declarative_rule_unittest.cc
@@ -22,7 +22,7 @@ namespace extensions {
namespace {
-scoped_ptr<base::DictionaryValue> SimpleManifest() {
+std::unique_ptr<base::DictionaryValue> SimpleManifest() {
return DictionaryBuilder()
.Set("name", "extension")
.Set("manifest_version", 2)
@@ -36,14 +36,14 @@ struct RecordingCondition {
typedef int MatchData;
URLMatcherConditionFactory* factory;
- scoped_ptr<base::Value> value;
+ std::unique_ptr<base::Value> value;
void GetURLMatcherConditionSets(
URLMatcherConditionSet::Vector* condition_sets) const {
// No condition sets.
}
- static scoped_ptr<RecordingCondition> Create(
+ static std::unique_ptr<RecordingCondition> Create(
const Extension* extension,
URLMatcherConditionFactory* url_matcher_condition_factory,
const base::Value& condition,
@@ -51,10 +51,10 @@ struct RecordingCondition {
const base::DictionaryValue* dict = NULL;
if (condition.GetAsDictionary(&dict) && dict->HasKey("bad_key")) {
*error = "Found error key";
- return scoped_ptr<RecordingCondition>();
+ return std::unique_ptr<RecordingCondition>();
}
- scoped_ptr<RecordingCondition> result(new RecordingCondition());
+ std::unique_ptr<RecordingCondition> result(new RecordingCondition());
result->factory = url_matcher_condition_factory;
result->value.reset(condition.DeepCopy());
return result;
@@ -69,7 +69,7 @@ TEST(DeclarativeConditionTest, ErrorConditionSet) {
conditions.push_back(ParseJson("{\"bad_key\": 2}"));
std::string error;
- scoped_ptr<RecordingConditionSet> result = RecordingConditionSet::Create(
+ std::unique_ptr<RecordingConditionSet> result = RecordingConditionSet::Create(
NULL, matcher.condition_factory(), conditions, &error);
EXPECT_EQ("Found error key", error);
ASSERT_FALSE(result);
@@ -83,7 +83,7 @@ TEST(DeclarativeConditionTest, CreateConditionSet) {
// Test insertion
std::string error;
- scoped_ptr<RecordingConditionSet> result = RecordingConditionSet::Create(
+ std::unique_ptr<RecordingConditionSet> result = RecordingConditionSet::Create(
NULL, matcher.condition_factory(), conditions, &error);
EXPECT_EQ("", error);
ASSERT_TRUE(result);
@@ -125,12 +125,12 @@ struct FulfillableCondition {
return match_data.value <= max_value;
}
- static scoped_ptr<FulfillableCondition> Create(
+ static std::unique_ptr<FulfillableCondition> Create(
const Extension* extension,
URLMatcherConditionFactory* url_matcher_condition_factory,
const base::Value& condition,
std::string* error) {
- scoped_ptr<FulfillableCondition> result(new FulfillableCondition());
+ std::unique_ptr<FulfillableCondition> result(new FulfillableCondition());
const base::DictionaryValue* dict;
if (!condition.GetAsDictionary(&dict)) {
*error = "Expected dict";
@@ -159,7 +159,7 @@ TEST(DeclarativeConditionTest, FulfillConditionSet) {
// Test insertion
std::string error;
- scoped_ptr<FulfillableConditionSet> result =
+ std::unique_ptr<FulfillableConditionSet> result =
FulfillableConditionSet::Create(NULL, NULL, conditions, &error);
ASSERT_EQ("", error);
ASSERT_TRUE(result);
@@ -260,7 +260,7 @@ TEST(DeclarativeActionTest, ErrorActionSet) {
std::string error;
bool bad = false;
- scoped_ptr<SummingActionSet> result =
+ std::unique_ptr<SummingActionSet> result =
SummingActionSet::Create(NULL, NULL, actions, &error, &bad);
EXPECT_EQ("the error", error);
EXPECT_FALSE(bad);
@@ -285,7 +285,7 @@ TEST(DeclarativeActionTest, ApplyActionSet) {
// Test insertion
std::string error;
bool bad = false;
- scoped_ptr<SummingActionSet> result =
+ std::unique_ptr<SummingActionSet> result =
SummingActionSet::Create(NULL, NULL, actions, &error, &bad);
EXPECT_EQ("", error);
EXPECT_FALSE(bad);
@@ -327,13 +327,9 @@ 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));
+ std::unique_ptr<Rule> rule(Rule::Create(
+ matcher.condition_factory(), NULL, extension.get(), install_time,
+ json_rule, Rule::ConsistencyChecker(), &error));
EXPECT_EQ("", error);
ASSERT_TRUE(rule.get());
@@ -396,13 +392,9 @@ 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));
+ std::unique_ptr<Rule> rule(Rule::Create(
+ matcher.condition_factory(), NULL, extension.get(), base::Time(),
+ json_rule, base::Bind(AtLeastOneCondition), &error));
EXPECT_TRUE(rule);
EXPECT_EQ("", error);
« no previous file with comments | « extensions/browser/api/declarative/declarative_rule.h ('k') | extensions/browser/api/declarative/deduping_factory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698