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

Unified Diff: chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker_unittest.cc

Issue 1871713002: Convert //chrome/browser/extensions from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and fix header 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: chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker_unittest.cc
diff --git a/chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker_unittest.cc b/chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker_unittest.cc
index ef8415096c76f5e3b67b4696b106d0690e08ae10..ef8dad962ab71f63f3765a99fd91608a7e65f9b8 100644
--- a/chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker_unittest.cc
+++ b/chrome/browser/extensions/api/declarative_content/declarative_content_page_url_condition_tracker_unittest.cc
@@ -59,8 +59,9 @@ class DeclarativeContentPageUrlConditionTrackerTest
}
// Creates a predicate with appropriate expectations of success.
- scoped_ptr<const ContentPredicate> CreatePredicate(const std::string& value) {
- scoped_ptr<const ContentPredicate> predicate;
+ std::unique_ptr<const ContentPredicate> CreatePredicate(
+ const std::string& value) {
+ std::unique_ptr<const ContentPredicate> predicate;
CreatePredicateImpl(value, &predicate);
return predicate;
}
@@ -77,7 +78,7 @@ class DeclarativeContentPageUrlConditionTrackerTest
// This function exists to work around the gtest limitation that functions
// with fatal assertions must return void.
void CreatePredicateImpl(const std::string& value,
- scoped_ptr<const ContentPredicate>* predicate) {
+ std::unique_ptr<const ContentPredicate>* predicate) {
std::string error;
*predicate = tracker_.CreatePredicate(
nullptr,
@@ -93,11 +94,10 @@ class DeclarativeContentPageUrlConditionTrackerTest
TEST(DeclarativeContentPageUrlPredicateTest, WrongPageUrlDatatype) {
url_matcher::URLMatcher matcher;
std::string error;
- scoped_ptr<DeclarativeContentPageUrlPredicate> predicate =
- DeclarativeContentPageUrlPredicate::Create(nullptr,
- matcher.condition_factory(),
- *base::test::ParseJson("[]"),
- &error);
+ std::unique_ptr<DeclarativeContentPageUrlPredicate> predicate =
+ DeclarativeContentPageUrlPredicate::Create(
+ nullptr, matcher.condition_factory(), *base::test::ParseJson("[]"),
+ &error);
EXPECT_THAT(error, HasSubstr("invalid type"));
EXPECT_FALSE(predicate);
@@ -107,12 +107,10 @@ TEST(DeclarativeContentPageUrlPredicateTest, WrongPageUrlDatatype) {
TEST(DeclarativeContentPageUrlPredicateTest, PageUrlPredicate) {
url_matcher::URLMatcher matcher;
std::string error;
- scoped_ptr<DeclarativeContentPageUrlPredicate> predicate =
+ std::unique_ptr<DeclarativeContentPageUrlPredicate> predicate =
DeclarativeContentPageUrlPredicate::Create(
- nullptr,
- matcher.condition_factory(),
- *base::test::ParseJson("{\"hostSuffix\": \"example.com\"}"),
- &error);
+ nullptr, matcher.condition_factory(),
+ *base::test::ParseJson("{\"hostSuffix\": \"example.com\"}"), &error);
EXPECT_EQ("", error);
ASSERT_TRUE(predicate);
@@ -134,7 +132,7 @@ TEST(DeclarativeContentPageUrlPredicateTest, PageUrlPredicate) {
// the matching WebContents.
TEST_F(DeclarativeContentPageUrlConditionTrackerTest, AddAndRemovePredicates) {
// Create four tabs.
- std::vector<scoped_ptr<content::WebContents>> tabs;
+ std::vector<std::unique_ptr<content::WebContents>> tabs;
for (int i = 0; i < 4; ++i) {
tabs.push_back(MakeTab());
delegate_.evaluation_requests().clear();
@@ -149,7 +147,7 @@ TEST_F(DeclarativeContentPageUrlConditionTrackerTest, AddAndRemovePredicates) {
LoadURL(tabs[1].get(), GURL("http://test2/"));
LoadURL(tabs[2].get(), GURL("http://test3/"));
- std::vector<scoped_ptr<const ContentPredicate>> predicates;
+ std::vector<std::unique_ptr<const ContentPredicate>> predicates;
std::string error;
predicates.push_back(CreatePredicate("{\"hostPrefix\": \"test1\"}"));
predicates.push_back(CreatePredicate("{\"hostPrefix\": \"test2\"}"));
@@ -201,7 +199,7 @@ TEST_F(DeclarativeContentPageUrlConditionTrackerTest, AddAndRemovePredicates) {
// rules.
TEST_F(DeclarativeContentPageUrlConditionTrackerTest, TrackWebContents) {
std::string error;
- scoped_ptr<const ContentPredicate> predicate =
+ std::unique_ptr<const ContentPredicate> predicate =
CreatePredicate("{\"hostPrefix\": \"test1\"}");
delegate_.evaluation_requests().clear();
@@ -211,7 +209,7 @@ TEST_F(DeclarativeContentPageUrlConditionTrackerTest, TrackWebContents) {
tracker_.TrackPredicates(predicates);
EXPECT_TRUE(delegate_.evaluation_requests().empty());
- const scoped_ptr<content::WebContents> matching_tab = MakeTab();
+ const std::unique_ptr<content::WebContents> matching_tab = MakeTab();
LoadURL(matching_tab.get(), GURL("http://test1/"));
tracker_.TrackForWebContents(matching_tab.get());
@@ -219,7 +217,7 @@ TEST_F(DeclarativeContentPageUrlConditionTrackerTest, TrackWebContents) {
UnorderedElementsAre(matching_tab.get()));
delegate_.evaluation_requests().clear();
- const scoped_ptr<content::WebContents> non_matching_tab = MakeTab();
+ const std::unique_ptr<content::WebContents> non_matching_tab = MakeTab();
tracker_.TrackForWebContents(non_matching_tab.get());
EXPECT_THAT(delegate_.evaluation_requests(),
UnorderedElementsAre(non_matching_tab.get()));
@@ -235,7 +233,7 @@ TEST_F(DeclarativeContentPageUrlConditionTrackerTest, TrackWebContents) {
TEST_F(DeclarativeContentPageUrlConditionTrackerTest,
NotifyWebContentsNavigation) {
std::string error;
- scoped_ptr<const ContentPredicate> predicate =
+ std::unique_ptr<const ContentPredicate> predicate =
CreatePredicate("{\"hostPrefix\": \"test1\"}");
delegate_.evaluation_requests().clear();
@@ -245,7 +243,7 @@ TEST_F(DeclarativeContentPageUrlConditionTrackerTest,
tracker_.TrackPredicates(predicates);
EXPECT_TRUE(delegate_.evaluation_requests().empty());
- const scoped_ptr<content::WebContents> tab = MakeTab();
+ const std::unique_ptr<content::WebContents> tab = MakeTab();
tracker_.TrackForWebContents(tab.get());
EXPECT_THAT(delegate_.evaluation_requests(),
UnorderedElementsAre(tab.get()));

Powered by Google App Engine
This is Rietveld 408576698