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, | |
115 new base::StringValue("disabled"), | 114 new base::StringValue("disabled"), |
116 NULL); | 115 NULL); |
117 policy.Set("Second", | 116 policy.Set("Second", |
118 POLICY_LEVEL_RECOMMENDED, | 117 POLICY_LEVEL_RECOMMENDED, |
119 POLICY_SCOPE_USER, | 118 POLICY_SCOPE_USER, |
120 POLICY_SOURCE_CLOUD, | |
121 new base::StringValue("maybe"), | 119 new base::StringValue("maybe"), |
122 NULL); | 120 NULL); |
123 } | 121 } |
124 | 122 |
125 void ComponentCloudPolicyUpdaterTest::TearDown() { | 123 void ComponentCloudPolicyUpdaterTest::TearDown() { |
126 updater_.reset(); | 124 updater_.reset(); |
127 task_runner_->RunUntilIdle(); | 125 task_runner_->RunUntilIdle(); |
128 } | 126 } |
129 | 127 |
130 scoped_ptr<em::PolicyFetchResponse> | 128 scoped_ptr<em::PolicyFetchResponse> |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
349 // Now cancel that update before the download completes. | 347 // Now cancel that update before the download completes. |
350 EXPECT_CALL(store_delegate_, OnComponentCloudPolicyStoreUpdated()).Times(0); | 348 EXPECT_CALL(store_delegate_, OnComponentCloudPolicyStoreUpdated()).Times(0); |
351 updater_->CancelUpdate( | 349 updater_->CancelUpdate( |
352 PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, kTestExtension)); | 350 PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, kTestExtension)); |
353 task_runner_->RunUntilIdle(); | 351 task_runner_->RunUntilIdle(); |
354 Mock::VerifyAndClearExpectations(&store_delegate_); | 352 Mock::VerifyAndClearExpectations(&store_delegate_); |
355 EXPECT_FALSE(fetcher_factory_.GetFetcherByID(0)); | 353 EXPECT_FALSE(fetcher_factory_.GetFetcherByID(0)); |
356 } | 354 } |
357 | 355 |
358 } // namespace policy | 356 } // namespace policy |
OLD | NEW |