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

Side by Side Diff: chrome/browser/configuration_policy_provider_win_unittest.cc

Issue 2273003: Rename class to comply with style guide. Tweak comments for grammar and correctness. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 7 months 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/configuration_policy_provider_win.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Name: svn:eol-style
+ LF
OLDNEW
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"
11 #include "base/scoped_ptr.h" 11 #include "base/scoped_ptr.h"
12 #include "chrome/browser/configuration_policy_provider_win.h" 12 #include "chrome/browser/configuration_policy_provider_win.h"
13 #include "chrome/browser/mock_configuration_policy_store.h" 13 #include "chrome/browser/mock_configuration_policy_store.h"
14 #include "chrome/common/pref_names.h" 14 #include "chrome/common/pref_names.h"
15 15
16 namespace { 16 namespace {
17 const wchar_t kUnitTestRegistrySubKey[] = L"SOFTWARE\\Chromium Unit Tests"; 17 const wchar_t kUnitTestRegistrySubKey[] = L"SOFTWARE\\Chromium Unit Tests";
18 const wchar_t kUnitTestMachineOverrideSubKey[] = 18 const wchar_t kUnitTestMachineOverrideSubKey[] =
19 L"SOFTWARE\\Chromium Unit Tests\\HKLM Override"; 19 L"SOFTWARE\\Chromium Unit Tests\\HKLM Override";
20 const wchar_t kUnitTestUserOverrideSubKey[] = 20 const wchar_t kUnitTestUserOverrideSubKey[] =
21 L"SOFTWARE\\Chromium Unit Tests\\HKCU Override"; 21 L"SOFTWARE\\Chromium Unit Tests\\HKCU Override";
22 } 22 }
23 23
24 // A subclass of |WinConfigurationPolicyProvider| providing access to 24 // A subclass of |ConfigurationPolicyProviderWin| providing access to
25 // internal protected constants without an orgy of FRIEND_TESTS. 25 // internal protected constants without an orgy of FRIEND_TESTS.
26 class TestWinConfigurationPolicyProvider 26 class TestConfigurationPolicyProviderWin
27 : public WinConfigurationPolicyProvider { 27 : public ConfigurationPolicyProviderWin {
28 public: 28 public:
29 TestWinConfigurationPolicyProvider() : WinConfigurationPolicyProvider() { } 29 TestConfigurationPolicyProviderWin() : ConfigurationPolicyProviderWin() { }
30 virtual ~TestWinConfigurationPolicyProvider() { } 30 virtual ~TestConfigurationPolicyProviderWin() { }
31 31
32 void SetHomepageRegistryValue(HKEY hive, const wchar_t* value); 32 void SetHomepageRegistryValue(HKEY hive, const wchar_t* value);
33 void SetHomepageRegistryValueWrongType(HKEY hive); 33 void SetHomepageRegistryValueWrongType(HKEY hive);
34 void SetHomepageIsNewTabPage(HKEY hive, bool value); 34 void SetHomepageIsNewTabPage(HKEY hive, bool value);
35 void SetCookiesMode(HKEY hive, uint32 value); 35 void SetCookiesMode(HKEY hive, uint32 value);
36 }; 36 };
37 37
38 void TestWinConfigurationPolicyProvider::SetHomepageRegistryValue( 38 void TestConfigurationPolicyProviderWin::SetHomepageRegistryValue(
39 HKEY hive, 39 HKEY hive,
40 const wchar_t* value) { 40 const wchar_t* value) {
41 RegKey key(hive, 41 RegKey key(hive,
42 WinConfigurationPolicyProvider::kPolicyRegistrySubKey, 42 ConfigurationPolicyProviderWin::kPolicyRegistrySubKey,
43 KEY_ALL_ACCESS); 43 KEY_ALL_ACCESS);
44 EXPECT_TRUE(key.WriteValue( 44 EXPECT_TRUE(key.WriteValue(
45 WinConfigurationPolicyProvider::kHomepageRegistryValueName, 45 ConfigurationPolicyProviderWin::kHomepageRegistryValueName,
46 value)); 46 value));
47 } 47 }
48 48
49 void TestWinConfigurationPolicyProvider::SetHomepageRegistryValueWrongType( 49 void TestConfigurationPolicyProviderWin::SetHomepageRegistryValueWrongType(
50 HKEY hive) { 50 HKEY hive) {
51 RegKey key(hive, 51 RegKey key(hive,
52 WinConfigurationPolicyProvider::kPolicyRegistrySubKey, 52 ConfigurationPolicyProviderWin::kPolicyRegistrySubKey,
53 KEY_ALL_ACCESS); 53 KEY_ALL_ACCESS);
54 EXPECT_TRUE(key.WriteValue( 54 EXPECT_TRUE(key.WriteValue(
55 WinConfigurationPolicyProvider::kHomepageRegistryValueName, 55 ConfigurationPolicyProviderWin::kHomepageRegistryValueName,
56 5)); 56 5));
57 } 57 }
58 58
59 void TestWinConfigurationPolicyProvider::SetHomepageIsNewTabPage( 59 void TestConfigurationPolicyProviderWin::SetHomepageIsNewTabPage(
60 HKEY hive, 60 HKEY hive,
61 bool value) { 61 bool value) {
62 RegKey key(hive, 62 RegKey key(hive,
63 WinConfigurationPolicyProvider::kPolicyRegistrySubKey, 63 ConfigurationPolicyProviderWin::kPolicyRegistrySubKey,
64 KEY_ALL_ACCESS); 64 KEY_ALL_ACCESS);
65 EXPECT_TRUE(key.WriteValue( 65 EXPECT_TRUE(key.WriteValue(
66 WinConfigurationPolicyProvider::kHomepageIsNewTabPageRegistryValueName, 66 ConfigurationPolicyProviderWin::kHomepageIsNewTabPageRegistryValueName,
67 value)); 67 value));
68 } 68 }
69 69
70 void TestWinConfigurationPolicyProvider::SetCookiesMode( 70 void TestConfigurationPolicyProviderWin::SetCookiesMode(
71 HKEY hive, 71 HKEY hive,
72 uint32 value) { 72 uint32 value) {
73 RegKey key(hive, 73 RegKey key(hive,
74 WinConfigurationPolicyProvider::kPolicyRegistrySubKey, 74 ConfigurationPolicyProviderWin::kPolicyRegistrySubKey,
75 KEY_ALL_ACCESS); 75 KEY_ALL_ACCESS);
76 EXPECT_TRUE(key.WriteValue( 76 EXPECT_TRUE(key.WriteValue(
77 WinConfigurationPolicyProvider::kCookiesModeRegistryValueName, 77 ConfigurationPolicyProviderWin::kCookiesModeRegistryValueName,
78 value)); 78 value));
79 } 79 }
80 80
81 // This test class provides sandboxing and mocking for the parts of the 81 // This test class provides sandboxing and mocking for the parts of the
82 // Windows Registry implementing Group Policy. The |SetUp| method prepares 82 // Windows Registry implementing Group Policy. The |SetUp| method prepares
83 // two temporary sandbox keys in |kUnitTestRegistrySubKey|, one for HKLM and one 83 // two temporary sandbox keys in |kUnitTestRegistrySubKey|, one for HKLM and one
84 // for HKCU. A test's calls to the registry are redirected by Windows to these 84 // for HKCU. A test's calls to the registry are redirected by Windows to these
85 // sandboxes, allowing the tests to manipulate and access policy as if it 85 // sandboxes, allowing the tests to manipulate and access policy as if it
86 // were active, but without actually changing the parts of the Registry that 86 // were active, but without actually changing the parts of the Registry that
87 // are managed by Group Policy. 87 // are managed by Group Policy.
88 class WinConfigurationPolicyProviderTest : public testing::Test { 88 class ConfigurationPolicyProviderWinTest : public testing::Test {
89 public: 89 public:
90 WinConfigurationPolicyProviderTest(); 90 ConfigurationPolicyProviderWinTest();
91 91
92 // testing::Test method overrides: 92 // testing::Test method overrides:
93 virtual void SetUp(); 93 virtual void SetUp();
94 virtual void TearDown(); 94 virtual void TearDown();
95 95
96 void ActivateOverrides(); 96 void ActivateOverrides();
97 void DeactivateOverrides(); 97 void DeactivateOverrides();
98 98
99 // Deletes the registry key created during the tests. 99 // Deletes the registry key created during the tests.
100 void DeleteRegistrySandbox(); 100 void DeleteRegistrySandbox();
101 101
102 private: 102 private:
103 // Keys are created for the lifetime of a test to contain 103 // Keys are created for the lifetime of a test to contain
104 // the sandboxed HKCU and HKLM hives, respectively. 104 // the sandboxed HKCU and HKLM hives, respectively.
105 RegKey temp_hkcu_hive_key_; 105 RegKey temp_hkcu_hive_key_;
106 RegKey temp_hklm_hive_key_; 106 RegKey temp_hklm_hive_key_;
107 }; 107 };
108 108
109 WinConfigurationPolicyProviderTest::WinConfigurationPolicyProviderTest() 109 ConfigurationPolicyProviderWinTest::ConfigurationPolicyProviderWinTest()
110 : temp_hklm_hive_key_(HKEY_CURRENT_USER, kUnitTestMachineOverrideSubKey), 110 : temp_hklm_hive_key_(HKEY_CURRENT_USER, kUnitTestMachineOverrideSubKey),
111 temp_hkcu_hive_key_(HKEY_CURRENT_USER, kUnitTestUserOverrideSubKey) { 111 temp_hkcu_hive_key_(HKEY_CURRENT_USER, kUnitTestUserOverrideSubKey) {
112 } 112 }
113 113
114 void WinConfigurationPolicyProviderTest::SetUp() { 114 void ConfigurationPolicyProviderWinTest::SetUp() {
115 // Cleanup any remnants of previous tests. 115 // Cleanup any remnants of previous tests.
116 DeleteRegistrySandbox(); 116 DeleteRegistrySandbox();
117 117
118 // Create the subkeys to hold the overridden HKLM and HKCU 118 // Create the subkeys to hold the overridden HKLM and HKCU
119 // policy settings. 119 // policy settings.
120 temp_hklm_hive_key_.Create(HKEY_CURRENT_USER, 120 temp_hklm_hive_key_.Create(HKEY_CURRENT_USER,
121 kUnitTestMachineOverrideSubKey, 121 kUnitTestMachineOverrideSubKey,
122 KEY_ALL_ACCESS); 122 KEY_ALL_ACCESS);
123 temp_hkcu_hive_key_.Create(HKEY_CURRENT_USER, 123 temp_hkcu_hive_key_.Create(HKEY_CURRENT_USER,
124 kUnitTestUserOverrideSubKey, 124 kUnitTestUserOverrideSubKey,
125 KEY_ALL_ACCESS); 125 KEY_ALL_ACCESS);
126 126
127 ActivateOverrides(); 127 ActivateOverrides();
128 } 128 }
129 129
130 void WinConfigurationPolicyProviderTest::ActivateOverrides() { 130 void ConfigurationPolicyProviderWinTest::ActivateOverrides() {
131 HRESULT result = RegOverridePredefKey(HKEY_LOCAL_MACHINE, 131 HRESULT result = RegOverridePredefKey(HKEY_LOCAL_MACHINE,
132 temp_hklm_hive_key_.Handle()); 132 temp_hklm_hive_key_.Handle());
133 EXPECT_EQ(ERROR_SUCCESS, result); 133 EXPECT_EQ(ERROR_SUCCESS, result);
134 result = RegOverridePredefKey(HKEY_CURRENT_USER, 134 result = RegOverridePredefKey(HKEY_CURRENT_USER,
135 temp_hkcu_hive_key_.Handle()); 135 temp_hkcu_hive_key_.Handle());
136 EXPECT_EQ(ERROR_SUCCESS, result); 136 EXPECT_EQ(ERROR_SUCCESS, result);
137 } 137 }
138 138
139 void WinConfigurationPolicyProviderTest::DeactivateOverrides() { 139 void ConfigurationPolicyProviderWinTest::DeactivateOverrides() {
140 uint32 result = RegOverridePredefKey(HKEY_LOCAL_MACHINE, 0); 140 uint32 result = RegOverridePredefKey(HKEY_LOCAL_MACHINE, 0);
141 EXPECT_EQ(ERROR_SUCCESS, result); 141 EXPECT_EQ(ERROR_SUCCESS, result);
142 result = RegOverridePredefKey(HKEY_CURRENT_USER, 0); 142 result = RegOverridePredefKey(HKEY_CURRENT_USER, 0);
143 EXPECT_EQ(ERROR_SUCCESS, result); 143 EXPECT_EQ(ERROR_SUCCESS, result);
144 } 144 }
145 145
146 void WinConfigurationPolicyProviderTest::TearDown() { 146 void ConfigurationPolicyProviderWinTest::TearDown() {
147 DeactivateOverrides(); 147 DeactivateOverrides();
148 DeleteRegistrySandbox(); 148 DeleteRegistrySandbox();
149 } 149 }
150 150
151 void WinConfigurationPolicyProviderTest::DeleteRegistrySandbox() { 151 void ConfigurationPolicyProviderWinTest::DeleteRegistrySandbox() {
152 temp_hklm_hive_key_.Close(); 152 temp_hklm_hive_key_.Close();
153 temp_hkcu_hive_key_.Close(); 153 temp_hkcu_hive_key_.Close();
154 RegKey key(HKEY_CURRENT_USER, kUnitTestRegistrySubKey, KEY_ALL_ACCESS); 154 RegKey key(HKEY_CURRENT_USER, kUnitTestRegistrySubKey, KEY_ALL_ACCESS);
155 key.DeleteKey(L""); 155 key.DeleteKey(L"");
156 } 156 }
157 TEST_F(WinConfigurationPolicyProviderTest, TestHomePagePolicyDefault) { 157 TEST_F(ConfigurationPolicyProviderWinTest, TestHomePagePolicyDefault) {
158 MockConfigurationPolicyStore store; 158 MockConfigurationPolicyStore store;
159 TestWinConfigurationPolicyProvider provider; 159 TestConfigurationPolicyProviderWin provider;
160 160
161 provider.Provide(&store); 161 provider.Provide(&store);
162 162
163 const MockConfigurationPolicyStore::PolicyMap& map(store.policy_map()); 163 const MockConfigurationPolicyStore::PolicyMap& map(store.policy_map());
164 MockConfigurationPolicyStore::PolicyMap::const_iterator i = 164 MockConfigurationPolicyStore::PolicyMap::const_iterator i =
165 map.find(ConfigurationPolicyStore::kPolicyHomePage); 165 map.find(ConfigurationPolicyStore::kPolicyHomePage);
166 EXPECT_TRUE(i == map.end()); 166 EXPECT_TRUE(i == map.end());
167 } 167 }
168 168
169 TEST_F(WinConfigurationPolicyProviderTest, TestHomePagePolicyHKCU) { 169 TEST_F(ConfigurationPolicyProviderWinTest, TestHomePagePolicyHKCU) {
170 MockConfigurationPolicyStore store; 170 MockConfigurationPolicyStore store;
171 TestWinConfigurationPolicyProvider provider; 171 TestConfigurationPolicyProviderWin provider;
172 provider.SetHomepageRegistryValue(HKEY_CURRENT_USER, 172 provider.SetHomepageRegistryValue(HKEY_CURRENT_USER,
173 L"http://chromium.org"); 173 L"http://chromium.org");
174 174
175 provider.Provide(&store); 175 provider.Provide(&store);
176 176
177 const MockConfigurationPolicyStore::PolicyMap& map(store.policy_map()); 177 const MockConfigurationPolicyStore::PolicyMap& map(store.policy_map());
178 MockConfigurationPolicyStore::PolicyMap::const_iterator i = 178 MockConfigurationPolicyStore::PolicyMap::const_iterator i =
179 map.find(ConfigurationPolicyStore::kPolicyHomePage); 179 map.find(ConfigurationPolicyStore::kPolicyHomePage);
180 EXPECT_TRUE(i != map.end()); 180 EXPECT_TRUE(i != map.end());
181 string16 value; 181 string16 value;
182 i->second->GetAsString(&value); 182 i->second->GetAsString(&value);
183 EXPECT_EQ(L"http://chromium.org", value); 183 EXPECT_EQ(L"http://chromium.org", value);
184 } 184 }
185 185
186 TEST_F(WinConfigurationPolicyProviderTest, TestHomePagePolicyHKCUWrongType) { 186 TEST_F(ConfigurationPolicyProviderWinTest, TestHomePagePolicyHKCUWrongType) {
187 MockConfigurationPolicyStore store; 187 MockConfigurationPolicyStore store;
188 TestWinConfigurationPolicyProvider provider; 188 TestConfigurationPolicyProviderWin provider;
189 provider.SetHomepageRegistryValueWrongType(HKEY_CURRENT_USER); 189 provider.SetHomepageRegistryValueWrongType(HKEY_CURRENT_USER);
190 190
191 provider.Provide(&store); 191 provider.Provide(&store);
192 192
193 const MockConfigurationPolicyStore::PolicyMap& map(store.policy_map()); 193 const MockConfigurationPolicyStore::PolicyMap& map(store.policy_map());
194 MockConfigurationPolicyStore::PolicyMap::const_iterator i = 194 MockConfigurationPolicyStore::PolicyMap::const_iterator i =
195 map.find(ConfigurationPolicyStore::kPolicyHomePage); 195 map.find(ConfigurationPolicyStore::kPolicyHomePage);
196 EXPECT_TRUE(i == map.end()); 196 EXPECT_TRUE(i == map.end());
197 } 197 }
198 198
199 TEST_F(WinConfigurationPolicyProviderTest, TestHomePagePolicyHKLM) { 199 TEST_F(ConfigurationPolicyProviderWinTest, TestHomePagePolicyHKLM) {
200 MockConfigurationPolicyStore store; 200 MockConfigurationPolicyStore store;
201 TestWinConfigurationPolicyProvider provider; 201 TestConfigurationPolicyProviderWin provider;
202 provider.SetHomepageRegistryValue(HKEY_LOCAL_MACHINE, 202 provider.SetHomepageRegistryValue(HKEY_LOCAL_MACHINE,
203 L"http://chromium.org"); 203 L"http://chromium.org");
204 204
205 provider.Provide(&store); 205 provider.Provide(&store);
206 206
207 const MockConfigurationPolicyStore::PolicyMap& map(store.policy_map()); 207 const MockConfigurationPolicyStore::PolicyMap& map(store.policy_map());
208 MockConfigurationPolicyStore::PolicyMap::const_iterator i = 208 MockConfigurationPolicyStore::PolicyMap::const_iterator i =
209 map.find(ConfigurationPolicyStore::kPolicyHomePage); 209 map.find(ConfigurationPolicyStore::kPolicyHomePage);
210 EXPECT_TRUE(i != map.end()); 210 EXPECT_TRUE(i != map.end());
211 string16 value; 211 string16 value;
212 i->second->GetAsString(&value); 212 i->second->GetAsString(&value);
213 EXPECT_EQ(L"http://chromium.org", value); 213 EXPECT_EQ(L"http://chromium.org", value);
214 } 214 }
215 215
216 TEST_F(WinConfigurationPolicyProviderTest, TestHomePagePolicyHKLMOverHKCU) { 216 TEST_F(ConfigurationPolicyProviderWinTest, TestHomePagePolicyHKLMOverHKCU) {
217 MockConfigurationPolicyStore store; 217 MockConfigurationPolicyStore store;
218 TestWinConfigurationPolicyProvider provider; 218 TestConfigurationPolicyProviderWin provider;
219 provider.SetHomepageRegistryValue(HKEY_CURRENT_USER, 219 provider.SetHomepageRegistryValue(HKEY_CURRENT_USER,
220 L"http://chromium.org"); 220 L"http://chromium.org");
221 provider.SetHomepageRegistryValue(HKEY_LOCAL_MACHINE, 221 provider.SetHomepageRegistryValue(HKEY_LOCAL_MACHINE,
222 L"http://crbug.com"); 222 L"http://crbug.com");
223 223
224 provider.Provide(&store); 224 provider.Provide(&store);
225 225
226 const MockConfigurationPolicyStore::PolicyMap& map(store.policy_map()); 226 const MockConfigurationPolicyStore::PolicyMap& map(store.policy_map());
227 MockConfigurationPolicyStore::PolicyMap::const_iterator i = 227 MockConfigurationPolicyStore::PolicyMap::const_iterator i =
228 map.find(ConfigurationPolicyStore::kPolicyHomePage); 228 map.find(ConfigurationPolicyStore::kPolicyHomePage);
229 EXPECT_TRUE(i != map.end()); 229 EXPECT_TRUE(i != map.end());
230 string16 value; 230 string16 value;
231 i->second->GetAsString(&value); 231 i->second->GetAsString(&value);
232 EXPECT_EQ(L"http://crbug.com", value); 232 EXPECT_EQ(L"http://crbug.com", value);
233 } 233 }
234 234
235 TEST_F(WinConfigurationPolicyProviderTest, 235 TEST_F(ConfigurationPolicyProviderWinTest,
236 TestHomepageIsNewTabPagePolicyDefault) { 236 TestHomepageIsNewTabPagePolicyDefault) {
237 MockConfigurationPolicyStore store; 237 MockConfigurationPolicyStore store;
238 TestWinConfigurationPolicyProvider provider; 238 TestConfigurationPolicyProviderWin provider;
239 239
240 provider.Provide(&store); 240 provider.Provide(&store);
241 241
242 const MockConfigurationPolicyStore::PolicyMap& map(store.policy_map()); 242 const MockConfigurationPolicyStore::PolicyMap& map(store.policy_map());
243 MockConfigurationPolicyStore::PolicyMap::const_iterator i = 243 MockConfigurationPolicyStore::PolicyMap::const_iterator i =
244 map.find(ConfigurationPolicyStore::kPolicyHomepageIsNewTabPage); 244 map.find(ConfigurationPolicyStore::kPolicyHomepageIsNewTabPage);
245 EXPECT_TRUE(i == map.end()); 245 EXPECT_TRUE(i == map.end());
246 } 246 }
247 247
248 TEST_F(WinConfigurationPolicyProviderTest, 248 TEST_F(ConfigurationPolicyProviderWinTest,
249 TestHomepageIsNewTabPagePolicyHKLM) { 249 TestHomepageIsNewTabPagePolicyHKLM) {
250 MockConfigurationPolicyStore store; 250 MockConfigurationPolicyStore store;
251 TestWinConfigurationPolicyProvider provider; 251 TestConfigurationPolicyProviderWin provider;
252 provider.SetHomepageIsNewTabPage(HKEY_LOCAL_MACHINE, true); 252 provider.SetHomepageIsNewTabPage(HKEY_LOCAL_MACHINE, true);
253 253
254 provider.Provide(&store); 254 provider.Provide(&store);
255 255
256 const MockConfigurationPolicyStore::PolicyMap& map(store.policy_map()); 256 const MockConfigurationPolicyStore::PolicyMap& map(store.policy_map());
257 MockConfigurationPolicyStore::PolicyMap::const_iterator i = 257 MockConfigurationPolicyStore::PolicyMap::const_iterator i =
258 map.find(ConfigurationPolicyStore::kPolicyHomepageIsNewTabPage); 258 map.find(ConfigurationPolicyStore::kPolicyHomepageIsNewTabPage);
259 EXPECT_TRUE(i != map.end()); 259 EXPECT_TRUE(i != map.end());
260 bool value = false; 260 bool value = false;
261 i->second->GetAsBoolean(&value); 261 i->second->GetAsBoolean(&value);
262 EXPECT_EQ(true, value); 262 EXPECT_EQ(true, value);
263 } 263 }
264 264
265 TEST_F(WinConfigurationPolicyProviderTest, 265 TEST_F(ConfigurationPolicyProviderWinTest,
266 TestCookiesModePolicyDefault) { 266 TestCookiesModePolicyDefault) {
267 MockConfigurationPolicyStore store; 267 MockConfigurationPolicyStore store;
268 TestWinConfigurationPolicyProvider provider; 268 TestConfigurationPolicyProviderWin provider;
269 269
270 provider.Provide(&store); 270 provider.Provide(&store);
271 271
272 const MockConfigurationPolicyStore::PolicyMap& map(store.policy_map()); 272 const MockConfigurationPolicyStore::PolicyMap& map(store.policy_map());
273 MockConfigurationPolicyStore::PolicyMap::const_iterator i = 273 MockConfigurationPolicyStore::PolicyMap::const_iterator i =
274 map.find(ConfigurationPolicyStore::kPolicyCookiesMode); 274 map.find(ConfigurationPolicyStore::kPolicyCookiesMode);
275 EXPECT_TRUE(i == map.end()); 275 EXPECT_TRUE(i == map.end());
276 } 276 }
277 277
278 TEST_F(WinConfigurationPolicyProviderTest, 278 TEST_F(ConfigurationPolicyProviderWinTest,
279 TestCookiesModePolicyHKLM) { 279 TestCookiesModePolicyHKLM) {
280 MockConfigurationPolicyStore store; 280 MockConfigurationPolicyStore store;
281 TestWinConfigurationPolicyProvider provider; 281 TestConfigurationPolicyProviderWin provider;
282 provider.SetCookiesMode(HKEY_LOCAL_MACHINE, 2); 282 provider.SetCookiesMode(HKEY_LOCAL_MACHINE, 2);
283 283
284 provider.Provide(&store); 284 provider.Provide(&store);
285 285
286 const MockConfigurationPolicyStore::PolicyMap& map(store.policy_map()); 286 const MockConfigurationPolicyStore::PolicyMap& map(store.policy_map());
287 MockConfigurationPolicyStore::PolicyMap::const_iterator i = 287 MockConfigurationPolicyStore::PolicyMap::const_iterator i =
288 map.find(ConfigurationPolicyStore::kPolicyCookiesMode); 288 map.find(ConfigurationPolicyStore::kPolicyCookiesMode);
289 EXPECT_TRUE(i != map.end()); 289 EXPECT_TRUE(i != map.end());
290 int value = 0; 290 int value = 0;
291 i->second->GetAsInteger(&value); 291 i->second->GetAsInteger(&value);
292 EXPECT_EQ(2, value); 292 EXPECT_EQ(2, value);
293 } 293 }
294 294
OLDNEW
« no previous file with comments | « chrome/browser/configuration_policy_provider_win.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698