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

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

Issue 6979011: Move user cloud policy to BrowserProcess. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments by mnissler. 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
« no previous file with comments | « chrome/browser/policy/user_policy_cache.cc ('k') | chrome/browser/policy/user_policy_identity_strategy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/user_policy_cache_unittest.cc
diff --git a/chrome/browser/policy/user_policy_cache_unittest.cc b/chrome/browser/policy/user_policy_cache_unittest.cc
index 7f327ea2ccccb4a33248bcc412b61601ec48606d..426646abdece4d6b37c3ed8b1abba8947557c4eb 100644
--- a/chrome/browser/policy/user_policy_cache_unittest.cc
+++ b/chrome/browser/policy/user_policy_cache_unittest.cc
@@ -20,6 +20,8 @@
#include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h"
+using testing::_;
+
namespace policy {
// Decodes a CloudPolicySettings object into two maps with mandatory and
@@ -32,13 +34,13 @@ void DecodePolicy(const em::CloudPolicySettings& policy,
Value* DecodeIntegerValue(google::protobuf::int64 value);
ListValue* DecodeStringList(const em::StringList& string_list);
-class MockConfigurationPolicyProviderObserver
- : public ConfigurationPolicyProvider::Observer {
+class MockCloudPolicyCacheBaseObserver
+ : public CloudPolicyCacheBase::Observer {
public:
- MockConfigurationPolicyProviderObserver() {}
- virtual ~MockConfigurationPolicyProviderObserver() {}
- MOCK_METHOD0(OnUpdatePolicy, void());
- void OnProviderGoingAway() {}
+ MockCloudPolicyCacheBaseObserver() {}
+ virtual ~MockCloudPolicyCacheBaseObserver() {}
+ MOCK_METHOD1(OnCacheUpdate, void(CloudPolicyCacheBase*));
+ void OnCacheGoingAway(CloudPolicyCacheBase*) {}
};
// Tests the device management policy cache.
@@ -103,14 +105,16 @@ class UserPolicyCacheTest : public testing::Test {
em::PolicyFetchResponse* policy_response,
bool expect_changed_policy) {
scoped_ptr<em::PolicyFetchResponse> policy(policy_response);
- ConfigurationPolicyObserverRegistrar registrar;
- registrar.Init(cache->GetManagedPolicyProvider(), &observer);
+ cache->AddObserver(&observer);
+
if (expect_changed_policy)
- EXPECT_CALL(observer, OnUpdatePolicy()).Times(1);
+ EXPECT_CALL(observer, OnCacheUpdate(_)).Times(1);
else
- EXPECT_CALL(observer, OnUpdatePolicy()).Times(0);
+ EXPECT_CALL(observer, OnCacheUpdate(_)).Times(0);
cache->SetPolicy(*policy);
testing::Mock::VerifyAndClearExpectations(&observer);
+
+ cache->RemoveObserver(&observer);
}
FilePath test_file() {
@@ -126,7 +130,7 @@ class UserPolicyCacheTest : public testing::Test {
}
MessageLoop loop_;
- MockConfigurationPolicyProviderObserver observer;
+ MockCloudPolicyCacheBaseObserver observer;
private:
ScopedTempDir temp_dir_;
« no previous file with comments | « chrome/browser/policy/user_policy_cache.cc ('k') | chrome/browser/policy/user_policy_identity_strategy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698