Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(234)

Side by Side Diff: chrome/common/extensions/command_unittest.cc

Issue 641363003: Convert ARRAYSIZE_UNSAFE -> arraysize in chrome/, outside of chrome/browser/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698