| 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 "base/callback.h" | 7 #include "base/callback.h" |
| 8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
| 9 #include "base/files/scoped_temp_dir.h" | 9 #include "base/files/scoped_temp_dir.h" |
| 10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 dm_protocol::kChromeExtensionPolicyType); | 104 dm_protocol::kChromeExtensionPolicyType); |
| 105 builder_.policy_data().set_settings_entity_id(kTestExtension); | 105 builder_.policy_data().set_settings_entity_id(kTestExtension); |
| 106 builder_.payload().set_download_url(kTestDownload); | 106 builder_.payload().set_download_url(kTestDownload); |
| 107 builder_.payload().set_secure_hash(crypto::SHA256HashString(kTestPolicy)); | 107 builder_.payload().set_secure_hash(crypto::SHA256HashString(kTestPolicy)); |
| 108 | 108 |
| 109 PolicyNamespace ns(POLICY_DOMAIN_EXTENSIONS, kTestExtension); | 109 PolicyNamespace ns(POLICY_DOMAIN_EXTENSIONS, kTestExtension); |
| 110 PolicyMap& policy = expected_bundle_.Get(ns); | 110 PolicyMap& policy = expected_bundle_.Get(ns); |
| 111 policy.Set("Name", | 111 policy.Set("Name", |
| 112 POLICY_LEVEL_MANDATORY, | 112 POLICY_LEVEL_MANDATORY, |
| 113 POLICY_SCOPE_USER, | 113 POLICY_SCOPE_USER, |
| 114 POLICY_SOURCE_CLOUD, |
| 114 new base::StringValue("disabled"), | 115 new base::StringValue("disabled"), |
| 115 NULL); | 116 NULL); |
| 116 policy.Set("Second", | 117 policy.Set("Second", |
| 117 POLICY_LEVEL_RECOMMENDED, | 118 POLICY_LEVEL_RECOMMENDED, |
| 118 POLICY_SCOPE_USER, | 119 POLICY_SCOPE_USER, |
| 120 POLICY_SOURCE_CLOUD, |
| 119 new base::StringValue("maybe"), | 121 new base::StringValue("maybe"), |
| 120 NULL); | 122 NULL); |
| 121 } | 123 } |
| 122 | 124 |
| 123 void ComponentCloudPolicyUpdaterTest::TearDown() { | 125 void ComponentCloudPolicyUpdaterTest::TearDown() { |
| 124 updater_.reset(); | 126 updater_.reset(); |
| 125 task_runner_->RunUntilIdle(); | 127 task_runner_->RunUntilIdle(); |
| 126 } | 128 } |
| 127 | 129 |
| 128 scoped_ptr<em::PolicyFetchResponse> | 130 scoped_ptr<em::PolicyFetchResponse> |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 347 // Now cancel that update before the download completes. | 349 // Now cancel that update before the download completes. |
| 348 EXPECT_CALL(store_delegate_, OnComponentCloudPolicyStoreUpdated()).Times(0); | 350 EXPECT_CALL(store_delegate_, OnComponentCloudPolicyStoreUpdated()).Times(0); |
| 349 updater_->CancelUpdate( | 351 updater_->CancelUpdate( |
| 350 PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, kTestExtension)); | 352 PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, kTestExtension)); |
| 351 task_runner_->RunUntilIdle(); | 353 task_runner_->RunUntilIdle(); |
| 352 Mock::VerifyAndClearExpectations(&store_delegate_); | 354 Mock::VerifyAndClearExpectations(&store_delegate_); |
| 353 EXPECT_FALSE(fetcher_factory_.GetFetcherByID(0)); | 355 EXPECT_FALSE(fetcher_factory_.GetFetcherByID(0)); |
| 354 } | 356 } |
| 355 | 357 |
| 356 } // namespace policy | 358 } // namespace policy |
| OLD | NEW |