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

Side by Side Diff: chrome/browser/chromeos/policy/configuration_policy_handler_chromeos_unittest.cc

Issue 608283003: Remove retail mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/configuration_policy_handler_chromeos.h " 5 #include "chrome/browser/chromeos/policy/configuration_policy_handler_chromeos.h "
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/json/json_reader.h" 8 #include "base/json/json_reader.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/prefs/pref_value_map.h" 10 #include "base/prefs/pref_value_map.h"
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 handler->PrepareForDisplaying(&policy_map); 314 handler->PrepareForDisplaying(&policy_map);
315 const base::Value* sanitized = 315 const base::Value* sanitized =
316 policy_map.GetValue(key::kOpenNetworkConfiguration); 316 policy_map.GetValue(key::kOpenNetworkConfiguration);
317 ASSERT_TRUE(sanitized); 317 ASSERT_TRUE(sanitized);
318 std::string sanitized_onc; 318 std::string sanitized_onc;
319 EXPECT_TRUE(sanitized->GetAsString(&sanitized_onc)); 319 EXPECT_TRUE(sanitized->GetAsString(&sanitized_onc));
320 EXPECT_FALSE(sanitized_onc.empty()); 320 EXPECT_FALSE(sanitized_onc.empty());
321 EXPECT_EQ(std::string::npos, sanitized_onc.find("pass")); 321 EXPECT_EQ(std::string::npos, sanitized_onc.find("pass"));
322 } 322 }
323 323
324 TEST(PinnedLauncherAppsPolicyHandler, PrefTranslation) {
325 base::ListValue list;
326 PolicyMap policy_map;
327 PrefValueMap prefs;
328 base::ListValue expected_pinned_apps;
329 base::Value* value = NULL;
330 PinnedLauncherAppsPolicyHandler handler;
331
332 policy_map.Set(key::kPinnedLauncherApps, POLICY_LEVEL_MANDATORY,
333 POLICY_SCOPE_USER, list.DeepCopy(), NULL);
334 handler.ApplyPolicySettings(policy_map, &prefs);
335 EXPECT_TRUE(prefs.GetValue(prefs::kPinnedLauncherApps, &value));
336 EXPECT_TRUE(base::Value::Equals(&expected_pinned_apps, value));
337
338 base::StringValue entry1("abcdefghijklmnopabcdefghijklmnop");
339 base::DictionaryValue* entry1_dict = new base::DictionaryValue();
340 entry1_dict->Set(ash::kPinnedAppsPrefAppIDPath, entry1.DeepCopy());
341 expected_pinned_apps.Append(entry1_dict);
342 list.Append(entry1.DeepCopy());
343 policy_map.Set(key::kPinnedLauncherApps, POLICY_LEVEL_MANDATORY,
344 POLICY_SCOPE_USER, list.DeepCopy(), NULL);
345 prefs.Clear();
346 handler.ApplyPolicySettings(policy_map, &prefs);
347 EXPECT_TRUE(prefs.GetValue(prefs::kPinnedLauncherApps, &value));
348 EXPECT_TRUE(base::Value::Equals(&expected_pinned_apps, value));
349 }
350
351 TEST_F(LoginScreenPowerManagementPolicyHandlerTest, Empty) { 324 TEST_F(LoginScreenPowerManagementPolicyHandlerTest, Empty) {
352 PolicyMap policy_map; 325 PolicyMap policy_map;
353 LoginScreenPowerManagementPolicyHandler handler(chrome_schema_); 326 LoginScreenPowerManagementPolicyHandler handler(chrome_schema_);
354 PolicyErrorMap errors; 327 PolicyErrorMap errors;
355 EXPECT_TRUE(handler.CheckPolicySettings(policy_map, &errors)); 328 EXPECT_TRUE(handler.CheckPolicySettings(policy_map, &errors));
356 EXPECT_TRUE(errors.GetErrors(key::kDeviceLoginScreenPowerManagement).empty()); 329 EXPECT_TRUE(errors.GetErrors(key::kDeviceLoginScreenPowerManagement).empty());
357 } 330 }
358 331
359 TEST_F(LoginScreenPowerManagementPolicyHandlerTest, ValidPolicy) { 332 TEST_F(LoginScreenPowerManagementPolicyHandlerTest, ValidPolicy) {
360 PolicyMap policy_map; 333 PolicyMap policy_map;
(...skipping 16 matching lines...) Expand all
377 new base::FundamentalValue(false), 350 new base::FundamentalValue(false),
378 NULL); 351 NULL);
379 LoginScreenPowerManagementPolicyHandler handler(chrome_schema_); 352 LoginScreenPowerManagementPolicyHandler handler(chrome_schema_);
380 PolicyErrorMap errors; 353 PolicyErrorMap errors;
381 EXPECT_FALSE(handler.CheckPolicySettings(policy_map, &errors)); 354 EXPECT_FALSE(handler.CheckPolicySettings(policy_map, &errors));
382 EXPECT_FALSE( 355 EXPECT_FALSE(
383 errors.GetErrors(key::kDeviceLoginScreenPowerManagement).empty()); 356 errors.GetErrors(key::kDeviceLoginScreenPowerManagement).empty());
384 } 357 }
385 358
386 } // namespace policy 359 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698