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

Side by Side Diff: components/policy/core/common/preg_parser_win_unittest.cc

Issue 1752233002: Convert Pass()→std::move() on Windows (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/policy/core/common/preg_parser_win.h" 5 #include "components/policy/core/common/preg_parser_win.h"
6 6
7 #include <utility>
8
7 #include "base/base_paths.h" 9 #include "base/base_paths.h"
8 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
9 #include "base/json/json_writer.h" 11 #include "base/json/json_writer.h"
10 #include "base/logging.h" 12 #include "base/logging.h"
11 #include "base/path_service.h" 13 #include "base/path_service.h"
12 #include "base/values.h" 14 #include "base/values.h"
13 #include "components/policy/core/common/policy_load_status.h" 15 #include "components/policy/core/common/policy_load_status.h"
14 #include "components/policy/core/common/registry_dict_win.h" 16 #include "components/policy/core/common/registry_dict_win.h"
15 #include "testing/gtest/include/gtest/gtest.h" 17 #include "testing/gtest/include/gtest/gtest.h"
16 18
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &test_data_dir)); 75 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &test_data_dir));
74 76
75 // Prepare the test dictionary with some data so the test can check that the 77 // Prepare the test dictionary with some data so the test can check that the
76 // PReg action triggers work, i.e. remove these items. 78 // PReg action triggers work, i.e. remove these items.
77 RegistryDict dict; 79 RegistryDict dict;
78 SetInteger(&dict, "DeleteValuesTest1", 1); 80 SetInteger(&dict, "DeleteValuesTest1", 1);
79 SetString(&dict, "DeleteValuesTest2", "2"); 81 SetString(&dict, "DeleteValuesTest2", "2");
80 dict.SetKey("DeleteKeysTest1", make_scoped_ptr(new RegistryDict())); 82 dict.SetKey("DeleteKeysTest1", make_scoped_ptr(new RegistryDict()));
81 scoped_ptr<RegistryDict> delete_keys_test(new RegistryDict()); 83 scoped_ptr<RegistryDict> delete_keys_test(new RegistryDict());
82 SetInteger(delete_keys_test.get(), "DeleteKeysTest2Entry", 1); 84 SetInteger(delete_keys_test.get(), "DeleteKeysTest2Entry", 1);
83 dict.SetKey("DeleteKeysTest2", delete_keys_test.Pass()); 85 dict.SetKey("DeleteKeysTest2", std::move(delete_keys_test));
84 SetInteger(&dict, "DelTest", 1); 86 SetInteger(&dict, "DelTest", 1);
85 scoped_ptr<RegistryDict> subdict(new RegistryDict()); 87 scoped_ptr<RegistryDict> subdict(new RegistryDict());
86 SetInteger(subdict.get(), "DelValsTest1", 1); 88 SetInteger(subdict.get(), "DelValsTest1", 1);
87 SetString(subdict.get(), "DelValsTest2", "2"); 89 SetString(subdict.get(), "DelValsTest2", "2");
88 subdict->SetKey("DelValsTest3", make_scoped_ptr(new RegistryDict())); 90 subdict->SetKey("DelValsTest3", make_scoped_ptr(new RegistryDict()));
89 dict.SetKey("DelValsTest", subdict.Pass()); 91 dict.SetKey("DelValsTest", std::move(subdict));
90 92
91 // Run the parser. 93 // Run the parser.
92 base::FilePath test_file( 94 base::FilePath test_file(
93 test_data_dir.AppendASCII("chrome/test/data/policy/registry.pol")); 95 test_data_dir.AppendASCII("chrome/test/data/policy/registry.pol"));
94 PolicyLoadStatusSample status; 96 PolicyLoadStatusSample status;
95 ASSERT_TRUE(preg_parser::ReadFile( 97 ASSERT_TRUE(preg_parser::ReadFile(
96 test_file, L"SOFTWARE\\Policies\\Chromium", &dict, &status)); 98 test_file, L"SOFTWARE\\Policies\\Chromium", &dict, &status));
97 99
98 // Build the expected output dictionary. 100 // Build the expected output dictionary.
99 RegistryDict expected; 101 RegistryDict expected;
100 scoped_ptr<RegistryDict> del_vals_dict(new RegistryDict()); 102 scoped_ptr<RegistryDict> del_vals_dict(new RegistryDict());
101 del_vals_dict->SetKey("DelValsTest3", make_scoped_ptr(new RegistryDict())); 103 del_vals_dict->SetKey("DelValsTest3", make_scoped_ptr(new RegistryDict()));
102 expected.SetKey("DelValsTest", del_vals_dict.Pass()); 104 expected.SetKey("DelValsTest", std::move(del_vals_dict));
103 SetInteger(&expected, "HomepageIsNewTabPage", 1); 105 SetInteger(&expected, "HomepageIsNewTabPage", 1);
104 SetString(&expected, "HomepageLocation", "http://www.example.com"); 106 SetString(&expected, "HomepageLocation", "http://www.example.com");
105 SetInteger(&expected, "RestoreOnStartup", 4); 107 SetInteger(&expected, "RestoreOnStartup", 4);
106 scoped_ptr<RegistryDict> startup_urls(new RegistryDict()); 108 scoped_ptr<RegistryDict> startup_urls(new RegistryDict());
107 SetString(startup_urls.get(), "1", "http://www.chromium.org"); 109 SetString(startup_urls.get(), "1", "http://www.chromium.org");
108 SetString(startup_urls.get(), "2", "http://www.example.com"); 110 SetString(startup_urls.get(), "2", "http://www.example.com");
109 expected.SetKey("RestoreOnStartupURLs", startup_urls.Pass()); 111 expected.SetKey("RestoreOnStartupURLs", std::move(startup_urls));
110 SetInteger(&expected, "ShowHomeButton", 1); 112 SetInteger(&expected, "ShowHomeButton", 1);
111 SetString(&expected, "Snowman", "\xE2\x98\x83"); 113 SetString(&expected, "Snowman", "\xE2\x98\x83");
112 SetString(&expected, "Empty", ""); 114 SetString(&expected, "Empty", "");
113 115
114 EXPECT_TRUE(RegistryDictEquals(dict, expected)); 116 EXPECT_TRUE(RegistryDictEquals(dict, expected));
115 } 117 }
116 118
117 } // namespace 119 } // namespace
118 } // namespace preg_parser 120 } // namespace preg_parser
119 } // namespace policy 121 } // namespace policy
OLDNEW
« no previous file with comments | « components/policy/core/common/preg_parser_win.cc ('k') | components/policy/core/common/registry_dict_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698