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

Unified Diff: chrome/common/extensions/command_unittest.cc

Issue 12965009: Remove the limit of number of commands per extension, but keep the limit of 4 shortcuts per extensi… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/command_unittest.cc
===================================================================
--- chrome/common/extensions/command_unittest.cc (revision 190361)
+++ chrome/common/extensions/command_unittest.cc (working copy)
@@ -41,10 +41,10 @@
} kTests[] = {
// Negative test (one or more missing required fields). We don't need to
// test |command_name| being blank as it is used as a key in the manifest,
- // so it can't be blank (and we CHECK() when it is).
+ // so it can't be blank (and we CHECK() when it is). A blank shortcut is
Yoyo Zhou 2013/03/27 00:44:46 You should mention this in the CL description too.
Finnur 2013/03/27 13:00:39 Done.
+ // permitted.
{ false, none, "command", "", "" },
{ false, none, "command", "Ctrl+f", "" },
- { false, none, "command", "", "description" },
// Ctrl+Alt is not permitted, see MSDN link in comments in Parse function.
{ false, none, "command", "Ctrl+Alt+F", "description" },
// Unsupported shortcuts/too many, or missing modifier.
@@ -56,6 +56,7 @@
{ false, shift_f, "command", "Shift+F", "description" },
{ false, shift_f, "command", "F+Shift", "description" },
// Basic tests.
+ { true, none, "command", "", "description" },
{ true, ctrl_f, "command", "Ctrl+F", "description" },
{ true, alt_f, "command", "Alt+F", "description" },
{ true, ctrl_shift_f, "command", "Ctrl+Shift+F", "description" },
@@ -73,7 +74,7 @@
{ false, ctrl_f, "command", "cTrL+F", "description" },
// Skipping description is OK for browser- and pageActions.
{ true, ctrl_f, "_execute_browser_action", "Ctrl+F", "" },
- { true, ctrl_f, "_execute_page_action", "Ctrl+F", "" },
+ { true, ctrl_f, "_execute_page_action", "Ctrl+ F", "" },
Yoyo Zhou 2013/03/27 00:44:46 Is this intentional?
Finnur 2013/03/27 13:00:39 Intentional? Nope. Removed.
};
for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTests); ++i) {
@@ -101,22 +102,24 @@
}
// Now parse the command as a dictionary of multiple values.
- input.reset(new DictionaryValue);
- DictionaryValue* key_dict = new DictionaryValue();
- key_dict->SetString("default", kTests[i].key);
- key_dict->SetString("windows", kTests[i].key);
- key_dict->SetString("mac", kTests[i].key);
- input->Set("suggested_key", key_dict);
- input->SetString("description", kTests[i].description);
+ if (kTests[i].key[0] != 0) {
Yoyo Zhou 2013/03/27 00:44:46 '\0' would make it a little clearer here that it's
+ input.reset(new DictionaryValue);
+ DictionaryValue* key_dict = new DictionaryValue();
+ key_dict->SetString("default", kTests[i].key);
+ key_dict->SetString("windows", kTests[i].key);
+ key_dict->SetString("mac", kTests[i].key);
+ input->Set("suggested_key", key_dict);
+ input->SetString("description", kTests[i].description);
- result = command.Parse(input.get(), kTests[i].command_name, i, &error);
+ result = command.Parse(input.get(), kTests[i].command_name, i, &error);
- EXPECT_EQ(kTests[i].expected_result, result);
- if (result) {
- EXPECT_STREQ(kTests[i].description,
- UTF16ToASCII(command.description()).c_str());
- EXPECT_STREQ(kTests[i].command_name, command.command_name().c_str());
- EXPECT_EQ(kTests[i].accelerator, command.accelerator());
+ EXPECT_EQ(kTests[i].expected_result, result);
+ if (result) {
+ EXPECT_STREQ(kTests[i].description,
+ UTF16ToASCII(command.description()).c_str());
+ EXPECT_STREQ(kTests[i].command_name, command.command_name().c_str());
+ EXPECT_EQ(kTests[i].accelerator, command.accelerator());
+ }
}
}
}

Powered by Google App Engine
This is Rietveld 408576698