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

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

Issue 8586030: Added ConfigurationPolicyProvider::RefreshPolicies. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased 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 <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 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 ConfigurationPolicyProviderMac provider_; 130 ConfigurationPolicyProviderMac provider_;
131 }; 131 };
132 132
133 TEST_F(ConfigurationPolicyProviderMacTest, Invalid) { 133 TEST_F(ConfigurationPolicyProviderMacTest, Invalid) {
134 ScopedCFTypeRef<CFStringRef> name( 134 ScopedCFTypeRef<CFStringRef> name(
135 base::SysUTF8ToCFStringRef(test_policy_definitions::kKeyString)); 135 base::SysUTF8ToCFStringRef(test_policy_definitions::kKeyString));
136 ScopedCFTypeRef<CFDataRef> invalid_data(CFDataCreate(NULL, NULL, 0)); 136 ScopedCFTypeRef<CFDataRef> invalid_data(CFDataCreate(NULL, NULL, 0));
137 prefs_->AddTestItem(name, invalid_data.get(), true); 137 prefs_->AddTestItem(name, invalid_data.get(), true);
138 138
139 // Create the provider and have it read |prefs_|. 139 // Create the provider and have it read |prefs_|.
140 provider_.ForceReload(); 140 provider_.RefreshPolicies();
141 loop_.RunAllPending();
141 PolicyMap policy_map; 142 PolicyMap policy_map;
142 EXPECT_TRUE(provider_.Provide(&policy_map)); 143 EXPECT_TRUE(provider_.Provide(&policy_map));
143 EXPECT_TRUE(policy_map.empty()); 144 EXPECT_TRUE(policy_map.empty());
144 } 145 }
145 146
146 TEST_F(ConfigurationPolicyProviderMacTest, TestNonForcedValue) { 147 TEST_F(ConfigurationPolicyProviderMacTest, TestNonForcedValue) {
147 ScopedCFTypeRef<CFStringRef> name( 148 ScopedCFTypeRef<CFStringRef> name(
148 base::SysUTF8ToCFStringRef(test_policy_definitions::kKeyString)); 149 base::SysUTF8ToCFStringRef(test_policy_definitions::kKeyString));
149 ScopedCFTypeRef<CFPropertyListRef> test_value( 150 ScopedCFTypeRef<CFPropertyListRef> test_value(
150 base::SysUTF8ToCFStringRef("string value")); 151 base::SysUTF8ToCFStringRef("string value"));
151 ASSERT_TRUE(test_value.get()); 152 ASSERT_TRUE(test_value.get());
152 prefs_->AddTestItem(name, test_value.get(), false); 153 prefs_->AddTestItem(name, test_value.get(), false);
153 154
154 // Create the provider and have it read |prefs_|. 155 // Create the provider and have it read |prefs_|.
155 provider_.ForceReload(); 156 provider_.RefreshPolicies();
157 loop_.RunAllPending();
156 PolicyMap policy_map; 158 PolicyMap policy_map;
157 EXPECT_TRUE(provider_.Provide(&policy_map)); 159 EXPECT_TRUE(provider_.Provide(&policy_map));
158 EXPECT_TRUE(policy_map.empty()); 160 EXPECT_TRUE(policy_map.empty());
159 } 161 }
160 162
161 } // namespace policy 163 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/configuration_policy_provider.cc ('k') | chrome/browser/policy/configuration_policy_provider_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698