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

Unified Diff: components/policy/core/common/preg_parser_win_unittest.cc

Issue 1902633006: Convert //components/policy from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments and use namespace alias 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: components/policy/core/common/preg_parser_win_unittest.cc
diff --git a/components/policy/core/common/preg_parser_win_unittest.cc b/components/policy/core/common/preg_parser_win_unittest.cc
index 220062ecb4f1bbfe06869f49c97df34f8cb2955b..8bd16f0eaf60b1bdafe157cbdbf8d07b6cce2da2 100644
--- a/components/policy/core/common/preg_parser_win_unittest.cc
+++ b/components/policy/core/common/preg_parser_win_unittest.cc
@@ -10,6 +10,7 @@
#include "base/files/file_path.h"
#include "base/json/json_writer.h"
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
#include "base/path_service.h"
#include "base/values.h"
#include "components/policy/core/common/policy_load_status.h"
@@ -58,16 +59,14 @@ void SetInteger(RegistryDict* dict,
const std::string& name,
int value) {
dict->SetValue(
- name,
- make_scoped_ptr<base::Value>(new base::FundamentalValue(value)));
+ name, base::WrapUnique<base::Value>(new base::FundamentalValue(value)));
}
void SetString(RegistryDict* dict,
const std::string& name,
const std::string& value) {
- dict->SetValue(
- name,
- make_scoped_ptr<base::Value>(new base::StringValue(value)));
+ dict->SetValue(name,
+ base::WrapUnique<base::Value>(new base::StringValue(value)));
}
TEST(PRegParserWinTest, TestParseFile) {
@@ -79,15 +78,15 @@ TEST(PRegParserWinTest, TestParseFile) {
RegistryDict dict;
SetInteger(&dict, "DeleteValuesTest1", 1);
SetString(&dict, "DeleteValuesTest2", "2");
- dict.SetKey("DeleteKeysTest1", make_scoped_ptr(new RegistryDict()));
- scoped_ptr<RegistryDict> delete_keys_test(new RegistryDict());
+ dict.SetKey("DeleteKeysTest1", base::WrapUnique(new RegistryDict()));
+ std::unique_ptr<RegistryDict> delete_keys_test(new RegistryDict());
SetInteger(delete_keys_test.get(), "DeleteKeysTest2Entry", 1);
dict.SetKey("DeleteKeysTest2", std::move(delete_keys_test));
SetInteger(&dict, "DelTest", 1);
- scoped_ptr<RegistryDict> subdict(new RegistryDict());
+ std::unique_ptr<RegistryDict> subdict(new RegistryDict());
SetInteger(subdict.get(), "DelValsTest1", 1);
SetString(subdict.get(), "DelValsTest2", "2");
- subdict->SetKey("DelValsTest3", make_scoped_ptr(new RegistryDict()));
+ subdict->SetKey("DelValsTest3", base::WrapUnique(new RegistryDict()));
dict.SetKey("DelValsTest", std::move(subdict));
// Run the parser.
@@ -99,13 +98,13 @@ TEST(PRegParserWinTest, TestParseFile) {
// Build the expected output dictionary.
RegistryDict expected;
- scoped_ptr<RegistryDict> del_vals_dict(new RegistryDict());
- del_vals_dict->SetKey("DelValsTest3", make_scoped_ptr(new RegistryDict()));
+ std::unique_ptr<RegistryDict> del_vals_dict(new RegistryDict());
+ del_vals_dict->SetKey("DelValsTest3", base::WrapUnique(new RegistryDict()));
expected.SetKey("DelValsTest", std::move(del_vals_dict));
SetInteger(&expected, "HomepageIsNewTabPage", 1);
SetString(&expected, "HomepageLocation", "http://www.example.com");
SetInteger(&expected, "RestoreOnStartup", 4);
- scoped_ptr<RegistryDict> startup_urls(new RegistryDict());
+ std::unique_ptr<RegistryDict> startup_urls(new RegistryDict());
SetString(startup_urls.get(), "1", "http://www.chromium.org");
SetString(startup_urls.get(), "2", "http://www.example.com");
expected.SetKey("RestoreOnStartupURLs", std::move(startup_urls));
« no previous file with comments | « components/policy/core/common/preg_parser_win.cc ('k') | components/policy/core/common/proxy_policy_provider.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698