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

Side by Side Diff: chrome/browser/chromeos/arc/arc_policy_bridge_unittest.cc

Issue 2392693002: Rewrite simple uses of base::ListValue::Append(base::Value*) on CrOS. (Closed)
Patch Set: MakeUnique Created 4 years, 2 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 <memory> 5 #include <memory>
6 #include <string> 6 #include <string>
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "base/message_loop/message_loop.h" 10 #include "base/message_loop/message_loop.h"
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 policy_map().Set(policy::key::kExternalStorageDisabled, 226 policy_map().Set(policy::key::kExternalStorageDisabled,
227 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER, 227 policy::POLICY_LEVEL_MANDATORY, policy::POLICY_SCOPE_USER,
228 policy::POLICY_SOURCE_CLOUD, 228 policy::POLICY_SOURCE_CLOUD,
229 base::MakeUnique<base::FundamentalValue>(true), nullptr); 229 base::MakeUnique<base::FundamentalValue>(true), nullptr);
230 policy_bridge()->GetPolicies( 230 policy_bridge()->GetPolicies(
231 PolicyStringCallback("{\"mountPhysicalMediaDisabled\":true}")); 231 PolicyStringCallback("{\"mountPhysicalMediaDisabled\":true}"));
232 } 232 }
233 233
234 TEST_F(ArcPolicyBridgeTest, URLBlacklistTest) { 234 TEST_F(ArcPolicyBridgeTest, URLBlacklistTest) {
235 base::ListValue blacklist; 235 base::ListValue blacklist;
236 blacklist.Append(new base::StringValue("www.blacklist1.com")); 236 blacklist.AppendString("www.blacklist1.com");
237 blacklist.Append(new base::StringValue("www.blacklist2.com")); 237 blacklist.AppendString("www.blacklist2.com");
238 policy_map().Set(policy::key::kURLBlacklist, policy::POLICY_LEVEL_MANDATORY, 238 policy_map().Set(policy::key::kURLBlacklist, policy::POLICY_LEVEL_MANDATORY,
239 policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, 239 policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD,
240 blacklist.CreateDeepCopy(), nullptr); 240 blacklist.CreateDeepCopy(), nullptr);
241 policy_bridge()->GetPolicies( 241 policy_bridge()->GetPolicies(
242 PolicyStringCallback("{\"globalAppRestrictions\":" 242 PolicyStringCallback("{\"globalAppRestrictions\":"
243 "{\"com.android.browser:URLBlacklist\":" 243 "{\"com.android.browser:URLBlacklist\":"
244 "[\"www.blacklist1.com\"," 244 "[\"www.blacklist1.com\","
245 "\"www.blacklist2.com\"" 245 "\"www.blacklist2.com\""
246 "]}}")); 246 "]}}"));
247 } 247 }
248 248
249 TEST_F(ArcPolicyBridgeTest, URLWhitelistTest) { 249 TEST_F(ArcPolicyBridgeTest, URLWhitelistTest) {
250 base::ListValue whitelist; 250 base::ListValue whitelist;
251 whitelist.Append(new base::StringValue("www.whitelist1.com")); 251 whitelist.AppendString("www.whitelist1.com");
252 whitelist.Append(new base::StringValue("www.whitelist2.com")); 252 whitelist.AppendString("www.whitelist2.com");
253 policy_map().Set(policy::key::kURLWhitelist, policy::POLICY_LEVEL_MANDATORY, 253 policy_map().Set(policy::key::kURLWhitelist, policy::POLICY_LEVEL_MANDATORY,
254 policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD, 254 policy::POLICY_SCOPE_USER, policy::POLICY_SOURCE_CLOUD,
255 whitelist.CreateDeepCopy(), nullptr); 255 whitelist.CreateDeepCopy(), nullptr);
256 policy_bridge()->GetPolicies( 256 policy_bridge()->GetPolicies(
257 PolicyStringCallback("{\"globalAppRestrictions\":" 257 PolicyStringCallback("{\"globalAppRestrictions\":"
258 "{\"com.android.browser:URLWhitelist\":" 258 "{\"com.android.browser:URLWhitelist\":"
259 "[\"www.whitelist1.com\"," 259 "[\"www.whitelist1.com\","
260 "\"www.whitelist2.com\"" 260 "\"www.whitelist2.com\""
261 "]}}")); 261 "]}}"));
262 } 262 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 TEST_F(ArcPolicyBridgeTest, PolicyInstanceUnmanagedTest) { 338 TEST_F(ArcPolicyBridgeTest, PolicyInstanceUnmanagedTest) {
339 policy_bridge()->OverrideIsManagedForTesting(false); 339 policy_bridge()->OverrideIsManagedForTesting(false);
340 policy_instance()->CallGetPolicies(PolicyStringCallback("")); 340 policy_instance()->CallGetPolicies(PolicyStringCallback(""));
341 } 341 }
342 342
343 TEST_F(ArcPolicyBridgeTest, PolicyInstanceManagedTest) { 343 TEST_F(ArcPolicyBridgeTest, PolicyInstanceManagedTest) {
344 policy_instance()->CallGetPolicies(PolicyStringCallback("{}")); 344 policy_instance()->CallGetPolicies(PolicyStringCallback("{}"));
345 } 345 }
346 346
347 } // namespace arc 347 } // namespace arc
OLDNEW
« no previous file with comments | « ash/common/system/chromeos/network/tray_sms.cc ('k') | chrome/browser/chromeos/extensions/dictionary_event_router.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698