OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/registry.h" | 10 #include "base/registry.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 void DeactivateOverrides(); | 106 void DeactivateOverrides(); |
107 | 107 |
108 // Deletes the registry key created during the tests. | 108 // Deletes the registry key created during the tests. |
109 void DeleteRegistrySandbox(); | 109 void DeleteRegistrySandbox(); |
110 | 110 |
111 void TestBooleanPolicyDefault(ConfigurationPolicyStore::PolicyType type); | 111 void TestBooleanPolicyDefault(ConfigurationPolicyStore::PolicyType type); |
112 void TestBooleanPolicyHKLM(ConfigurationPolicyStore::PolicyType type); | 112 void TestBooleanPolicyHKLM(ConfigurationPolicyStore::PolicyType type); |
113 void TestBooleanPolicy(ConfigurationPolicyStore::PolicyType type); | 113 void TestBooleanPolicy(ConfigurationPolicyStore::PolicyType type); |
114 | 114 |
115 private: | 115 private: |
| 116 // A message loop must be declared and instantiated for these tests, |
| 117 // because Windows policy provider create WaitableEvents and |
| 118 // ObjectWatchers that require the tests to have a MessageLoop associated |
| 119 // with the thread executing the tests. |
| 120 MessageLoop loop_; |
| 121 |
116 // Keys are created for the lifetime of a test to contain | 122 // Keys are created for the lifetime of a test to contain |
117 // the sandboxed HKCU and HKLM hives, respectively. | 123 // the sandboxed HKCU and HKLM hives, respectively. |
118 RegKey temp_hkcu_hive_key_; | 124 RegKey temp_hkcu_hive_key_; |
119 RegKey temp_hklm_hive_key_; | 125 RegKey temp_hklm_hive_key_; |
120 }; | 126 }; |
121 | 127 |
122 ConfigurationPolicyProviderWinTest::ConfigurationPolicyProviderWinTest() | 128 ConfigurationPolicyProviderWinTest::ConfigurationPolicyProviderWinTest() |
123 : temp_hklm_hive_key_(HKEY_CURRENT_USER, kUnitTestMachineOverrideSubKey), | 129 : temp_hklm_hive_key_(HKEY_CURRENT_USER, kUnitTestMachineOverrideSubKey), |
124 temp_hkcu_hive_key_(HKEY_CURRENT_USER, kUnitTestUserOverrideSubKey) { | 130 temp_hkcu_hive_key_(HKEY_CURRENT_USER, kUnitTestUserOverrideSubKey) { |
125 } | 131 } |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 | 307 |
302 TEST_F(ConfigurationPolicyProviderWinTest, | 308 TEST_F(ConfigurationPolicyProviderWinTest, |
303 TestPolicyMetricsReportingEnabled) { | 309 TestPolicyMetricsReportingEnabled) { |
304 TestBooleanPolicy(ConfigurationPolicyStore::kPolicyMetricsReportingEnabled); | 310 TestBooleanPolicy(ConfigurationPolicyStore::kPolicyMetricsReportingEnabled); |
305 } | 311 } |
306 | 312 |
307 TEST_F(ConfigurationPolicyProviderWinTest, | 313 TEST_F(ConfigurationPolicyProviderWinTest, |
308 TestPolicyPasswordManagerEnabled) { | 314 TestPolicyPasswordManagerEnabled) { |
309 TestBooleanPolicy(ConfigurationPolicyStore::kPolicyPasswordManagerEnabled); | 315 TestBooleanPolicy(ConfigurationPolicyStore::kPolicyPasswordManagerEnabled); |
310 } | 316 } |
OLD | NEW |