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

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

Issue 10854213: Added UserCloudPolicyManager::ShutdownAndRemovePolicy() (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/memory/scoped_ptr.h" 6 #include "base/memory/scoped_ptr.h"
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "chrome/browser/policy/cloud_policy_service.h" 8 #include "chrome/browser/policy/cloud_policy_service.h"
9 #include "chrome/browser/policy/configuration_policy_provider_test.h" 9 #include "chrome/browser/policy/configuration_policy_provider_test.h"
10 #include "chrome/browser/policy/mock_cloud_policy_store.h" 10 #include "chrome/browser/policy/mock_cloud_policy_store.h"
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 EXPECT_TRUE(empty_bundle.Equals(manager_->policies())); 202 EXPECT_TRUE(empty_bundle.Equals(manager_->policies()));
203 EXPECT_FALSE(manager_->IsInitializationComplete()); 203 EXPECT_FALSE(manager_->IsInitializationComplete());
204 204
205 store_->policy_map_.CopyFrom(policy_map_); 205 store_->policy_map_.CopyFrom(policy_map_);
206 EXPECT_CALL(observer_, OnUpdatePolicy(manager_.get())); 206 EXPECT_CALL(observer_, OnUpdatePolicy(manager_.get()));
207 store_->NotifyStoreLoaded(); 207 store_->NotifyStoreLoaded();
208 EXPECT_TRUE(expected_bundle_.Equals(manager_->policies())); 208 EXPECT_TRUE(expected_bundle_.Equals(manager_->policies()));
209 EXPECT_TRUE(manager_->IsInitializationComplete()); 209 EXPECT_TRUE(manager_->IsInitializationComplete());
210 } 210 }
211 211
212 TEST_F(UserCloudPolicyManagerTest, ShutdownAndRemovePolicy) {
213 // Load policy, make sure it goes away when ShutdownAndRemove() is called.
214 CreateManager(false);
215 store_->policy_map_.CopyFrom(policy_map_);
216 EXPECT_CALL(observer_, OnUpdatePolicy(manager_.get()));
217 store_->NotifyStoreLoaded();
218 EXPECT_TRUE(expected_bundle_.Equals(manager_->policies()));
219 EXPECT_TRUE(manager_->IsInitializationComplete());
220 EXPECT_CALL(*store_, Clear());
221 manager_->ShutdownAndRemovePolicy();
222 EXPECT_FALSE(manager_->cloud_policy_service());
223 }
224
212 TEST_F(UserCloudPolicyManagerTest, Update) { 225 TEST_F(UserCloudPolicyManagerTest, Update) {
213 CreateManager(false); 226 CreateManager(false);
214 EXPECT_CALL(observer_, OnUpdatePolicy(manager_.get())); 227 EXPECT_CALL(observer_, OnUpdatePolicy(manager_.get()));
215 store_->NotifyStoreLoaded(); 228 store_->NotifyStoreLoaded();
216 EXPECT_TRUE(manager_->IsInitializationComplete()); 229 EXPECT_TRUE(manager_->IsInitializationComplete());
217 PolicyBundle empty_bundle; 230 PolicyBundle empty_bundle;
218 EXPECT_TRUE(empty_bundle.Equals(manager_->policies())); 231 EXPECT_TRUE(empty_bundle.Equals(manager_->policies()));
219 232
220 store_->policy_map_.CopyFrom(policy_map_); 233 store_->policy_map_.CopyFrom(policy_map_);
221 EXPECT_CALL(observer_, OnUpdatePolicy(manager_.get())); 234 EXPECT_CALL(observer_, OnUpdatePolicy(manager_.get()));
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 349
337 // Cancelling the initial fetch should flip the flag. 350 // Cancelling the initial fetch should flip the flag.
338 EXPECT_CALL(observer_, OnUpdatePolicy(manager_.get())); 351 EXPECT_CALL(observer_, OnUpdatePolicy(manager_.get()));
339 manager_->CancelWaitForPolicyFetch(); 352 manager_->CancelWaitForPolicyFetch();
340 EXPECT_TRUE(manager_->IsInitializationComplete()); 353 EXPECT_TRUE(manager_->IsInitializationComplete());
341 Mock::VerifyAndClearExpectations(&observer_); 354 Mock::VerifyAndClearExpectations(&observer_);
342 } 355 }
343 356
344 } // namespace 357 } // namespace
345 } // namespace policy 358 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/user_cloud_policy_manager.cc ('k') | chrome/browser/policy/user_cloud_policy_store.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698