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 "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 {false, none, "_execute_page_action", "MediaPrevTrack", ""}, | 184 {false, none, "_execute_page_action", "MediaPrevTrack", ""}, |
185 {false, none, "command", "Ctrl+Shift+MediaPrevTrack", "description"}, | 185 {false, none, "command", "Ctrl+Shift+MediaPrevTrack", "description"}, |
186 }; | 186 }; |
187 std::vector<std::string> all_platforms; | 187 std::vector<std::string> all_platforms; |
188 all_platforms.push_back("default"); | 188 all_platforms.push_back("default"); |
189 all_platforms.push_back("chromeos"); | 189 all_platforms.push_back("chromeos"); |
190 all_platforms.push_back("linux"); | 190 all_platforms.push_back("linux"); |
191 all_platforms.push_back("mac"); | 191 all_platforms.push_back("mac"); |
192 all_platforms.push_back("windows"); | 192 all_platforms.push_back("windows"); |
193 | 193 |
194 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTests); ++i) | 194 for (size_t i = 0; i < arraysize(kTests); ++i) |
195 CheckParse(kTests[i], i, false, all_platforms); | 195 CheckParse(kTests[i], i, false, all_platforms); |
196 } | 196 } |
197 | 197 |
198 TEST(CommandTest, ExtensionCommandParsingFallback) { | 198 TEST(CommandTest, ExtensionCommandParsingFallback) { |
199 std::string description = "desc"; | 199 std::string description = "desc"; |
200 std::string command_name = "foo"; | 200 std::string command_name = "foo"; |
201 | 201 |
202 // Test that platform specific keys are honored on each platform, despite | 202 // Test that platform specific keys are honored on each platform, despite |
203 // fallback being given. | 203 // fallback being given. |
204 scoped_ptr<base::DictionaryValue> input(new base::DictionaryValue); | 204 scoped_ptr<base::DictionaryValue> input(new base::DictionaryValue); |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
286 | 286 |
287 ConstCommandsTestData kChromeOsTests[] = { | 287 ConstCommandsTestData kChromeOsTests[] = { |
288 {true, search_shift_z, "command", "Search+Shift+Z", "description"}, | 288 {true, search_shift_z, "command", "Search+Shift+Z", "description"}, |
289 {true, search_a, "command", "Search+A", "description"}, | 289 {true, search_a, "command", "Search+A", "description"}, |
290 // Command is not valid on Chrome OS. | 290 // Command is not valid on Chrome OS. |
291 {false, search_shift_z, "command", "Command+Shift+Z", "description"}, | 291 {false, search_shift_z, "command", "Command+Shift+Z", "description"}, |
292 }; | 292 }; |
293 | 293 |
294 std::vector<std::string> chromeos; | 294 std::vector<std::string> chromeos; |
295 chromeos.push_back("chromeos"); | 295 chromeos.push_back("chromeos"); |
296 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kChromeOsTests); ++i) | 296 for (size_t i = 0; i < arraysize(kChromeOsTests); ++i) |
297 CheckParse(kChromeOsTests[i], i, true, chromeos); | 297 CheckParse(kChromeOsTests[i], i, true, chromeos); |
298 | 298 |
299 ConstCommandsTestData kNonChromeOsSearchTests[] = { | 299 ConstCommandsTestData kNonChromeOsSearchTests[] = { |
300 {false, search_shift_z, "command", "Search+Shift+Z", "description"}, | 300 {false, search_shift_z, "command", "Search+Shift+Z", "description"}, |
301 }; | 301 }; |
302 std::vector<std::string> non_chromeos; | 302 std::vector<std::string> non_chromeos; |
303 non_chromeos.push_back("default"); | 303 non_chromeos.push_back("default"); |
304 non_chromeos.push_back("windows"); | 304 non_chromeos.push_back("windows"); |
305 non_chromeos.push_back("mac"); | 305 non_chromeos.push_back("mac"); |
306 non_chromeos.push_back("linux"); | 306 non_chromeos.push_back("linux"); |
307 | 307 |
308 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kNonChromeOsSearchTests); ++i) | 308 for (size_t i = 0; i < arraysize(kNonChromeOsSearchTests); ++i) |
309 CheckParse(kNonChromeOsSearchTests[i], i, true, non_chromeos); | 309 CheckParse(kNonChromeOsSearchTests[i], i, true, non_chromeos); |
310 } | 310 } |
OLD | NEW |