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

Side by Side Diff: chrome/browser/policy/config_dir_policy_provider_unittest.cc

Issue 8139029: Make policy errors available to display in about:policy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed unused replacement string DCHECK from policy_error_map.cc Created 9 years, 1 month 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
OLDNEW
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 <algorithm> 5 #include <algorithm>
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/json/json_value_serializer.h" 8 #include "base/json/json_value_serializer.h"
9 #include "base/path_service.h" 9 #include "base/path_service.h"
10 #include "base/scoped_temp_dir.h" 10 #include "base/scoped_temp_dir.h"
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
185 BrowserThread file_thread_; 185 BrowserThread file_thread_;
186 }; 186 };
187 187
188 TEST_P(ConfigDirPolicyProviderValueTest, Default) { 188 TEST_P(ConfigDirPolicyProviderValueTest, Default) {
189 ConfigDirPolicyProvider provider(GetChromePolicyDefinitionList(), test_dir()); 189 ConfigDirPolicyProvider provider(GetChromePolicyDefinitionList(), test_dir());
190 PolicyMap policy_map; 190 PolicyMap policy_map;
191 EXPECT_TRUE(provider.Provide(&policy_map)); 191 EXPECT_TRUE(provider.Provide(&policy_map));
192 EXPECT_TRUE(policy_map.empty()); 192 EXPECT_TRUE(policy_map.empty());
193 } 193 }
194 194
195 TEST_P(ConfigDirPolicyProviderValueTest, NullValue) {
196 DictionaryValue dict;
197 dict.Set(GetParam().policy_key(), Value::CreateNullValue());
198 WriteConfigFile(dict, "empty");
199 ConfigDirPolicyProvider provider(GetChromePolicyDefinitionList(), test_dir());
200 PolicyMap policy_map;
201 EXPECT_TRUE(provider.Provide(&policy_map));
202 EXPECT_TRUE(policy_map.empty());
203 }
204
205 TEST_P(ConfigDirPolicyProviderValueTest, TestValue) { 195 TEST_P(ConfigDirPolicyProviderValueTest, TestValue) {
206 DictionaryValue dict; 196 DictionaryValue dict;
207 dict.Set(GetParam().policy_key(), GetParam().test_value()->DeepCopy()); 197 dict.Set(GetParam().policy_key(), GetParam().test_value()->DeepCopy());
208 WriteConfigFile(dict, "policy"); 198 WriteConfigFile(dict, "policy");
209 ConfigDirPolicyProvider provider(GetChromePolicyDefinitionList(), test_dir()); 199 ConfigDirPolicyProvider provider(GetChromePolicyDefinitionList(), test_dir());
210 PolicyMap policy_map; 200 PolicyMap policy_map;
211 EXPECT_TRUE(provider.Provide(&policy_map)); 201 EXPECT_TRUE(provider.Provide(&policy_map));
212 EXPECT_EQ(1U, policy_map.size()); 202 EXPECT_EQ(1U, policy_map.size());
213 const Value* value = policy_map.Get(GetParam().type()); 203 const Value* value = policy_map.Get(GetParam().type());
214 ASSERT_TRUE(value); 204 ASSERT_TRUE(value);
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 INSTANTIATE_TEST_CASE_P( 368 INSTANTIATE_TEST_CASE_P(
379 ConfigDirPolicyProviderValueTestChromeOSInstance, 369 ConfigDirPolicyProviderValueTestChromeOSInstance,
380 ConfigDirPolicyProviderValueTest, 370 ConfigDirPolicyProviderValueTest,
381 testing::Values( 371 testing::Values(
382 ValueTestParams::ForIntegerPolicy( 372 ValueTestParams::ForIntegerPolicy(
383 kPolicyPolicyRefreshRate, 373 kPolicyPolicyRefreshRate,
384 key::kPolicyRefreshRate))); 374 key::kPolicyRefreshRate)));
385 #endif 375 #endif
386 376
387 } // namespace policy 377 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/browser_policy_connector.cc ('k') | chrome/browser/policy/configuration_policy_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698