Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(53)

Side by Side Diff: chrome/browser/policy/test/local_policy_test_server.cc

Issue 2888073002: Remove raw DictionaryValue::Set in //chrome (Closed)
Patch Set: Fix Tests Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "chrome/browser/policy/test/local_policy_test_server.h" 5 #include "chrome/browser/policy/test/local_policy_test_server.h"
6 6
7 #include <ctype.h> 7 #include <ctype.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 client_dict->SetString(kClientStateKeyMachineId, std::string()); 137 client_dict->SetString(kClientStateKeyMachineId, std::string());
138 138
139 // Allow all policy types for now. 139 // Allow all policy types for now.
140 std::unique_ptr<base::ListValue> types(new base::ListValue()); 140 std::unique_ptr<base::ListValue> types(new base::ListValue());
141 types->AppendString(dm_protocol::kChromeDevicePolicyType); 141 types->AppendString(dm_protocol::kChromeDevicePolicyType);
142 types->AppendString(dm_protocol::kChromeUserPolicyType); 142 types->AppendString(dm_protocol::kChromeUserPolicyType);
143 types->AppendString(dm_protocol::kChromePublicAccountPolicyType); 143 types->AppendString(dm_protocol::kChromePublicAccountPolicyType);
144 types->AppendString(dm_protocol::kChromeExtensionPolicyType); 144 types->AppendString(dm_protocol::kChromeExtensionPolicyType);
145 types->AppendString(dm_protocol::kChromeSigninExtensionPolicyType); 145 types->AppendString(dm_protocol::kChromeSigninExtensionPolicyType);
146 146
147 client_dict->Set(kClientStateKeyAllowedPolicyTypes, types.release()); 147 client_dict->Set(kClientStateKeyAllowedPolicyTypes, std::move(types));
148 clients_.Set(dm_token, client_dict.release()); 148 clients_.Set(dm_token, std::move(client_dict));
149 } 149 }
150 150
151 bool LocalPolicyTestServer::UpdatePolicy(const std::string& type, 151 bool LocalPolicyTestServer::UpdatePolicy(const std::string& type,
152 const std::string& entity_id, 152 const std::string& entity_id,
153 const std::string& policy) { 153 const std::string& policy) {
154 base::ThreadRestrictions::ScopedAllowIO allow_io; 154 base::ThreadRestrictions::ScopedAllowIO allow_io;
155 CHECK(server_data_dir_.IsValid()); 155 CHECK(server_data_dir_.IsValid());
156 156
157 std::string selector = GetSelector(type, entity_id); 157 std::string selector = GetSelector(type, entity_id);
158 base::FilePath policy_file = server_data_dir_.GetPath().AppendASCII( 158 base::FilePath policy_file = server_data_dir_.GetPath().AppendASCII(
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 std::string LocalPolicyTestServer::GetSelector(const std::string& type, 279 std::string LocalPolicyTestServer::GetSelector(const std::string& type,
280 const std::string& entity_id) { 280 const std::string& entity_id) {
281 std::string selector = type; 281 std::string selector = type;
282 if (!entity_id.empty()) 282 if (!entity_id.empty())
283 selector = base::StringPrintf("%s/%s", type.c_str(), entity_id.c_str()); 283 selector = base::StringPrintf("%s/%s", type.c_str(), entity_id.c_str());
284 std::replace_if(selector.begin(), selector.end(), IsUnsafeCharacter, '_'); 284 std::replace_if(selector.begin(), selector.end(), IsUnsafeCharacter, '_');
285 return selector; 285 return selector;
286 } 286 }
287 287
288 } // namespace policy 288 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698