| 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/user_cloud_policy_store.h" | 5 #include "chrome/browser/policy/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/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 store_.reset(); | 59 store_.reset(); |
| 60 RunUntilIdle(); | 60 RunUntilIdle(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 FilePath policy_file() { | 63 FilePath policy_file() { |
| 64 return tmp_dir_.path().AppendASCII("policy"); | 64 return tmp_dir_.path().AppendASCII("policy"); |
| 65 } | 65 } |
| 66 | 66 |
| 67 // Verifies that store_->policy_map() has the appropriate entries. | 67 // Verifies that store_->policy_map() has the appropriate entries. |
| 68 void VerifyPolicyMap(CloudPolicyStore* store) { | 68 void VerifyPolicyMap(CloudPolicyStore* store) { |
| 69 EXPECT_EQ(1U, store->policy_map().size()); | 69 EXPECT_EQ(2U, store->policy_map().size()); |
| 70 const PolicyMap::Entry* entry = | 70 const PolicyMap::Entry* entry = |
| 71 store->policy_map().Get(key::kShowHomeButton); | 71 store->policy_map().Get(key::kShowHomeButton); |
| 72 ASSERT_TRUE(entry); | 72 ASSERT_TRUE(entry); |
| 73 EXPECT_TRUE(base::FundamentalValue(true).Equals(entry->value)); | 73 EXPECT_TRUE(base::FundamentalValue(true).Equals(entry->value)); |
| 74 | 74 ASSERT_TRUE(store->policy_map().Get(key::kSyncDisabled)); |
| 75 // SyncDisabled policy should be filtered out. | |
| 76 ASSERT_FALSE(store->policy_map().Get(key::kSyncDisabled)); | |
| 77 } | 75 } |
| 78 | 76 |
| 79 // Install an expectation on |observer_| for an error code. | 77 // Install an expectation on |observer_| for an error code. |
| 80 void ExpectError(CloudPolicyStore* store, CloudPolicyStore::Status error) { | 78 void ExpectError(CloudPolicyStore* store, CloudPolicyStore::Status error) { |
| 81 EXPECT_CALL(observer_, | 79 EXPECT_CALL(observer_, |
| 82 OnStoreError(AllOf(Eq(store), | 80 OnStoreError(AllOf(Eq(store), |
| 83 Property(&CloudPolicyStore::status, | 81 Property(&CloudPolicyStore::status, |
| 84 Eq(error))))); | 82 Eq(error))))); |
| 85 } | 83 } |
| 86 | 84 |
| (...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 312 store2->Load(); | 310 store2->Load(); |
| 313 RunUntilIdle(); | 311 RunUntilIdle(); |
| 314 | 312 |
| 315 ASSERT_FALSE(store2->policy()); | 313 ASSERT_FALSE(store2->policy()); |
| 316 store2->RemoveObserver(&observer_); | 314 store2->RemoveObserver(&observer_); |
| 317 } | 315 } |
| 318 | 316 |
| 319 } // namespace | 317 } // namespace |
| 320 | 318 |
| 321 } // namespace policy | 319 } // namespace policy |
| OLD | NEW |