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

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

Issue 689063002: Cleanup: Replace base::ASCIIToWide with base::ASCIIToUTF16. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, fix typo Created 6 years, 1 month 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
« no previous file with comments | « components/crash/app/breakpad_win.cc ('k') | content/browser/download/save_package_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/policy_loader_win.h" 5 #include "components/policy/core/common/policy_loader_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 #include <userenv.h> 8 #include <userenv.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 ScopedGroupPolicyRegistrySandbox(); 148 ScopedGroupPolicyRegistrySandbox();
149 ~ScopedGroupPolicyRegistrySandbox(); 149 ~ScopedGroupPolicyRegistrySandbox();
150 150
151 private: 151 private:
152 void ActivateOverrides(); 152 void ActivateOverrides();
153 void RemoveOverrides(); 153 void RemoveOverrides();
154 154
155 // Deletes the sandbox keys. 155 // Deletes the sandbox keys.
156 void DeleteKeys(); 156 void DeleteKeys();
157 157
158 std::wstring key_name_; 158 base::string16 key_name_;
159 159
160 // Keys are created for the lifetime of a test to contain 160 // Keys are created for the lifetime of a test to contain
161 // the sandboxed HKCU and HKLM hives, respectively. 161 // the sandboxed HKCU and HKLM hives, respectively.
162 RegKey temp_hkcu_hive_key_; 162 RegKey temp_hkcu_hive_key_;
163 RegKey temp_hklm_hive_key_; 163 RegKey temp_hklm_hive_key_;
164 164
165 DISALLOW_COPY_AND_ASSIGN(ScopedGroupPolicyRegistrySandbox); 165 DISALLOW_COPY_AND_ASSIGN(ScopedGroupPolicyRegistrySandbox);
166 }; 166 };
167 167
168 // A test harness that feeds policy via the Chrome GPO registry subtree. 168 // A test harness that feeds policy via the Chrome GPO registry subtree.
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 base::FilePath preg_file_path_; 289 base::FilePath preg_file_path_;
290 GROUP_POLICY_OBJECT gpo_; 290 GROUP_POLICY_OBJECT gpo_;
291 291
292 DISALLOW_COPY_AND_ASSIGN(PRegTestHarness); 292 DISALLOW_COPY_AND_ASSIGN(PRegTestHarness);
293 }; 293 };
294 294
295 ScopedGroupPolicyRegistrySandbox::ScopedGroupPolicyRegistrySandbox() { 295 ScopedGroupPolicyRegistrySandbox::ScopedGroupPolicyRegistrySandbox() {
296 // Generate a unique registry key for the override for each test. This 296 // Generate a unique registry key for the override for each test. This
297 // makes sure that tests executing in parallel won't delete each other's 297 // makes sure that tests executing in parallel won't delete each other's
298 // key, at DeleteKeys(). 298 // key, at DeleteKeys().
299 key_name_ = base::ASCIIToWide(base::StringPrintf( 299 key_name_ = base::ASCIIToUTF16(base::StringPrintf(
300 "SOFTWARE\\chromium unittest %d", base::GetCurrentProcId())); 300 "SOFTWARE\\chromium unittest %d", base::GetCurrentProcId()));
301 std::wstring hklm_key_name = key_name_ + L"\\HKLM"; 301 std::wstring hklm_key_name = key_name_ + L"\\HKLM";
302 std::wstring hkcu_key_name = key_name_ + L"\\HKCU"; 302 std::wstring hkcu_key_name = key_name_ + L"\\HKCU";
303 303
304 // Create the subkeys to hold the overridden HKLM and HKCU 304 // Create the subkeys to hold the overridden HKLM and HKCU
305 // policy settings. 305 // policy settings.
306 temp_hklm_hive_key_.Create(HKEY_CURRENT_USER, 306 temp_hklm_hive_key_.Create(HKEY_CURRENT_USER,
307 hklm_key_name.c_str(), 307 hklm_key_name.c_str(),
308 KEY_ALL_ACCESS); 308 KEY_ALL_ACCESS);
309 temp_hkcu_hive_key_.Create(HKEY_CURRENT_USER, 309 temp_hkcu_hive_key_.Create(HKEY_CURRENT_USER,
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
1207 PolicyMap& expected_policy = expected.Get(ns); 1207 PolicyMap& expected_policy = expected.Get(ns);
1208 expected_policy.Set("alternative_browser_path", 1208 expected_policy.Set("alternative_browser_path",
1209 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, 1209 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
1210 new base::StringValue("c:\\legacy\\browser.exe"), NULL); 1210 new base::StringValue("c:\\legacy\\browser.exe"), NULL);
1211 expected_policy.Set("url_list", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE, 1211 expected_policy.Set("url_list", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_MACHINE,
1212 list.DeepCopy(), NULL); 1212 list.DeepCopy(), NULL);
1213 EXPECT_TRUE(Matches(expected)); 1213 EXPECT_TRUE(Matches(expected));
1214 } 1214 }
1215 1215
1216 } // namespace policy 1216 } // namespace policy
OLDNEW
« no previous file with comments | « components/crash/app/breakpad_win.cc ('k') | content/browser/download/save_package_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698