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

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

Issue 10827216: Don't run BrowserPolicyConnector::Init from TestingBrowserProcess by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased 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 "chrome/browser/policy/user_cloud_policy_store.h" 5 #include "chrome/browser/policy/user_cloud_policy_store.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "chrome/browser/policy/policy_builder.h" 9 #include "chrome/browser/policy/policy_builder.h"
10 #include "chrome/browser/signin/signin_manager.h" 10 #include "chrome/browser/signin/signin_manager.h"
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 95
96 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStoreTest); 96 DISALLOW_COPY_AND_ASSIGN(UserCloudPolicyStoreTest);
97 }; 97 };
98 98
99 TEST_F(UserCloudPolicyStoreTest, Store) { 99 TEST_F(UserCloudPolicyStoreTest, Store) {
100 EXPECT_FALSE(store_->policy()); 100 EXPECT_FALSE(store_->policy());
101 EXPECT_TRUE(store_->policy_map().empty()); 101 EXPECT_TRUE(store_->policy_map().empty());
102 102
103 // Store a simple policy and make sure it ends up as the currently active 103 // Store a simple policy and make sure it ends up as the currently active
104 // policy. 104 // policy.
105 EXPECT_CALL(observer_, OnStoreLoaded(store_.get()));
105 store_->Store(policy_.policy()); 106 store_->Store(policy_.policy());
106 base::RunLoop run_loop; 107 base::RunLoop run_loop;
107 run_loop.RunUntilIdle(); 108 run_loop.RunUntilIdle();
108 109
109 // Policy should be decoded and stored. 110 // Policy should be decoded and stored.
110 ASSERT_TRUE(store_->policy()); 111 ASSERT_TRUE(store_->policy());
111 EXPECT_EQ(policy_.policy_data().SerializeAsString(), 112 EXPECT_EQ(policy_.policy_data().SerializeAsString(),
112 store_->policy()->SerializeAsString()); 113 store_->policy()->SerializeAsString());
113 VerifyPolicyMap(); 114 VerifyPolicyMap();
114 EXPECT_EQ(CloudPolicyStore::STATUS_OK, store_->status()); 115 EXPECT_EQ(CloudPolicyStore::STATUS_OK, store_->status());
115 } 116 }
116 117
117 TEST_F(UserCloudPolicyStoreTest, StoreValidationError) { 118 TEST_F(UserCloudPolicyStoreTest, StoreValidationError) {
118 // Create an invalid policy (no policy type). 119 // Create an invalid policy (no policy type).
119 policy_.policy_data().clear_policy_type(); 120 policy_.policy_data().clear_policy_type();
120 policy_.Build(); 121 policy_.Build();
121 122
122 // Store policy. 123 // Store policy.
123 ExpectError(CloudPolicyStore::STATUS_VALIDATION_ERROR); 124 ExpectError(CloudPolicyStore::STATUS_VALIDATION_ERROR);
124 store_->Store(policy_.policy()); 125 store_->Store(policy_.policy());
125 base::RunLoop run_loop; 126 base::RunLoop run_loop;
126 run_loop.RunUntilIdle(); 127 run_loop.RunUntilIdle();
127 ASSERT_FALSE(store_->policy()); 128 ASSERT_FALSE(store_->policy());
128 } 129 }
129 130
130 } // namespace 131 } // namespace
131 132
132 } // namespace policy 133 } // namespace policy
133 134
OLDNEW
« no previous file with comments | « chrome/browser/policy/config_dir_policy_loader.cc ('k') | chrome/browser/policy/user_policy_signin_service_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698