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

Unified Diff: chrome/browser/policy/cloud_policy_controller_unittest.cc

Issue 7147015: Move user cloud policy to BrowserProcess (was 6979011) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cut a circular startup dependency Created 9 years, 6 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 side-by-side diff with in-line comments
Download patch
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 a008a1e99c21449fb5c2f9e6b8513afd75333405..f349e7bc0668fb541f4e5c62432551afadf0a461 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_impl.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/logging_work_scheduler.h"
@@ -86,6 +88,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 CloudPolicyProviderImpl(
+ policy::ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(),
+ CloudPolicyCacheBase::POLICY_LEVEL_MANDATORY));
+ recommended_cloud_provider_.reset(new CloudPolicyProviderImpl(
+ policy::ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList(),
+ CloudPolicyCacheBase::POLICY_LEVEL_RECOMMENDED));
+ mandatory_cloud_provider_->AppendCache(cache_.get());
+ recommended_cloud_provider_->AppendCache(cache_.get());
Mattias Nissler (ping if slow) 2011/06/21 20:09:56 As mentioned earlier, I think we should just remov
gfeher 2011/06/22 19:18:34 Done.
token_fetcher_.reset(new MockDeviceTokenFetcher(cache_.get()));
service_.set_backend(&backend_);
}
@@ -104,10 +114,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(
@@ -143,6 +155,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_;

Powered by Google App Engine
This is Rietveld 408576698