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 3bab5479aedc1352f859907832ed36e4f0e3c38d..5f6b7221ada6e88feabe7cc8f9fa8c3c9d767ba0 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 |
@@ -6,13 +6,13 @@ |
#include <stddef.h> |
+#include <memory> |
#include <string> |
#include <vector> |
#include "base/json/json_reader.h" |
#include "base/macros.h" |
#include "base/memory/linked_ptr.h" |
-#include "base/memory/scoped_ptr.h" |
#include "base/message_loop/message_loop.h" |
#include "base/stl_util.h" |
#include "base/test/values_test_util.h" |
@@ -188,7 +188,7 @@ class WebRequestRulesRegistryTest : public testing::Test { |
// Create a condition with the attributes specified. An example value of |
// |attributes| is: "\"resourceType\": [\"stylesheet\"], \n". |
- scoped_ptr<base::Value> CreateCondition(const std::string& attributes) { |
+ std::unique_ptr<base::Value> CreateCondition(const std::string& attributes) { |
std::string json_description = |
"{ \n" |
" \"instanceType\": \"declarativeWebRequest.RequestMatcher\", \n"; |
@@ -278,8 +278,8 @@ TEST_F(WebRequestRulesRegistryTest, AddRulesImpl) { |
GURL http_url("http://www.example.com"); |
net::TestURLRequestContext context; |
- scoped_ptr<net::URLRequest> http_request(context.CreateRequest( |
- http_url, net::DEFAULT_PRIORITY, NULL)); |
+ std::unique_ptr<net::URLRequest> http_request( |
+ context.CreateRequest(http_url, net::DEFAULT_PRIORITY, NULL)); |
WebRequestData request_data(http_request.get(), ON_BEFORE_REQUEST); |
matches = registry->GetMatches(request_data); |
EXPECT_EQ(2u, matches.size()); |
@@ -292,8 +292,8 @@ TEST_F(WebRequestRulesRegistryTest, AddRulesImpl) { |
EXPECT_TRUE(ContainsKey(matches_ids, std::make_pair(kExtensionId, kRuleId2))); |
GURL foobar_url("http://www.foobar.com"); |
- scoped_ptr<net::URLRequest> foobar_request(context.CreateRequest( |
- foobar_url, net::DEFAULT_PRIORITY, NULL)); |
+ std::unique_ptr<net::URLRequest> foobar_request( |
+ context.CreateRequest(foobar_url, net::DEFAULT_PRIORITY, NULL)); |
request_data.request = foobar_request.get(); |
matches = registry->GetMatches(request_data); |
EXPECT_EQ(1u, matches.size()); |
@@ -419,8 +419,8 @@ TEST_F(WebRequestRulesRegistryTest, Precedences) { |
GURL url("http://www.google.com"); |
net::TestURLRequestContext context; |
- scoped_ptr<net::URLRequest> request(context.CreateRequest( |
- url, net::DEFAULT_PRIORITY, NULL)); |
+ std::unique_ptr<net::URLRequest> request( |
+ context.CreateRequest(url, net::DEFAULT_PRIORITY, NULL)); |
WebRequestData request_data(request.get(), ON_BEFORE_REQUEST); |
std::list<LinkedPtrEventResponseDelta> deltas = |
registry->CreateDeltas(NULL, request_data, false); |
@@ -468,8 +468,8 @@ TEST_F(WebRequestRulesRegistryTest, Priorities) { |
GURL url("http://www.google.com/index.html"); |
net::TestURLRequestContext context; |
- scoped_ptr<net::URLRequest> request(context.CreateRequest( |
- url, net::DEFAULT_PRIORITY, NULL)); |
+ std::unique_ptr<net::URLRequest> request( |
+ context.CreateRequest(url, net::DEFAULT_PRIORITY, NULL)); |
WebRequestData request_data(request.get(), ON_BEFORE_REQUEST); |
std::list<LinkedPtrEventResponseDelta> deltas = |
registry->CreateDeltas(NULL, request_data, false); |
@@ -523,9 +523,9 @@ TEST_F(WebRequestRulesRegistryTest, IgnoreRulesByTag) { |
" \"priority\": 300 \n" |
"} "; |
- scoped_ptr<base::Value> value1 = base::JSONReader::Read(kRule1); |
+ std::unique_ptr<base::Value> value1 = base::JSONReader::Read(kRule1); |
ASSERT_TRUE(value1.get()); |
- scoped_ptr<base::Value> value2 = base::JSONReader::Read(kRule2); |
+ std::unique_ptr<base::Value> value2 = base::JSONReader::Read(kRule2); |
ASSERT_TRUE(value2.get()); |
std::vector<linked_ptr<api::events::Rule>> rules; |
@@ -542,8 +542,8 @@ TEST_F(WebRequestRulesRegistryTest, IgnoreRulesByTag) { |
GURL url("http://www.foo.com/test"); |
net::TestURLRequestContext context; |
- scoped_ptr<net::URLRequest> request(context.CreateRequest( |
- url, net::DEFAULT_PRIORITY, NULL)); |
+ std::unique_ptr<net::URLRequest> request( |
+ context.CreateRequest(url, net::DEFAULT_PRIORITY, NULL)); |
WebRequestData request_data(request.get(), ON_BEFORE_REQUEST); |
std::list<LinkedPtrEventResponseDelta> deltas = |
registry->CreateDeltas(NULL, request_data, false); |
@@ -592,8 +592,8 @@ TEST_F(WebRequestRulesRegistryTest, GetMatchesCheckFulfilled) { |
GURL http_url("http://www.example.com"); |
net::TestURLRequestContext context; |
- scoped_ptr<net::URLRequest> http_request(context.CreateRequest( |
- http_url, net::DEFAULT_PRIORITY, NULL)); |
+ std::unique_ptr<net::URLRequest> http_request( |
+ context.CreateRequest(http_url, net::DEFAULT_PRIORITY, NULL)); |
WebRequestData request_data(http_request.get(), ON_BEFORE_REQUEST); |
matches = registry->GetMatches(request_data); |
EXPECT_EQ(1u, matches.size()); |
@@ -651,8 +651,8 @@ TEST_F(WebRequestRulesRegistryTest, GetMatchesDifferentUrls) { |
for (size_t i = 0; i < arraysize(matchingRuleIds); ++i) { |
// Construct the inputs. |
- scoped_ptr<net::URLRequest> http_request(context.CreateRequest( |
- urls[i], net::DEFAULT_PRIORITY, NULL)); |
+ std::unique_ptr<net::URLRequest> http_request( |
+ context.CreateRequest(urls[i], net::DEFAULT_PRIORITY, NULL)); |
WebRequestData request_data(http_request.get(), ON_BEFORE_REQUEST); |
http_request->set_first_party_for_cookies(firstPartyUrls[i]); |
// Now run both rules on the input. |
@@ -692,7 +692,7 @@ TEST(WebRequestRulesRegistrySimpleTest, StageChecker) { |
" \"priority\": 200 \n" |
"} "; |
- scoped_ptr<base::Value> value = base::JSONReader::Read(kRule); |
+ std::unique_ptr<base::Value> value = base::JSONReader::Read(kRule); |
ASSERT_TRUE(value); |
api::events::Rule rule; |
@@ -700,16 +700,15 @@ TEST(WebRequestRulesRegistrySimpleTest, StageChecker) { |
std::string error; |
URLMatcher matcher; |
- scoped_ptr<WebRequestConditionSet> conditions = |
- WebRequestConditionSet::Create( |
- NULL, matcher.condition_factory(), rule.conditions, &error); |
+ std::unique_ptr<WebRequestConditionSet> conditions = |
+ WebRequestConditionSet::Create(NULL, matcher.condition_factory(), |
+ rule.conditions, &error); |
ASSERT_TRUE(error.empty()) << error; |
ASSERT_TRUE(conditions); |
bool bad_message = false; |
- scoped_ptr<WebRequestActionSet> actions = |
- WebRequestActionSet::Create( |
- NULL, NULL, rule.actions, &error, &bad_message); |
+ std::unique_ptr<WebRequestActionSet> actions = WebRequestActionSet::Create( |
+ NULL, NULL, rule.actions, &error, &bad_message); |
ASSERT_TRUE(error.empty()) << error; |
ASSERT_FALSE(bad_message); |
ASSERT_TRUE(actions); |
@@ -726,7 +725,7 @@ TEST(WebRequestRulesRegistrySimpleTest, HostPermissionsChecker) { |
" \"instanceType\": \"declarativeWebRequest.RedirectRequest\",\n" |
" \"redirectUrl\": \"http://bar.com\" \n" |
"} "; |
- scoped_ptr<base::Value> action_value = base::JSONReader::Read(kAction); |
+ std::unique_ptr<base::Value> action_value = base::JSONReader::Read(kAction); |
ASSERT_TRUE(action_value); |
WebRequestActionSet::Values actions; |
@@ -735,7 +734,7 @@ TEST(WebRequestRulesRegistrySimpleTest, HostPermissionsChecker) { |
std::string error; |
bool bad_message = false; |
- scoped_ptr<WebRequestActionSet> action_set( |
+ std::unique_ptr<WebRequestActionSet> action_set( |
WebRequestActionSet::Create(NULL, NULL, actions, &error, &bad_message)); |
ASSERT_TRUE(error.empty()) << error; |
ASSERT_FALSE(bad_message); |
@@ -782,7 +781,7 @@ TEST_F(WebRequestRulesRegistryTest, CheckOriginAndPathRegEx) { |
" \"priority\": 200 \n" |
"} "; |
- scoped_ptr<base::Value> value = base::JSONReader::Read(kRule); |
+ std::unique_ptr<base::Value> value = base::JSONReader::Read(kRule); |
ASSERT_TRUE(value.get()); |
std::vector<linked_ptr<api::events::Rule>> rules; |
@@ -801,16 +800,16 @@ TEST_F(WebRequestRulesRegistryTest, CheckOriginAndPathRegEx) { |
// No match because match is in the query parameter. |
GURL url1("http://bar.com/index.html?foo.com"); |
- scoped_ptr<net::URLRequest> request1(context.CreateRequest( |
- url1, net::DEFAULT_PRIORITY, NULL)); |
+ std::unique_ptr<net::URLRequest> request1( |
+ context.CreateRequest(url1, net::DEFAULT_PRIORITY, NULL)); |
WebRequestData request_data1(request1.get(), ON_BEFORE_REQUEST); |
deltas = registry->CreateDeltas(NULL, request_data1, false); |
EXPECT_EQ(0u, deltas.size()); |
// This is a correct match. |
GURL url2("http://foo.com/index.html"); |
- scoped_ptr<net::URLRequest> request2(context.CreateRequest( |
- url2, net::DEFAULT_PRIORITY, NULL)); |
+ std::unique_ptr<net::URLRequest> request2( |
+ context.CreateRequest(url2, net::DEFAULT_PRIORITY, NULL)); |
WebRequestData request_data2(request2.get(), ON_BEFORE_REQUEST); |
deltas = registry->CreateDeltas(NULL, request_data2, false); |
EXPECT_EQ(1u, deltas.size()); |