Index: components/policy/core/common/schema_unittest.cc |
diff --git a/components/policy/core/common/schema_unittest.cc b/components/policy/core/common/schema_unittest.cc |
index 1238f5a442ded96edd4d6d2c8b5e4d60102fa62a..9b40bad1503e34e3e164b7ea3591b4b199c78bc3 100644 |
--- a/components/policy/core/common/schema_unittest.cc |
+++ b/components/policy/core/common/schema_unittest.cc |
@@ -7,6 +7,7 @@ |
#include <stddef.h> |
#include <memory> |
+#include <utility> |
#include "base/macros.h" |
#include "base/strings/stringprintf.h" |
@@ -770,9 +771,10 @@ TEST(SchemaTest, Validate) { |
base::ListValue root; |
// Unknown property. |
- base::DictionaryValue* dict_value = new base::DictionaryValue(); |
+ std::unique_ptr<base::DictionaryValue> dict_value( |
+ new base::DictionaryValue()); |
dict_value->SetBoolean("three", true); |
- root.Append(dict_value); // Pass ownership to root. |
+ root.Append(std::move(dict_value)); |
TestSchemaValidation(subschema, root, SCHEMA_STRICT, false); |
TestSchemaValidation(subschema, root, SCHEMA_ALLOW_UNKNOWN_TOPLEVEL, false); |
TestSchemaValidation(subschema, root, SCHEMA_ALLOW_UNKNOWN, true); |
@@ -782,9 +784,9 @@ TEST(SchemaTest, Validate) { |
root.Remove(root.GetSize() - 1, NULL); |
// Invalid property. |
- dict_value = new base::DictionaryValue(); |
+ dict_value.reset(new base::DictionaryValue()); |
dict_value->SetBoolean("two", true); |
- root.Append(dict_value); // Pass ownership to root. |
+ root.Append(std::move(dict_value)); |
TestSchemaValidation(subschema, root, SCHEMA_STRICT, false); |
TestSchemaValidation(subschema, root, SCHEMA_ALLOW_UNKNOWN_TOPLEVEL, false); |
TestSchemaValidation(subschema, root, SCHEMA_ALLOW_UNKNOWN, false); |
@@ -828,9 +830,10 @@ TEST(SchemaTest, Validate) { |
base::ListValue root; |
base::ListValue* list_value = new base::ListValue(); |
- base::DictionaryValue* dict_value = new base::DictionaryValue(); |
+ std::unique_ptr<base::DictionaryValue> dict_value( |
+ new base::DictionaryValue()); |
dict_value->Set("List", list_value); // Pass ownership to dict_value. |
- root.Append(dict_value); // Pass ownership to root. |
+ root.Append(std::move(dict_value)); |
// Test that there are not errors here. |
list_value->AppendString("blabla"); |