| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/component_cloud_policy_store.h" | 5 #include "components/policy/core/common/cloud/component_cloud_policy_store.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <map> | 9 #include <map> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 builder_.policy_data().set_policy_type( | 81 builder_.policy_data().set_policy_type( |
| 82 dm_protocol::kChromeExtensionPolicyType); | 82 dm_protocol::kChromeExtensionPolicyType); |
| 83 builder_.policy_data().set_settings_entity_id(kTestExtension); | 83 builder_.policy_data().set_settings_entity_id(kTestExtension); |
| 84 builder_.payload().set_download_url(kTestDownload); | 84 builder_.payload().set_download_url(kTestDownload); |
| 85 builder_.payload().set_secure_hash(TestPolicyHash()); | 85 builder_.payload().set_secure_hash(TestPolicyHash()); |
| 86 | 86 |
| 87 public_key_ = builder_.GetPublicSigningKeyAsString(); | 87 public_key_ = builder_.GetPublicSigningKeyAsString(); |
| 88 | 88 |
| 89 PolicyMap& policy = expected_bundle_.Get(kTestPolicyNS); | 89 PolicyMap& policy = expected_bundle_.Get(kTestPolicyNS); |
| 90 policy.Set("Name", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 90 policy.Set("Name", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
| 91 POLICY_SOURCE_CLOUD, | 91 POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("disabled"), |
| 92 base::MakeUnique<base::StringValue>("disabled"), nullptr); | 92 nullptr); |
| 93 policy.Set("Second", POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER, | 93 policy.Set("Second", POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER, |
| 94 POLICY_SOURCE_CLOUD, | 94 POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("maybe"), |
| 95 base::MakeUnique<base::StringValue>("maybe"), nullptr); | 95 nullptr); |
| 96 } | 96 } |
| 97 | 97 |
| 98 void SetUp() override { | 98 void SetUp() override { |
| 99 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 99 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 100 cache_.reset( | 100 cache_.reset( |
| 101 new ResourceCache(temp_dir_.GetPath(), | 101 new ResourceCache(temp_dir_.GetPath(), |
| 102 make_scoped_refptr(new base::TestSimpleTaskRunner))); | 102 make_scoped_refptr(new base::TestSimpleTaskRunner))); |
| 103 store_.reset(new ComponentCloudPolicyStore(&store_delegate_, cache_.get())); | 103 store_.reset(new ComponentCloudPolicyStore(&store_delegate_, cache_.get())); |
| 104 store_->SetCredentials(ComponentPolicyBuilder::kFakeUsername, | 104 store_->SetCredentials(ComponentPolicyBuilder::kFakeUsername, |
| 105 ComponentPolicyBuilder::kFakeToken, | 105 ComponentPolicyBuilder::kFakeToken, |
| (...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 ComponentPolicyBuilder::kFakeUsername, | 551 ComponentPolicyBuilder::kFakeUsername, |
| 552 ComponentPolicyBuilder::kFakeToken, | 552 ComponentPolicyBuilder::kFakeToken, |
| 553 ComponentPolicyBuilder::kFakeDeviceId, | 553 ComponentPolicyBuilder::kFakeDeviceId, |
| 554 public_key_, | 554 public_key_, |
| 555 ComponentPolicyBuilder::kFakePublicKeyVersion); | 555 ComponentPolicyBuilder::kFakePublicKeyVersion); |
| 556 yet_another_store.Load(); | 556 yet_another_store.Load(); |
| 557 EXPECT_TRUE(yet_another_store.policy().Equals(empty_bundle)); | 557 EXPECT_TRUE(yet_another_store.policy().Equals(empty_bundle)); |
| 558 } | 558 } |
| 559 | 559 |
| 560 } // namespace policy | 560 } // namespace policy |
| OLD | NEW |