OLD | NEW |
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 "chrome/browser/policy/policy_loader_win.h" | 5 #include "chrome/browser/policy/policy_loader_win.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "base/json/json_writer.h" | 9 #include "base/json/json_writer.h" |
10 #include "base/process.h" | 10 #include "base/process.h" |
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 | 255 |
256 ScopedGroupPolicyRegistrySandbox registry_sandbox_; | 256 ScopedGroupPolicyRegistrySandbox registry_sandbox_; |
257 | 257 |
258 DISALLOW_COPY_AND_ASSIGN(TestHarness); | 258 DISALLOW_COPY_AND_ASSIGN(TestHarness); |
259 }; | 259 }; |
260 | 260 |
261 ScopedGroupPolicyRegistrySandbox::ScopedGroupPolicyRegistrySandbox() { | 261 ScopedGroupPolicyRegistrySandbox::ScopedGroupPolicyRegistrySandbox() { |
262 // Generate a unique registry key for the override for each test. This | 262 // Generate a unique registry key for the override for each test. This |
263 // makes sure that tests executing in parallel won't delete each other's | 263 // makes sure that tests executing in parallel won't delete each other's |
264 // key, at DeleteKeys(). | 264 // key, at DeleteKeys(). |
265 key_name_ = ASCIIToWide(base::StringPrintf( | 265 key_name_ = base::ASCIIToWide(base::StringPrintf( |
266 "SOFTWARE\\chromium unittest %d", | 266 "SOFTWARE\\chromium unittest %d", |
267 base::Process::Current().pid())); | 267 base::Process::Current().pid())); |
268 std::wstring hklm_key_name = key_name_ + L"\\HKLM"; | 268 std::wstring hklm_key_name = key_name_ + L"\\HKLM"; |
269 std::wstring hkcu_key_name = key_name_ + L"\\HKCU"; | 269 std::wstring hkcu_key_name = key_name_ + L"\\HKCU"; |
270 | 270 |
271 // Create the subkeys to hold the overridden HKLM and HKCU | 271 // Create the subkeys to hold the overridden HKLM and HKCU |
272 // policy settings. | 272 // policy settings. |
273 temp_hklm_hive_key_.Create(HKEY_CURRENT_USER, | 273 temp_hklm_hive_key_.Create(HKEY_CURRENT_USER, |
274 hklm_key_name.c_str(), | 274 hklm_key_name.c_str(), |
275 KEY_ALL_ACCESS); | 275 KEY_ALL_ACCESS); |
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
626 expected_policy.SetInteger("special-int2", -456); | 626 expected_policy.SetInteger("special-int2", -456); |
627 expected_policy.SetDouble("double1", 789.0); | 627 expected_policy.SetDouble("double1", 789.0); |
628 expected_policy.SetDouble("double2", 123.456e7); | 628 expected_policy.SetDouble("double2", 123.456e7); |
629 PolicyBundle expected; | 629 PolicyBundle expected; |
630 expected.Get(PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, "test")) | 630 expected.Get(PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, "test")) |
631 .LoadFrom(&expected_policy, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER); | 631 .LoadFrom(&expected_policy, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER); |
632 EXPECT_TRUE(Matches(expected)); | 632 EXPECT_TRUE(Matches(expected)); |
633 } | 633 } |
634 | 634 |
635 } // namespace policy | 635 } // namespace policy |
OLD | NEW |