OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/user_policy_test_helper.h" | 5 #include "chrome/browser/chromeos/policy/user_policy_test_helper.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "url/gurl.h" | 30 #include "url/gurl.h" |
31 | 31 |
32 namespace policy { | 32 namespace policy { |
33 | 33 |
34 namespace { | 34 namespace { |
35 | 35 |
36 std::string BuildPolicy(const base::DictionaryValue& mandatory, | 36 std::string BuildPolicy(const base::DictionaryValue& mandatory, |
37 const base::DictionaryValue& recommended, | 37 const base::DictionaryValue& recommended, |
38 const std::string& policyType, | 38 const std::string& policyType, |
39 const std::string& account_id) { | 39 const std::string& account_id) { |
40 scoped_ptr<base::DictionaryValue> policy_type_dict(new base::DictionaryValue); | 40 std::unique_ptr<base::DictionaryValue> policy_type_dict( |
| 41 new base::DictionaryValue); |
41 policy_type_dict->SetWithoutPathExpansion("mandatory", | 42 policy_type_dict->SetWithoutPathExpansion("mandatory", |
42 mandatory.CreateDeepCopy()); | 43 mandatory.CreateDeepCopy()); |
43 policy_type_dict->SetWithoutPathExpansion("recommended", | 44 policy_type_dict->SetWithoutPathExpansion("recommended", |
44 recommended.CreateDeepCopy()); | 45 recommended.CreateDeepCopy()); |
45 | 46 |
46 scoped_ptr<base::ListValue> managed_users_list(new base::ListValue); | 47 std::unique_ptr<base::ListValue> managed_users_list(new base::ListValue); |
47 managed_users_list->AppendString("*"); | 48 managed_users_list->AppendString("*"); |
48 | 49 |
49 base::DictionaryValue root_dict; | 50 base::DictionaryValue root_dict; |
50 root_dict.SetWithoutPathExpansion(policyType, std::move(policy_type_dict)); | 51 root_dict.SetWithoutPathExpansion(policyType, std::move(policy_type_dict)); |
51 root_dict.SetWithoutPathExpansion("managed_users", | 52 root_dict.SetWithoutPathExpansion("managed_users", |
52 std::move(managed_users_list)); | 53 std::move(managed_users_list)); |
53 root_dict.SetStringWithoutPathExpansion("policy_user", account_id); | 54 root_dict.SetStringWithoutPathExpansion("policy_user", account_id); |
54 root_dict.SetIntegerWithoutPathExpansion("current_key_index", 0); | 55 root_dict.SetIntegerWithoutPathExpansion("current_key_index", 0); |
55 | 56 |
56 std::string json_policy; | 57 std::string json_policy; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 const int bytes_written = | 141 const int bytes_written = |
141 base::WriteFile(PolicyFilePath(), policy.data(), policy.size()); | 142 base::WriteFile(PolicyFilePath(), policy.data(), policy.size()); |
142 ASSERT_EQ(static_cast<int>(policy.size()), bytes_written); | 143 ASSERT_EQ(static_cast<int>(policy.size()), bytes_written); |
143 } | 144 } |
144 | 145 |
145 base::FilePath UserPolicyTestHelper::PolicyFilePath() const { | 146 base::FilePath UserPolicyTestHelper::PolicyFilePath() const { |
146 return temp_dir_.path().AppendASCII("policy.json"); | 147 return temp_dir_.path().AppendASCII("policy.json"); |
147 } | 148 } |
148 | 149 |
149 } // namespace policy | 150 } // namespace policy |
OLD | NEW |