| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "components/policy/core/common/cloud/user_cloud_policy_store.h" | 5 #include "components/policy/core/common/cloud/user_cloud_policy_store.h" |
| 6 | 6 |
| 7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
| 8 #include "base/files/scoped_temp_dir.h" | 8 #include "base/files/scoped_temp_dir.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 RunUntilIdle(); | 81 RunUntilIdle(); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void InitPolicyPayload(enterprise_management::CloudPolicySettings* payload) { | 84 void InitPolicyPayload(enterprise_management::CloudPolicySettings* payload) { |
| 85 payload->mutable_passwordmanagerenabled()->set_value(true); | 85 payload->mutable_passwordmanagerenabled()->set_value(true); |
| 86 payload->mutable_urlblacklist()->mutable_value()->add_entries( | 86 payload->mutable_urlblacklist()->mutable_value()->add_entries( |
| 87 "chromium.org"); | 87 "chromium.org"); |
| 88 } | 88 } |
| 89 | 89 |
| 90 base::FilePath policy_file() { | 90 base::FilePath policy_file() { |
| 91 return tmp_dir_.path().AppendASCII("policy"); | 91 return tmp_dir_.GetPath().AppendASCII("policy"); |
| 92 } | 92 } |
| 93 | 93 |
| 94 base::FilePath key_file() { | 94 base::FilePath key_file() { |
| 95 return tmp_dir_.path().AppendASCII("policy_key"); | 95 return tmp_dir_.GetPath().AppendASCII("policy_key"); |
| 96 } | 96 } |
| 97 | 97 |
| 98 // Verifies that store_->policy_map() has the appropriate entries. | 98 // Verifies that store_->policy_map() has the appropriate entries. |
| 99 void VerifyPolicyMap(CloudPolicyStore* store) { | 99 void VerifyPolicyMap(CloudPolicyStore* store) { |
| 100 EXPECT_EQ(2U, store->policy_map().size()); | 100 EXPECT_EQ(2U, store->policy_map().size()); |
| 101 const PolicyMap::Entry* entry = | 101 const PolicyMap::Entry* entry = |
| 102 store->policy_map().Get(key::kPasswordManagerEnabled); | 102 store->policy_map().Get(key::kPasswordManagerEnabled); |
| 103 ASSERT_TRUE(entry); | 103 ASSERT_TRUE(entry); |
| 104 EXPECT_TRUE(base::FundamentalValue(true).Equals(entry->value.get())); | 104 EXPECT_TRUE(base::FundamentalValue(true).Equals(entry->value.get())); |
| 105 ASSERT_TRUE(store->policy_map().Get(key::kURLBlacklist)); | 105 ASSERT_TRUE(store->policy_map().Get(key::kURLBlacklist)); |
| (...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 loop_.task_runner())); | 508 loop_.task_runner())); |
| 509 store2->SetSigninUsername(PolicyBuilder::kFakeUsername); | 509 store2->SetSigninUsername(PolicyBuilder::kFakeUsername); |
| 510 store2->AddObserver(&observer_); | 510 store2->AddObserver(&observer_); |
| 511 ExpectError(store2.get(), CloudPolicyStore::STATUS_VALIDATION_ERROR); | 511 ExpectError(store2.get(), CloudPolicyStore::STATUS_VALIDATION_ERROR); |
| 512 store2->Load(); | 512 store2->Load(); |
| 513 RunUntilIdle(); | 513 RunUntilIdle(); |
| 514 store2->RemoveObserver(&observer_); | 514 store2->RemoveObserver(&observer_); |
| 515 } | 515 } |
| 516 | 516 |
| 517 } // namespace policy | 517 } // namespace policy |
| OLD | NEW |