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 "base/callback.h" | 5 #include "base/callback.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "base/prefs/pref_value_map.h" | 7 #include "base/prefs/pref_value_map.h" |
8 #include "chrome/browser/policy/configuration_policy_handler.h" | 8 #include "components/policy/core/browser/configuration_policy_handler.h" |
9 #include "components/policy/core/browser/policy_error_map.h" | 9 #include "components/policy/core/browser/policy_error_map.h" |
10 #include "components/policy/core/common/policy_map.h" | 10 #include "components/policy/core/common/policy_map.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
| 13 // Note: this file should move to components/policy/core/browser, but the |
| 14 // components_unittests runner does not load the ResourceBundle as |
| 15 // ChromeTestSuite::Initialize does, which leads to failures using |
| 16 // PolicyErrorMap. |
| 17 |
13 namespace policy { | 18 namespace policy { |
14 | 19 |
15 namespace { | 20 namespace { |
16 | 21 |
17 StringToIntEnumListPolicyHandler::MappingEntry kTestTypeMap[] = { | 22 StringToIntEnumListPolicyHandler::MappingEntry kTestTypeMap[] = { |
18 { "one", 1 }, | 23 { "one", 1 }, |
19 { "two", 2 }, | 24 { "two", 2 }, |
20 }; | 25 }; |
21 | 26 |
22 const char kTestPolicy[] = "unit_test.test_policy"; | 27 const char kTestPolicy[] = "unit_test.test_policy"; |
(...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 policy_map.Set(kTestPolicy, POLICY_LEVEL_MANDATORY, | 482 policy_map.Set(kTestPolicy, POLICY_LEVEL_MANDATORY, |
478 POLICY_SCOPE_USER, base::Value::CreateIntegerValue(10), NULL); | 483 POLICY_SCOPE_USER, base::Value::CreateIntegerValue(10), NULL); |
479 prefs.Clear(); | 484 prefs.Clear(); |
480 handler.ApplyPolicySettings(policy_map, &prefs); | 485 handler.ApplyPolicySettings(policy_map, &prefs); |
481 expected.reset(base::Value::CreateDoubleValue(0.1)); | 486 expected.reset(base::Value::CreateDoubleValue(0.1)); |
482 EXPECT_TRUE(prefs.GetValue(kTestPref, &value)); | 487 EXPECT_TRUE(prefs.GetValue(kTestPref, &value)); |
483 EXPECT_TRUE(base::Value::Equals(expected.get(), value)); | 488 EXPECT_TRUE(base::Value::Equals(expected.get(), value)); |
484 } | 489 } |
485 | 490 |
486 } // namespace policy | 491 } // namespace policy |
OLD | NEW |