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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 ASSERT_EQ(store_->policy().end(), store_->policy().begin()); | 101 ASSERT_EQ(store_->policy().end(), store_->policy().begin()); |
102 | 102 |
103 builder_.policy_data().set_policy_type( | 103 builder_.policy_data().set_policy_type( |
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", POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, | 111 policy.Set("Name", |
112 base::Value::CreateStringValue("disabled"), NULL); | 112 POLICY_LEVEL_MANDATORY, |
113 policy.Set("Second", POLICY_LEVEL_RECOMMENDED, POLICY_SCOPE_USER, | 113 POLICY_SCOPE_USER, |
114 base::Value::CreateStringValue("maybe"), NULL); | 114 new base::StringValue("disabled"), |
| 115 NULL); |
| 116 policy.Set("Second", |
| 117 POLICY_LEVEL_RECOMMENDED, |
| 118 POLICY_SCOPE_USER, |
| 119 new base::StringValue("maybe"), |
| 120 NULL); |
115 } | 121 } |
116 | 122 |
117 void ComponentCloudPolicyUpdaterTest::TearDown() { | 123 void ComponentCloudPolicyUpdaterTest::TearDown() { |
118 updater_.reset(); | 124 updater_.reset(); |
119 task_runner_->RunUntilIdle(); | 125 task_runner_->RunUntilIdle(); |
120 } | 126 } |
121 | 127 |
122 scoped_ptr<em::PolicyFetchResponse> | 128 scoped_ptr<em::PolicyFetchResponse> |
123 ComponentCloudPolicyUpdaterTest::CreateResponse() { | 129 ComponentCloudPolicyUpdaterTest::CreateResponse() { |
124 builder_.Build(); | 130 builder_.Build(); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 // Now cancel that update before the download completes. | 347 // Now cancel that update before the download completes. |
342 EXPECT_CALL(store_delegate_, OnComponentCloudPolicyStoreUpdated()).Times(0); | 348 EXPECT_CALL(store_delegate_, OnComponentCloudPolicyStoreUpdated()).Times(0); |
343 updater_->CancelUpdate( | 349 updater_->CancelUpdate( |
344 PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, kTestExtension)); | 350 PolicyNamespace(POLICY_DOMAIN_EXTENSIONS, kTestExtension)); |
345 task_runner_->RunUntilIdle(); | 351 task_runner_->RunUntilIdle(); |
346 Mock::VerifyAndClearExpectations(&store_delegate_); | 352 Mock::VerifyAndClearExpectations(&store_delegate_); |
347 EXPECT_FALSE(fetcher_factory_.GetFetcherByID(0)); | 353 EXPECT_FALSE(fetcher_factory_.GetFetcherByID(0)); |
348 } | 354 } |
349 | 355 |
350 } // namespace policy | 356 } // namespace policy |
OLD | NEW |