OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "components/policy/core/common/preg_parser.h" | 5 #include "components/policy/core/common/preg_parser.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 void SetInteger(RegistryDict* dict, | 60 void SetInteger(RegistryDict* dict, |
61 const std::string& name, | 61 const std::string& name, |
62 int value) { | 62 int value) { |
63 dict->SetValue(name, base::WrapUnique<base::Value>(new base::Value(value))); | 63 dict->SetValue(name, base::WrapUnique<base::Value>(new base::Value(value))); |
64 } | 64 } |
65 | 65 |
66 void SetString(RegistryDict* dict, | 66 void SetString(RegistryDict* dict, |
67 const std::string& name, | 67 const std::string& name, |
68 const std::string& value) { | 68 const std::string& value) { |
69 dict->SetValue(name, | 69 dict->SetValue(name, base::WrapUnique<base::Value>(new base::Value(value))); |
70 base::WrapUnique<base::Value>(new base::StringValue(value))); | |
71 } | 70 } |
72 | 71 |
73 TEST(PRegParserTest, TestParseFile) { | 72 TEST(PRegParserTest, TestParseFile) { |
74 base::FilePath test_data_dir; | 73 base::FilePath test_data_dir; |
75 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &test_data_dir)); | 74 ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &test_data_dir)); |
76 | 75 |
77 // Prepare the test dictionary with some data so the test can check that the | 76 // Prepare the test dictionary with some data so the test can check that the |
78 // PReg action triggers work, i.e. remove these items. | 77 // PReg action triggers work, i.e. remove these items. |
79 RegistryDict dict; | 78 RegistryDict dict; |
80 SetInteger(&dict, "DeleteValuesTest1", 1); | 79 SetInteger(&dict, "DeleteValuesTest1", 1); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 SetInteger(&expected, "ShowHomeButton", 1); | 112 SetInteger(&expected, "ShowHomeButton", 1); |
114 SetString(&expected, "Snowman", "\xE2\x98\x83"); | 113 SetString(&expected, "Snowman", "\xE2\x98\x83"); |
115 SetString(&expected, "Empty", ""); | 114 SetString(&expected, "Empty", ""); |
116 | 115 |
117 EXPECT_TRUE(RegistryDictEquals(dict, expected)); | 116 EXPECT_TRUE(RegistryDictEquals(dict, expected)); |
118 } | 117 } |
119 | 118 |
120 } // namespace | 119 } // namespace |
121 } // namespace preg_parser | 120 } // namespace preg_parser |
122 } // namespace policy | 121 } // namespace policy |
OLD | NEW |