diff options
author | yoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-04 09:04:37 +0000 |
---|---|---|
committer | yoz@chromium.org <yoz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-04 09:04:37 +0000 |
commit | e676f8f0050863331707210c9457162e03563ce3 (patch) | |
tree | 604fb9098821831debfe19c5044c2f19106e53c6 /chrome/common/extensions/api/commands/commands_manifest_unittest.cc | |
parent | 56b7e39f89c80273f23b4a0fe5aaa14431d16745 (diff) | |
download | chromium_src-e676f8f0050863331707210c9457162e03563ce3.zip chromium_src-e676f8f0050863331707210c9457162e03563ce3.tar.gz chromium_src-e676f8f0050863331707210c9457162e03563ce3.tar.bz2 |
Refactor APIPermission to separate out specific permission registration.
Adds a delegate to the PermissionsInfo global to do the specific registration; adds a ScopedTestingPermissionsInfo for unit tests.
Preparation for moving permissions to top-level extensions.
Also adds a base class for unittests, ExtensionTest, to deal with manifest handler / permission setup.
BUG=162530,172712
Review URL: https://chromiumcodereview.appspot.com/13370002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@192252 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/api/commands/commands_manifest_unittest.cc')
-rw-r--r-- | chrome/common/extensions/api/commands/commands_manifest_unittest.cc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/chrome/common/extensions/api/commands/commands_manifest_unittest.cc b/chrome/common/extensions/api/commands/commands_manifest_unittest.cc index f6eb432..c642ebc 100644 --- a/chrome/common/extensions/api/commands/commands_manifest_unittest.cc +++ b/chrome/common/extensions/api/commands/commands_manifest_unittest.cc @@ -8,6 +8,7 @@ #include "base/string_util.h" #include "chrome/common/chrome_switches.h" #include "chrome/common/extensions/api/commands/commands_handler.h" +#include "chrome/common/extensions/api/extension_action/browser_action_handler.h" #include "testing/gtest/include/gtest/gtest.h" namespace errors = extension_manifest_errors; @@ -84,4 +85,16 @@ TEST_F(CommandsManifestTest, CommandManifestRejectJustShift) { errors::kInvalidKeyBinding); } +TEST_F(CommandsManifestTest, BrowserActionSynthesizesCommand) { + (new BrowserActionHandler)->Register(); + scoped_refptr<Extension> extension = + LoadAndExpectSuccess("browser_action_synthesizes_command.json"); + // An extension with a browser action but no extension command specified + // should get a command assigned to it. + const extensions::Command* command = + CommandsInfo::GetBrowserActionCommand(extension); + ASSERT_TRUE(command != NULL); + ASSERT_EQ(ui::VKEY_UNKNOWN, command->accelerator().key_code()); +} + } // namespace extensions |