OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "chrome/browser/chromeos/policy/cloud_external_data_manager_base_test_u
til.h" | 5 #include "chrome/browser/chromeos/policy/cloud_external_data_manager_base_test_u
til.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
| 10 #include "base/memory/ptr_util.h" |
10 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
11 #include "base/strings/string_number_conversions.h" | 12 #include "base/strings/string_number_conversions.h" |
12 #include "base/values.h" | 13 #include "base/values.h" |
13 #include "components/policy/core/common/cloud/cloud_external_data_manager.h" | 14 #include "components/policy/core/common/cloud/cloud_external_data_manager.h" |
14 #include "components/policy/core/common/cloud/cloud_policy_core.h" | 15 #include "components/policy/core/common/cloud/cloud_policy_core.h" |
15 #include "components/policy/core/common/cloud/cloud_policy_store.h" | 16 #include "components/policy/core/common/cloud/cloud_policy_store.h" |
16 #include "components/policy/core/common/external_data_fetcher.h" | 17 #include "components/policy/core/common/external_data_fetcher.h" |
17 #include "components/policy/core/common/policy_map.h" | 18 #include "components/policy/core/common/policy_map.h" |
18 #include "components/policy/core/common/policy_types.h" | 19 #include "components/policy/core/common/policy_types.h" |
19 #include "crypto/sha2.h" | 20 #include "crypto/sha2.h" |
(...skipping 19 matching lines...) Expand all Loading... |
39 hash.size())); | 40 hash.size())); |
40 return metadata; | 41 return metadata; |
41 } | 42 } |
42 | 43 |
43 void SetExternalDataReference(CloudPolicyCore* core, | 44 void SetExternalDataReference(CloudPolicyCore* core, |
44 const std::string& policy, | 45 const std::string& policy, |
45 std::unique_ptr<base::DictionaryValue> metadata) { | 46 std::unique_ptr<base::DictionaryValue> metadata) { |
46 CloudPolicyStore* store = core->store(); | 47 CloudPolicyStore* store = core->store(); |
47 ASSERT_TRUE(store); | 48 ASSERT_TRUE(store); |
48 PolicyMap policy_map; | 49 PolicyMap policy_map; |
49 policy_map.Set(policy, | 50 policy_map.Set(policy, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, |
50 POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, | 51 POLICY_SOURCE_CLOUD, std::move(metadata), |
51 metadata.release(), | 52 base::WrapUnique(new ExternalDataFetcher( |
52 new ExternalDataFetcher(store->external_data_manager(), | 53 store->external_data_manager(), policy))); |
53 policy)); | |
54 store->SetPolicyMapForTesting(policy_map); | 54 store->SetPolicyMapForTesting(policy_map); |
55 } | 55 } |
56 | 56 |
57 } // namespace test | 57 } // namespace test |
58 } // namespace policy | 58 } // namespace policy |
OLD | NEW |