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

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
« no previous file with comments | « chrome/common/extensions/command.cc ('k') | chrome/common/extensions/docs/templates/intros/commands.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
+ // 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" },
@@ -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') {
+ 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());
+ }
}
}
}
« no previous file with comments | « chrome/common/extensions/command.cc ('k') | chrome/common/extensions/docs/templates/intros/commands.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698