| 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_updater.h" | 5 #include "components/policy/core/common/cloud/component_cloud_policy_updater.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 builder_.policy_data().set_policy_type( | 99 builder_.policy_data().set_policy_type( |
| 100 dm_protocol::kChromeExtensionPolicyType); | 100 dm_protocol::kChromeExtensionPolicyType); |
| 101 builder_.policy_data().set_settings_entity_id(kTestExtension); | 101 builder_.policy_data().set_settings_entity_id(kTestExtension); |
| 102 builder_.payload().set_download_url(kTestDownload); | 102 builder_.payload().set_download_url(kTestDownload); |
| 103 builder_.payload().set_secure_hash(crypto::SHA256HashString(kTestPolicy)); | 103 builder_.payload().set_secure_hash(crypto::SHA256HashString(kTestPolicy)); |
| 104 | 104 |
| 105 public_key_ = builder_.GetPublicSigningKeyAsString(); | 105 public_key_ = builder_.GetPublicSigningKeyAsString(); |
| 106 | 106 |
| 107 PolicyMap& policy = expected_bundle_.Get(kTestPolicyNS); | 107 PolicyMap& policy = expected_bundle_.Get(kTestPolicyNS); |
| 108 policy.Set("Name", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 108 policy.Set("Name", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
| 109 POLICY_SOURCE_CLOUD, | 109 POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("disabled"), |
| 110 base::MakeUnique<base::StringValue>("disabled"), nullptr); | 110 nullptr); |
| 111 policy.Set("Second", POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER, | 111 policy.Set("Second", POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER, |
| 112 POLICY_SOURCE_CLOUD, base::MakeUnique<base::StringValue>("maybe"), | 112 POLICY_SOURCE_CLOUD, base::MakeUnique<base::Value>("maybe"), |
| 113 nullptr); | 113 nullptr); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void ComponentCloudPolicyUpdaterTest::SetUp() { | 116 void ComponentCloudPolicyUpdaterTest::SetUp() { |
| 117 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 117 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 118 task_runner_ = new base::TestSimpleTaskRunner(); | 118 task_runner_ = new base::TestSimpleTaskRunner(); |
| 119 cache_.reset(new ResourceCache(temp_dir_.GetPath(), task_runner_)); | 119 cache_.reset(new ResourceCache(temp_dir_.GetPath(), task_runner_)); |
| 120 store_.reset(new ComponentCloudPolicyStore(&store_delegate_, cache_.get())); | 120 store_.reset(new ComponentCloudPolicyStore(&store_delegate_, cache_.get())); |
| 121 store_->SetCredentials(ComponentPolicyBuilder::kFakeUsername, | 121 store_->SetCredentials(ComponentPolicyBuilder::kFakeUsername, |
| 122 ComponentPolicyBuilder::kFakeToken, | 122 ComponentPolicyBuilder::kFakeToken, |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 461 | 461 |
| 462 // Now cancel that update before the download completes. | 462 // Now cancel that update before the download completes. |
| 463 EXPECT_CALL(store_delegate_, OnComponentCloudPolicyStoreUpdated()).Times(0); | 463 EXPECT_CALL(store_delegate_, OnComponentCloudPolicyStoreUpdated()).Times(0); |
| 464 updater_->CancelUpdate(kTestPolicyNS); | 464 updater_->CancelUpdate(kTestPolicyNS); |
| 465 task_runner_->RunUntilIdle(); | 465 task_runner_->RunUntilIdle(); |
| 466 Mock::VerifyAndClearExpectations(&store_delegate_); | 466 Mock::VerifyAndClearExpectations(&store_delegate_); |
| 467 EXPECT_FALSE(fetcher_factory_.GetFetcherByID(0)); | 467 EXPECT_FALSE(fetcher_factory_.GetFetcherByID(0)); |
| 468 } | 468 } |
| 469 | 469 |
| 470 } // namespace policy | 470 } // namespace policy |
| OLD | NEW |