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

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

Issue 11415094: Split UserCloudPolicyManager implementation. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Bring back ProxyPolicyProvider, fix local_state policy provider, fix Joao's fine CloudPolicyTest. Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/policy/user_cloud_policy_manager_chromeos_unittest.cc
diff --git a/chrome/browser/policy/user_cloud_policy_manager_unittest.cc b/chrome/browser/policy/user_cloud_policy_manager_chromeos_unittest.cc
similarity index 80%
copy from chrome/browser/policy/user_cloud_policy_manager_unittest.cc
copy to chrome/browser/policy/user_cloud_policy_manager_chromeos_unittest.cc
index 735926808af3358828cdb17cfe5180be54cd88a0..2a891c3dc87aac6f004cdcbeec0cca9a28133671 100644
--- a/chrome/browser/policy/user_cloud_policy_manager_unittest.cc
+++ b/chrome/browser/policy/user_cloud_policy_manager_chromeos_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/policy/user_cloud_policy_manager.h"
+#include "chrome/browser/policy/user_cloud_policy_manager_chromeos.h"
#include "base/basictypes.h"
#include "base/memory/scoped_ptr.h"
@@ -27,9 +27,9 @@ using testing::_;
namespace policy {
namespace {
-class UserCloudPolicyManagerTest : public testing::Test {
+class UserCloudPolicyManagerChromeOSTest : public testing::Test {
protected:
- UserCloudPolicyManagerTest()
+ UserCloudPolicyManagerChromeOSTest()
: store_(NULL) {}
virtual void SetUp() OVERRIDE {
@@ -59,19 +59,13 @@ class UserCloudPolicyManagerTest : public testing::Test {
}
}
- void CreateManager(bool wait_for_policy_fetch) {
+ void CreateManagerWithPendingFetch() {
store_ = new MockCloudPolicyStore();
- EXPECT_CALL(*store_, Load());
manager_.reset(
- new UserCloudPolicyManager(scoped_ptr<CloudPolicyStore>(store_),
- wait_for_policy_fetch));
+ new UserCloudPolicyManagerChromeOS(scoped_ptr<CloudPolicyStore>(store_),
+ true));
manager_->Init();
manager_->AddObserver(&observer_);
- Mock::VerifyAndClearExpectations(store_);
- }
-
- void CreateManagerWithPendingFetch() {
- CreateManager(true);
manager_->Initialize(&prefs_, &device_management_service_,
USER_AFFILIATION_NONE);
EXPECT_FALSE(manager_->IsInitializationComplete());
@@ -96,26 +90,13 @@ class UserCloudPolicyManagerTest : public testing::Test {
MockConfigurationPolicyObserver observer_;
MockDeviceManagementService device_management_service_;
MockCloudPolicyStore* store_;
- scoped_ptr<UserCloudPolicyManager> manager_;
+ scoped_ptr<UserCloudPolicyManagerChromeOS> manager_;
private:
- DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerTest);
+ DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyManagerChromeOSTest);
};
-TEST_F(UserCloudPolicyManagerTest, ShutdownAndRemovePolicy) {
- // Load policy, make sure it goes away when ShutdownAndRemove() is called.
- CreateManager(false);
- store_->policy_map_.CopyFrom(policy_map_);
- EXPECT_CALL(observer_, OnUpdatePolicy(manager_.get()));
- store_->NotifyStoreLoaded();
- EXPECT_TRUE(expected_bundle_.Equals(manager_->policies()));
- EXPECT_TRUE(manager_->IsInitializationComplete());
- EXPECT_CALL(*store_, Clear());
- manager_->ShutdownAndRemovePolicy();
- EXPECT_FALSE(manager_->cloud_policy_service());
-}
-
-TEST_F(UserCloudPolicyManagerTest, WaitForPolicyFetch) {
+TEST_F(UserCloudPolicyManagerChromeOSTest, WaitForPolicyFetch) {
CreateManagerWithPendingFetch();
// Setting the token should trigger the policy fetch.
@@ -144,7 +125,7 @@ TEST_F(UserCloudPolicyManagerTest, WaitForPolicyFetch) {
Mock::VerifyAndClearExpectations(&observer_);
}
-TEST_F(UserCloudPolicyManagerTest, WaitForPolicyFetchError) {
+TEST_F(UserCloudPolicyManagerChromeOSTest, WaitForPolicyFetchError) {
CreateManagerWithPendingFetch();
// Setting the token should trigger the policy fetch.
@@ -165,7 +146,7 @@ TEST_F(UserCloudPolicyManagerTest, WaitForPolicyFetchError) {
Mock::VerifyAndClearExpectations(&observer_);
}
-TEST_F(UserCloudPolicyManagerTest, WaitForPolicyFetchCancel) {
+TEST_F(UserCloudPolicyManagerChromeOSTest, WaitForPolicyFetchCancel) {
CreateManagerWithPendingFetch();
// Cancelling the initial fetch should flip the flag.

Powered by Google App Engine
This is Rietveld 408576698