OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <cstring> | 5 #include <cstring> |
6 #include <string> | 6 #include <string> |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 EXPECT_FALSE(details->is_deprecated); | 166 EXPECT_FALSE(details->is_deprecated); |
167 EXPECT_TRUE(details->is_device_policy); | 167 EXPECT_TRUE(details->is_device_policy); |
168 EXPECT_EQ(90, details->id); | 168 EXPECT_EQ(90, details->id); |
169 EXPECT_EQ(0u, details->max_external_data_size); | 169 EXPECT_EQ(0u, details->max_external_data_size); |
170 #endif | 170 #endif |
171 | 171 |
172 // TODO(bartfab): add a test that verifies a max_external_data_size larger | 172 // TODO(bartfab): add a test that verifies a max_external_data_size larger |
173 // than 0, once a type 'external' policy is added. | 173 // than 0, once a type 'external' policy is added. |
174 } | 174 } |
175 | 175 |
| 176 #if defined(OS_CHROMEOS) |
| 177 TEST(GeneratePolicySource, SetEnterpriseDefaults) { |
| 178 PolicyMap policy_map; |
| 179 |
| 180 // If policy not configured yet, set the enterprise default. |
| 181 SetEnterpriseUsersDefaults(&policy_map); |
| 182 |
| 183 const base::Value* multiprof_behavior = |
| 184 policy_map.GetValue(key::kChromeOsMultiProfileUserBehavior); |
| 185 base::StringValue expected("primary-only"); |
| 186 EXPECT_TRUE(expected.Equals(multiprof_behavior)); |
| 187 |
| 188 // If policy already configured, it's not changed to enterprise defaults. |
| 189 policy_map.Set(key::kChromeOsMultiProfileUserBehavior, |
| 190 POLICY_LEVEL_MANDATORY, |
| 191 POLICY_SCOPE_USER, |
| 192 new base::StringValue("test_value"), |
| 193 NULL); |
| 194 SetEnterpriseUsersDefaults(&policy_map); |
| 195 multiprof_behavior = |
| 196 policy_map.GetValue(key::kChromeOsMultiProfileUserBehavior); |
| 197 expected = base::StringValue("test_value"); |
| 198 EXPECT_TRUE(expected.Equals(multiprof_behavior)); |
| 199 } |
| 200 #endif |
| 201 |
176 } // namespace policy | 202 } // namespace policy |
OLD | NEW |