OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <gtest/gtest.h> | 5 #include <gtest/gtest.h> |
6 #include <windows.h> | 6 #include <windows.h> |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 temp_hklm_hive_key_.Create(HKEY_CURRENT_USER, | 186 temp_hklm_hive_key_.Create(HKEY_CURRENT_USER, |
187 kUnitTestMachineOverrideSubKey, | 187 kUnitTestMachineOverrideSubKey, |
188 KEY_ALL_ACCESS); | 188 KEY_ALL_ACCESS); |
189 temp_hkcu_hive_key_.Create(HKEY_CURRENT_USER, | 189 temp_hkcu_hive_key_.Create(HKEY_CURRENT_USER, |
190 kUnitTestUserOverrideSubKey, | 190 kUnitTestUserOverrideSubKey, |
191 KEY_ALL_ACCESS); | 191 KEY_ALL_ACCESS); |
192 | 192 |
193 ActivateOverrides(); | 193 ActivateOverrides(); |
194 | 194 |
195 provider_.reset(new ConfigurationPolicyProviderWin( | 195 provider_.reset(new ConfigurationPolicyProviderWin( |
196 ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList())); | 196 GetChromePolicyDefinitionList())); |
197 } | 197 } |
198 | 198 |
199 void ConfigurationPolicyProviderWinTest::TearDown() { | 199 void ConfigurationPolicyProviderWinTest::TearDown() { |
200 DeactivateOverrides(); | 200 DeactivateOverrides(); |
201 DeleteRegistrySandbox(); | 201 DeleteRegistrySandbox(); |
202 loop_.RunAllPending(); | 202 loop_.RunAllPending(); |
203 } | 203 } |
204 | 204 |
205 void ConfigurationPolicyProviderWinTest::ActivateOverrides() { | 205 void ConfigurationPolicyProviderWinTest::ActivateOverrides() { |
206 HRESULT result = RegOverridePredefKey(HKEY_LOCAL_MACHINE, | 206 HRESULT result = RegOverridePredefKey(HKEY_LOCAL_MACHINE, |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 key::kExtensionInstallWhitelist), | 452 key::kExtensionInstallWhitelist), |
453 PolicyTestParams::ForListPolicy( | 453 PolicyTestParams::ForListPolicy( |
454 kPolicyExtensionInstallBlacklist, | 454 kPolicyExtensionInstallBlacklist, |
455 key::kExtensionInstallBlacklist), | 455 key::kExtensionInstallBlacklist), |
456 PolicyTestParams::ForBooleanPolicy( | 456 PolicyTestParams::ForBooleanPolicy( |
457 kPolicyShowHomeButton, | 457 kPolicyShowHomeButton, |
458 key::kShowHomeButton), | 458 key::kShowHomeButton), |
459 PolicyTestParams::ForBooleanPolicy( | 459 PolicyTestParams::ForBooleanPolicy( |
460 kPolicyPrintingEnabled, | 460 kPolicyPrintingEnabled, |
461 key::kPrintingEnabled), | 461 key::kPrintingEnabled), |
462 PolicyTestParams::ForIntegerPolicy( | |
463 kPolicyPolicyRefreshRate, | |
464 key::kPolicyRefreshRate), | |
465 PolicyTestParams::ForBooleanPolicy( | 462 PolicyTestParams::ForBooleanPolicy( |
466 kPolicyInstantEnabled, | 463 kPolicyInstantEnabled, |
467 key::kInstantEnabled), | 464 key::kInstantEnabled), |
468 PolicyTestParams::ForIntegerPolicy( | 465 PolicyTestParams::ForIntegerPolicy( |
469 kPolicyIncognitoModeAvailability, | 466 kPolicyIncognitoModeAvailability, |
470 key::kIncognitoModeAvailability), | 467 key::kIncognitoModeAvailability), |
471 PolicyTestParams::ForBooleanPolicy( | 468 PolicyTestParams::ForBooleanPolicy( |
472 kPolicyDisablePluginFinder, | 469 kPolicyDisablePluginFinder, |
473 key::kDisablePluginFinder), | 470 key::kDisablePluginFinder), |
474 PolicyTestParams::ForBooleanPolicy( | 471 PolicyTestParams::ForBooleanPolicy( |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
518 ConfigurationPolicyProviderWinTest, | 515 ConfigurationPolicyProviderWinTest, |
519 testing::Values( | 516 testing::Values( |
520 PolicyTestParams::ForListPolicy( | 517 PolicyTestParams::ForListPolicy( |
521 kPolicyURLBlacklist, | 518 kPolicyURLBlacklist, |
522 key::kURLBlacklist), | 519 key::kURLBlacklist), |
523 PolicyTestParams::ForListPolicy( | 520 PolicyTestParams::ForListPolicy( |
524 kPolicyURLWhitelist, | 521 kPolicyURLWhitelist, |
525 key::kURLWhitelist))); | 522 key::kURLWhitelist))); |
526 | 523 |
527 } // namespace policy | 524 } // namespace policy |
OLD | NEW |