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/common/extensions/command.h" | 5 #include "chrome/common/extensions/command.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <memory> | 9 #include <memory> |
10 | 10 |
(...skipping 14 matching lines...) Expand all Loading... |
25 const char* command_name; | 25 const char* command_name; |
26 const char* key; | 26 const char* key; |
27 const char* description; | 27 const char* description; |
28 } ConstCommandsTestData; | 28 } ConstCommandsTestData; |
29 | 29 |
30 // Checks the |suggested_key| value parses into a command when specified as a | 30 // Checks the |suggested_key| value parses into a command when specified as a |
31 // string or dictionary of platform specific keys. If | 31 // string or dictionary of platform specific keys. If |
32 // |platform_specific_only| is true, only the latter is tested. |platforms| | 32 // |platform_specific_only| is true, only the latter is tested. |platforms| |
33 // specifies all platforms to use when populating the |suggested_key| | 33 // specifies all platforms to use when populating the |suggested_key| |
34 // dictionary. | 34 // dictionary. |
35 void CheckParse(ConstCommandsTestData data, | 35 void CheckParse(const ConstCommandsTestData& data, |
36 int i, | 36 int i, |
37 bool platform_specific_only, | 37 bool platform_specific_only, |
38 std::vector<std::string>& platforms) { | 38 std::vector<std::string>& platforms) { |
39 SCOPED_TRACE(std::string("Command name: |") + data.command_name + "| key: |" + | 39 SCOPED_TRACE(std::string("Command name: |") + data.command_name + "| key: |" + |
40 data.key + "| description: |" + data.description + "| index: " + | 40 data.key + "| description: |" + data.description + "| index: " + |
41 base::IntToString(i)); | 41 base::IntToString(i)); |
42 | 42 |
43 extensions::Command command; | 43 extensions::Command command; |
44 std::unique_ptr<base::DictionaryValue> input(new base::DictionaryValue); | 44 std::unique_ptr<base::DictionaryValue> input(new base::DictionaryValue); |
45 base::string16 error; | 45 base::string16 error; |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 }; | 306 }; |
307 std::vector<std::string> non_chromeos; | 307 std::vector<std::string> non_chromeos; |
308 non_chromeos.push_back("default"); | 308 non_chromeos.push_back("default"); |
309 non_chromeos.push_back("windows"); | 309 non_chromeos.push_back("windows"); |
310 non_chromeos.push_back("mac"); | 310 non_chromeos.push_back("mac"); |
311 non_chromeos.push_back("linux"); | 311 non_chromeos.push_back("linux"); |
312 | 312 |
313 for (size_t i = 0; i < arraysize(kNonChromeOsSearchTests); ++i) | 313 for (size_t i = 0; i < arraysize(kNonChromeOsSearchTests); ++i) |
314 CheckParse(kNonChromeOsSearchTests[i], i, true, non_chromeos); | 314 CheckParse(kNonChromeOsSearchTests[i], i, true, non_chromeos); |
315 } | 315 } |
OLD | NEW |