| 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/string16.h" | 10 #include "base/string16.h" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 135 TestHarness::TestHarness(HKEY hive, PolicyScope scope) | 135 TestHarness::TestHarness(HKEY hive, PolicyScope scope) |
| 136 : PolicyProviderTestHarness(POLICY_LEVEL_MANDATORY, scope), hive_(hive) {} | 136 : PolicyProviderTestHarness(POLICY_LEVEL_MANDATORY, scope), hive_(hive) {} |
| 137 | 137 |
| 138 TestHarness::~TestHarness() {} | 138 TestHarness::~TestHarness() {} |
| 139 | 139 |
| 140 void TestHarness::SetUp() {} | 140 void TestHarness::SetUp() {} |
| 141 | 141 |
| 142 ConfigurationPolicyProvider* TestHarness::CreateProvider( | 142 ConfigurationPolicyProvider* TestHarness::CreateProvider( |
| 143 const PolicyDefinitionList* policy_list) { | 143 const PolicyDefinitionList* policy_list) { |
| 144 scoped_ptr<AsyncPolicyLoader> loader(new PolicyLoaderWin(policy_list)); | 144 scoped_ptr<AsyncPolicyLoader> loader(new PolicyLoaderWin(policy_list)); |
| 145 return new AsyncPolicyProvider(policy_list, loader.Pass()); | 145 return new AsyncPolicyProvider(loader.Pass()); |
| 146 } | 146 } |
| 147 | 147 |
| 148 void TestHarness::InstallEmptyPolicy() {} | 148 void TestHarness::InstallEmptyPolicy() {} |
| 149 | 149 |
| 150 void TestHarness::InstallStringPolicy(const std::string& policy_name, | 150 void TestHarness::InstallStringPolicy(const std::string& policy_name, |
| 151 const std::string& policy_value) { | 151 const std::string& policy_value) { |
| 152 RegKey key(hive_, policy::kRegistryMandatorySubKey, KEY_ALL_ACCESS); | 152 RegKey key(hive_, policy::kRegistryMandatorySubKey, KEY_ALL_ACCESS); |
| 153 key.WriteValue(UTF8ToUTF16(policy_name).c_str(), | 153 key.WriteValue(UTF8ToUTF16(policy_name).c_str(), |
| 154 UTF8ToUTF16(policy_value).c_str()); | 154 UTF8ToUTF16(policy_value).c_str()); |
| 155 } | 155 } |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 242 PolicyBundle expected_bundle; | 242 PolicyBundle expected_bundle; |
| 243 expected_bundle.Get(POLICY_DOMAIN_CHROME, "") | 243 expected_bundle.Get(POLICY_DOMAIN_CHROME, "") |
| 244 .Set(test_policy_definitions::kKeyString, | 244 .Set(test_policy_definitions::kKeyString, |
| 245 POLICY_LEVEL_MANDATORY, | 245 POLICY_LEVEL_MANDATORY, |
| 246 POLICY_SCOPE_MACHINE, | 246 POLICY_SCOPE_MACHINE, |
| 247 base::Value::CreateStringValue("hklm")); | 247 base::Value::CreateStringValue("hklm")); |
| 248 EXPECT_TRUE(bundle->Equals(expected_bundle)); | 248 EXPECT_TRUE(bundle->Equals(expected_bundle)); |
| 249 } | 249 } |
| 250 | 250 |
| 251 } // namespace policy | 251 } // namespace policy |
| OLD | NEW |