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

Unified Diff: chrome/browser/policy/configuration_policy_handler_chromeos_unittest.cc

Issue 10316022: Wire up the policy for controlling pinned apps in the ash launcher. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/policy/configuration_policy_handler_chromeos_unittest.cc
diff --git a/chrome/browser/policy/configuration_policy_handler_chromeos_unittest.cc b/chrome/browser/policy/configuration_policy_handler_chromeos_unittest.cc
index 2a1bc43404c2bf261d3b718d6d0f9396f5b89053..51e8f1a2d3ec6d889133ecf6799dc2c4994ea456 100644
--- a/chrome/browser/policy/configuration_policy_handler_chromeos_unittest.cc
+++ b/chrome/browser/policy/configuration_policy_handler_chromeos_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,6 +6,9 @@
#include "chrome/browser/policy/policy_error_map.h"
#include "chrome/browser/policy/policy_map.h"
+#include "chrome/browser/prefs/pref_value_map.h"
+#include "chrome/browser/ui/views/ash/launcher/chrome_launcher_controller.h"
+#include "chrome/common/pref_names.h"
#include "policy/policy_constants.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -109,4 +112,32 @@ TEST(NetworkConfigurationPolicyHandlerTest, Sanitization) {
EXPECT_EQ(std::string::npos, sanitized_onc.find("pass"));
}
+TEST(PinnedLauncherAppsPolicyHandler, PrefTranslation) {
+ base::ListValue list;
+ PolicyMap policy_map;
+ PrefValueMap prefs;
+ base::ListValue expected_pinned_apps;
+ base::Value* value = NULL;
+ PinnedLauncherAppsPolicyHandler handler;
+
+ policy_map.Set(key::kPinnedLauncherApps, POLICY_LEVEL_MANDATORY,
+ POLICY_SCOPE_USER, list.DeepCopy());
+ handler.ApplyPolicySettings(policy_map, &prefs);
+ EXPECT_TRUE(prefs.GetValue(prefs::kPinnedLauncherApps, &value));
+ EXPECT_TRUE(base::Value::Equals(&expected_pinned_apps, value));
+
+ base::StringValue entry1("abcdefghijklmnopabcdefghijklmnop");
+ base::DictionaryValue* entry1_dict = new base::DictionaryValue();
+ entry1_dict->Set(ChromeLauncherController::kPinnedAppsPrefAppIDPath,
+ entry1.DeepCopy());
+ expected_pinned_apps.Append(entry1_dict);
+ list.Append(entry1.DeepCopy());
+ policy_map.Set(key::kPinnedLauncherApps, POLICY_LEVEL_MANDATORY,
+ POLICY_SCOPE_USER, list.DeepCopy());
+ prefs.Clear();
+ handler.ApplyPolicySettings(policy_map, &prefs);
+ EXPECT_TRUE(prefs.GetValue(prefs::kPinnedLauncherApps, &value));
+ EXPECT_TRUE(base::Value::Equals(&expected_pinned_apps, value));
+}
+
} // namespace policy

Powered by Google App Engine
This is Rietveld 408576698