OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 bool GenerateTestArg(const std::string& test_name, | 145 bool GenerateTestArg(const std::string& test_name, |
146 const std::vector<std::string>& enabled_features, | 146 const std::vector<std::string>& enabled_features, |
147 const std::vector<std::string>& disabled_features, | 147 const std::vector<std::string>& disabled_features, |
148 std::string* result) { | 148 std::string* result) { |
149 base::DictionaryValue test_arg; | 149 base::DictionaryValue test_arg; |
150 test_arg.SetString(kTestNameKey, test_name); | 150 test_arg.SetString(kTestNameKey, test_name); |
151 | 151 |
152 std::unique_ptr<base::ListValue> enabled_list(new base::ListValue); | 152 std::unique_ptr<base::ListValue> enabled_list(new base::ListValue); |
153 for (size_t i = 0; i < enabled_features.size(); ++i) | 153 for (size_t i = 0; i < enabled_features.size(); ++i) |
154 enabled_list->AppendString(enabled_features[i]); | 154 enabled_list->AppendString(enabled_features[i]); |
155 test_arg.Set(kEnabledFeaturesKey, enabled_list.release()); | 155 test_arg.Set(kEnabledFeaturesKey, std::move(enabled_list)); |
156 | 156 |
157 std::unique_ptr<base::ListValue> disabled_list(new base::ListValue); | 157 std::unique_ptr<base::ListValue> disabled_list(new base::ListValue); |
158 for (size_t i = 0; i < disabled_features.size(); ++i) | 158 for (size_t i = 0; i < disabled_features.size(); ++i) |
159 disabled_list->AppendString(disabled_features[i]); | 159 disabled_list->AppendString(disabled_features[i]); |
160 test_arg.Set(kDisabledFeaturesKey, disabled_list.release()); | 160 test_arg.Set(kDisabledFeaturesKey, std::move(disabled_list)); |
161 | 161 |
162 return base::JSONWriter::Write(test_arg, result); | 162 return base::JSONWriter::Write(test_arg, result); |
163 } | 163 } |
164 }; | 164 }; |
165 | 165 |
166 INSTANTIATE_TEST_CASE_P(AccessibilityFeatureaApiTestInstantiatePermission, | 166 INSTANTIATE_TEST_CASE_P(AccessibilityFeatureaApiTestInstantiatePermission, |
167 AccessibilityFeaturesApiTest, | 167 AccessibilityFeaturesApiTest, |
168 testing::Bool()); | 168 testing::Bool()); |
169 | 169 |
170 // Tests that an extension with read permission can read accessibility features | 170 // Tests that an extension with read permission can read accessibility features |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 InitPrefServiceForTest(GetPrefs(), disabled_features, enabled_features)); | 269 InitPrefServiceForTest(GetPrefs(), disabled_features, enabled_features)); |
270 | 270 |
271 // Catch the second result notification sent by the test extension. | 271 // Catch the second result notification sent by the test extension. |
272 ResultCatcher result_catcher; | 272 ResultCatcher result_catcher; |
273 ASSERT_TRUE(result_catcher.GetNextResult()) << result_catcher.message(); | 273 ASSERT_TRUE(result_catcher.GetNextResult()) << result_catcher.message(); |
274 } | 274 } |
275 | 275 |
276 } // namespace | 276 } // namespace |
277 | 277 |
278 } // namespace extensions | 278 } // namespace extensions |
OLD | NEW |