| OLD | NEW |
| 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/policy/configuration_policy_handler_chromeos.h" | 5 #include "chrome/browser/policy/configuration_policy_handler_chromeos.h" |
| 6 | 6 |
| 7 #include "chrome/browser/policy/policy_error_map.h" | 7 #include "chrome/browser/policy/policy_error_map.h" |
| 8 #include "chrome/browser/policy/policy_map.h" | 8 #include "chrome/browser/policy/policy_map.h" |
| 9 #include "chrome/browser/prefs/pref_value_map.h" | 9 #include "chrome/browser/prefs/pref_value_map.h" |
| 10 #include "chrome/browser/ui/views/ash/launcher/chrome_launcher_controller.h" | 10 #include "chrome/browser/ui/ash/chrome_launcher_prefs.h" |
| 11 #include "chrome/common/pref_names.h" | 11 #include "chrome/common/pref_names.h" |
| 12 #include "policy/policy_constants.h" | 12 #include "policy/policy_constants.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 namespace policy { | 15 namespace policy { |
| 16 | 16 |
| 17 TEST(NetworkConfigurationPolicyHandlerTest, Empty) { | 17 TEST(NetworkConfigurationPolicyHandlerTest, Empty) { |
| 18 PolicyMap policy_map; | 18 PolicyMap policy_map; |
| 19 NetworkConfigurationPolicyHandler handler( | 19 NetworkConfigurationPolicyHandler handler( |
| 20 key::kOpenNetworkConfiguration, | 20 key::kOpenNetworkConfiguration, |
| (...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 121 PinnedLauncherAppsPolicyHandler handler; | 121 PinnedLauncherAppsPolicyHandler handler; |
| 122 | 122 |
| 123 policy_map.Set(key::kPinnedLauncherApps, POLICY_LEVEL_MANDATORY, | 123 policy_map.Set(key::kPinnedLauncherApps, POLICY_LEVEL_MANDATORY, |
| 124 POLICY_SCOPE_USER, list.DeepCopy()); | 124 POLICY_SCOPE_USER, list.DeepCopy()); |
| 125 handler.ApplyPolicySettings(policy_map, &prefs); | 125 handler.ApplyPolicySettings(policy_map, &prefs); |
| 126 EXPECT_TRUE(prefs.GetValue(prefs::kPinnedLauncherApps, &value)); | 126 EXPECT_TRUE(prefs.GetValue(prefs::kPinnedLauncherApps, &value)); |
| 127 EXPECT_TRUE(base::Value::Equals(&expected_pinned_apps, value)); | 127 EXPECT_TRUE(base::Value::Equals(&expected_pinned_apps, value)); |
| 128 | 128 |
| 129 base::StringValue entry1("abcdefghijklmnopabcdefghijklmnop"); | 129 base::StringValue entry1("abcdefghijklmnopabcdefghijklmnop"); |
| 130 base::DictionaryValue* entry1_dict = new base::DictionaryValue(); | 130 base::DictionaryValue* entry1_dict = new base::DictionaryValue(); |
| 131 entry1_dict->Set(ChromeLauncherController::kPinnedAppsPrefAppIDPath, | 131 entry1_dict->Set(ash::kPinnedAppsPrefAppIDPath, entry1.DeepCopy()); |
| 132 entry1.DeepCopy()); | |
| 133 expected_pinned_apps.Append(entry1_dict); | 132 expected_pinned_apps.Append(entry1_dict); |
| 134 list.Append(entry1.DeepCopy()); | 133 list.Append(entry1.DeepCopy()); |
| 135 policy_map.Set(key::kPinnedLauncherApps, POLICY_LEVEL_MANDATORY, | 134 policy_map.Set(key::kPinnedLauncherApps, POLICY_LEVEL_MANDATORY, |
| 136 POLICY_SCOPE_USER, list.DeepCopy()); | 135 POLICY_SCOPE_USER, list.DeepCopy()); |
| 137 prefs.Clear(); | 136 prefs.Clear(); |
| 138 handler.ApplyPolicySettings(policy_map, &prefs); | 137 handler.ApplyPolicySettings(policy_map, &prefs); |
| 139 EXPECT_TRUE(prefs.GetValue(prefs::kPinnedLauncherApps, &value)); | 138 EXPECT_TRUE(prefs.GetValue(prefs::kPinnedLauncherApps, &value)); |
| 140 EXPECT_TRUE(base::Value::Equals(&expected_pinned_apps, value)); | 139 EXPECT_TRUE(base::Value::Equals(&expected_pinned_apps, value)); |
| 141 } | 140 } |
| 142 | 141 |
| 143 } // namespace policy | 142 } // namespace policy |
| OLD | NEW |