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

Unified Diff: components/url_matcher/url_matcher_factory_unittest.cc

Issue 2889163002: Remove raw DictionaryValue::Set in //components (Closed)
Patch Set: Nits Created 3 years, 7 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
« no previous file with comments | « components/sync_wifi/wifi_credential.cc ('k') | components/webcrypto/algorithms/aes_cbc_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/url_matcher/url_matcher_factory_unittest.cc
diff --git a/components/url_matcher/url_matcher_factory_unittest.cc b/components/url_matcher/url_matcher_factory_unittest.cc
index 3e51023d98476eab4091f61e1005ed1ddd6ff114..bb598348976ad900f74e254c818423764d10b463 100644
--- a/components/url_matcher/url_matcher_factory_unittest.cc
+++ b/components/url_matcher/url_matcher_factory_unittest.cc
@@ -34,7 +34,8 @@ TEST(URLMatcherFactoryTest, CreateFromURLFilterDictionary) {
// Invalid value type: {"hostSuffix": []}
base::DictionaryValue invalid_condition2;
- invalid_condition2.Set(keys::kHostSuffixKey, new base::ListValue);
+ invalid_condition2.Set(keys::kHostSuffixKey,
+ base::MakeUnique<base::ListValue>());
// Invalid regex value: {"urlMatches": "*"}
base::DictionaryValue invalid_condition3;
@@ -53,21 +54,21 @@ TEST(URLMatcherFactoryTest, CreateFromURLFilterDictionary) {
// }
// Port range: Allow 80;1000-1010.
- std::unique_ptr<base::ListValue> port_range(new base::ListValue());
+ auto port_range = base::MakeUnique<base::ListValue>();
port_range->AppendInteger(1000);
port_range->AppendInteger(1010);
- base::ListValue* port_ranges = new base::ListValue();
+ auto port_ranges = base::MakeUnique<base::ListValue>();
port_ranges->AppendInteger(80);
port_ranges->Append(std::move(port_range));
- base::ListValue* scheme_list = new base::ListValue();
+ auto scheme_list = base::MakeUnique<base::ListValue>();
scheme_list->AppendString("http");
base::DictionaryValue valid_condition;
valid_condition.SetString(keys::kHostSuffixKey, "example.com");
valid_condition.SetString(keys::kHostPrefixKey, "www");
- valid_condition.Set(keys::kPortsKey, port_ranges);
- valid_condition.Set(keys::kSchemesKey, scheme_list);
+ valid_condition.Set(keys::kPortsKey, std::move(port_ranges));
+ valid_condition.Set(keys::kSchemesKey, std::move(scheme_list));
// Test wrong condition name passed.
error.clear();
@@ -142,10 +143,10 @@ TEST(URLMatcherFactoryTest, UpperCase) {
invalid_condition4.SetString(keys::kHostEqualsKey, "WWW.example.Com");
// {"scheme": ["HTTP"]}
- base::ListValue* scheme_list = new base::ListValue();
+ auto scheme_list = base::MakeUnique<base::ListValue>();
scheme_list->AppendString("HTTP");
base::DictionaryValue invalid_condition5;
- invalid_condition5.Set(keys::kSchemesKey, scheme_list);
+ invalid_condition5.Set(keys::kSchemesKey, std::move(scheme_list));
const base::DictionaryValue* invalid_conditions[] = {
&invalid_condition1,
« no previous file with comments | « components/sync_wifi/wifi_credential.cc ('k') | components/webcrypto/algorithms/aes_cbc_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698