| OLD | NEW |
| 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/cloud/user_cloud_policy_store.h" | 5 #include "chrome/browser/policy/cloud/user_cloud_policy_store.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 // Store a simple policy and make sure the file exists. | 192 // Store a simple policy and make sure the file exists. |
| 193 // policy. | 193 // policy. |
| 194 EXPECT_CALL(observer_, OnStoreLoaded(store_.get())); | 194 EXPECT_CALL(observer_, OnStoreLoaded(store_.get())); |
| 195 store_->Store(policy_.policy()); | 195 store_->Store(policy_.policy()); |
| 196 RunUntilIdle(); | 196 RunUntilIdle(); |
| 197 | 197 |
| 198 EXPECT_TRUE(store_->policy()); | 198 EXPECT_TRUE(store_->policy()); |
| 199 EXPECT_FALSE(store_->policy_map().empty()); | 199 EXPECT_FALSE(store_->policy_map().empty()); |
| 200 | 200 |
| 201 // Policy file should exist. | 201 // Policy file should exist. |
| 202 ASSERT_TRUE(file_util::PathExists(policy_file())); | 202 ASSERT_TRUE(base::PathExists(policy_file())); |
| 203 | 203 |
| 204 EXPECT_CALL(observer_, OnStoreLoaded(store_.get())); | 204 EXPECT_CALL(observer_, OnStoreLoaded(store_.get())); |
| 205 store_->Clear(); | 205 store_->Clear(); |
| 206 RunUntilIdle(); | 206 RunUntilIdle(); |
| 207 | 207 |
| 208 // Policy file should not exist. | 208 // Policy file should not exist. |
| 209 ASSERT_TRUE(!file_util::PathExists(policy_file())); | 209 ASSERT_TRUE(!base::PathExists(policy_file())); |
| 210 | 210 |
| 211 // Policy should be gone. | 211 // Policy should be gone. |
| 212 EXPECT_FALSE(store_->policy()); | 212 EXPECT_FALSE(store_->policy()); |
| 213 EXPECT_TRUE(store_->policy_map().empty()); | 213 EXPECT_TRUE(store_->policy_map().empty()); |
| 214 EXPECT_EQ(CloudPolicyStore::STATUS_OK, store_->status()); | 214 EXPECT_EQ(CloudPolicyStore::STATUS_OK, store_->status()); |
| 215 } | 215 } |
| 216 | 216 |
| 217 TEST_F(UserCloudPolicyStoreTest, StoreTwoTimes) { | 217 TEST_F(UserCloudPolicyStoreTest, StoreTwoTimes) { |
| 218 EXPECT_FALSE(store_->policy()); | 218 EXPECT_FALSE(store_->policy()); |
| 219 EXPECT_TRUE(store_->policy_map().empty()); | 219 EXPECT_TRUE(store_->policy_map().empty()); |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 store4->Load(); | 344 store4->Load(); |
| 345 RunUntilIdle(); | 345 RunUntilIdle(); |
| 346 | 346 |
| 347 ASSERT_FALSE(store4->policy()); | 347 ASSERT_FALSE(store4->policy()); |
| 348 store4->RemoveObserver(&observer_); | 348 store4->RemoveObserver(&observer_); |
| 349 } | 349 } |
| 350 | 350 |
| 351 } // namespace | 351 } // namespace |
| 352 | 352 |
| 353 } // namespace policy | 353 } // namespace policy |
| OLD | NEW |