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

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

Issue 9111022: Removed ConfigurationPolicyType and extended PolicyMap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 years, 11 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
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 <gtest/gtest.h> 5 #include <gtest/gtest.h>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/mac/scoped_cftyperef.h" 8 #include "base/mac/scoped_cftyperef.h"
9 #include "base/sys_string_conversions.h" 9 #include "base/sys_string_conversions.h"
10 #include "chrome/browser/policy/asynchronous_policy_test_base.h" 10 #include "chrome/browser/policy/asynchronous_policy_test_base.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 51
52 TestHarness::TestHarness() {} 52 TestHarness::TestHarness() {}
53 53
54 TestHarness::~TestHarness() {} 54 TestHarness::~TestHarness() {}
55 55
56 void TestHarness::SetUp() {} 56 void TestHarness::SetUp() {}
57 57
58 AsynchronousPolicyProvider* TestHarness::CreateProvider( 58 AsynchronousPolicyProvider* TestHarness::CreateProvider(
59 const PolicyDefinitionList* policy_definition_list) { 59 const PolicyDefinitionList* policy_definition_list) {
60 prefs_ = new MockPreferences(); 60 prefs_ = new MockPreferences();
61 return new ConfigurationPolicyProviderMac(policy_definition_list, prefs_); 61 return new ConfigurationPolicyProviderMac(policy_definition_list,
62 POLICY_LEVEL_MANDATORY,
63 prefs_);
62 } 64 }
63 65
64 void TestHarness::InstallEmptyPolicy() {} 66 void TestHarness::InstallEmptyPolicy() {}
65 67
66 void TestHarness::InstallStringPolicy(const std::string& policy_name, 68 void TestHarness::InstallStringPolicy(const std::string& policy_name,
67 const std::string& policy_value) { 69 const std::string& policy_value) {
68 ScopedCFTypeRef<CFStringRef> name(base::SysUTF8ToCFStringRef(policy_name)); 70 ScopedCFTypeRef<CFStringRef> name(base::SysUTF8ToCFStringRef(policy_name));
69 ScopedCFTypeRef<CFStringRef> value(base::SysUTF8ToCFStringRef(policy_value)); 71 ScopedCFTypeRef<CFStringRef> value(base::SysUTF8ToCFStringRef(policy_value));
70 prefs_->AddTestItem(name, value, true); 72 prefs_->AddTestItem(name, value, true);
71 } 73 }
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 INSTANTIATE_TEST_CASE_P( 118 INSTANTIATE_TEST_CASE_P(
117 ConfigurationPolicyProviderMacTest, 119 ConfigurationPolicyProviderMacTest,
118 ConfigurationPolicyProviderTest, 120 ConfigurationPolicyProviderTest,
119 testing::Values(TestHarness::Create)); 121 testing::Values(TestHarness::Create));
120 122
121 // Special test cases for some mac preferences details. 123 // Special test cases for some mac preferences details.
122 class ConfigurationPolicyProviderMacTest : public AsynchronousPolicyTestBase { 124 class ConfigurationPolicyProviderMacTest : public AsynchronousPolicyTestBase {
123 protected: 125 protected:
124 ConfigurationPolicyProviderMacTest() 126 ConfigurationPolicyProviderMacTest()
125 : prefs_(new MockPreferences()), 127 : prefs_(new MockPreferences()),
126 provider_(&test_policy_definitions::kList, prefs_) {} 128 provider_(&test_policy_definitions::kList,
129 POLICY_LEVEL_MANDATORY,
130 prefs_) {}
127 virtual ~ConfigurationPolicyProviderMacTest() {} 131 virtual ~ConfigurationPolicyProviderMacTest() {}
128 132
129 MockPreferences* prefs_; 133 MockPreferences* prefs_;
130 ConfigurationPolicyProviderMac provider_; 134 ConfigurationPolicyProviderMac provider_;
131 }; 135 };
132 136
133 TEST_F(ConfigurationPolicyProviderMacTest, Invalid) { 137 TEST_F(ConfigurationPolicyProviderMacTest, Invalid) {
134 ScopedCFTypeRef<CFStringRef> name( 138 ScopedCFTypeRef<CFStringRef> name(
135 base::SysUTF8ToCFStringRef(test_policy_definitions::kKeyString)); 139 base::SysUTF8ToCFStringRef(test_policy_definitions::kKeyString));
136 ScopedCFTypeRef<CFDataRef> invalid_data(CFDataCreate(NULL, NULL, 0)); 140 ScopedCFTypeRef<CFDataRef> invalid_data(CFDataCreate(NULL, NULL, 0));
(...skipping 17 matching lines...) Expand all
154 158
155 // Create the provider and have it read |prefs_|. 159 // Create the provider and have it read |prefs_|.
156 provider_.RefreshPolicies(); 160 provider_.RefreshPolicies();
157 loop_.RunAllPending(); 161 loop_.RunAllPending();
158 PolicyMap policy_map; 162 PolicyMap policy_map;
159 EXPECT_TRUE(provider_.Provide(&policy_map)); 163 EXPECT_TRUE(provider_.Provide(&policy_map));
160 EXPECT_TRUE(policy_map.empty()); 164 EXPECT_TRUE(policy_map.empty());
161 } 165 }
162 166
163 } // namespace policy 167 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/configuration_policy_provider_mac.cc ('k') | chrome/browser/policy/configuration_policy_provider_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698