Index: chrome/browser/policy/cloud_policy_controller_unittest.cc |
diff --git a/chrome/browser/policy/cloud_policy_controller_unittest.cc b/chrome/browser/policy/cloud_policy_controller_unittest.cc |
index df2ae58254b063b67b39de2234a7d6c3680a890e..408c7911262141f2819af229f02ac0d0937831f9 100644 |
--- a/chrome/browser/policy/cloud_policy_controller_unittest.cc |
+++ b/chrome/browser/policy/cloud_policy_controller_unittest.cc |
@@ -6,6 +6,8 @@ |
#include "base/message_loop.h" |
#include "base/scoped_temp_dir.h" |
+#include "chrome/browser/policy/cloud_policy_provider.h" |
+#include "chrome/browser/policy/configuration_policy_pref_store.h" |
#include "chrome/browser/policy/device_management_service.h" |
#include "chrome/browser/policy/device_token_fetcher.h" |
#include "chrome/browser/policy/mock_configuration_policy_store.h" |
@@ -85,6 +87,14 @@ class CloudPolicyControllerTest : public testing::Test { |
ASSERT_TRUE(temp_user_data_dir_.CreateUniqueTempDir()); |
cache_.reset(new UserPolicyCache( |
temp_user_data_dir_.path().AppendASCII("CloudPolicyControllerTest"))); |
+ mandatory_cloud_provider_.reset(new CloudPolicyProvider( |
+ policy::ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(), |
+ CloudPolicyCacheBase::POLICY_LEVEL_MANDATORY)); |
+ recommended_cloud_provider_.reset(new CloudPolicyProvider( |
+ policy::ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(), |
+ CloudPolicyCacheBase::POLICY_LEVEL_RECOMMENDED)); |
+ mandatory_cloud_provider_->AppendCache(cache_.get()); |
+ recommended_cloud_provider_->AppendCache(cache_.get()); |
token_fetcher_.reset(new MockDeviceTokenFetcher(cache_.get())); |
service_.set_backend(&backend_); |
} |
@@ -116,10 +126,12 @@ class CloudPolicyControllerTest : public testing::Test { |
void ExpectHasSpdyPolicy() { |
MockConfigurationPolicyStore store; |
EXPECT_CALL(store, Apply(_, _)).Times(AtLeast(1)); |
- cache_->GetManagedPolicyProvider()->Provide(&store); |
+ mandatory_cloud_provider_.get()->Provide(&store); |
FundamentalValue expected(true); |
- ASSERT_TRUE(store.Get(kPolicyDisableSpdy) != NULL); |
- EXPECT_TRUE(store.Get(kPolicyDisableSpdy)->Equals(&expected)); |
+ const PolicyMap* policy_map = cache_->policy( |
+ CloudPolicyCacheBase::POLICY_LEVEL_MANDATORY); |
+ ASSERT_TRUE(policy_map->Get(kPolicyDisableSpdy)); |
+ EXPECT_TRUE(policy_map->Get(kPolicyDisableSpdy)->Equals(&expected)); |
} |
void SetupIdentityStrategy( |
@@ -151,6 +163,8 @@ class CloudPolicyControllerTest : public testing::Test { |
protected: |
scoped_ptr<CloudPolicyCacheBase> cache_; |
+ scoped_ptr<CloudPolicyProvider> recommended_cloud_provider_; |
+ scoped_ptr<CloudPolicyProvider> mandatory_cloud_provider_; |
scoped_ptr<CloudPolicyController> controller_; |
scoped_ptr<MockDeviceTokenFetcher> token_fetcher_; |
MockCloudPolicyIdentityStrategy identity_strategy_; |