summaryrefslogtreecommitdiffstats
path: root/chrome/common/extensions/extension_unittest.cc
diff options
context:
space:
mode:
authorfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-27 09:57:35 +0000
committerfinnur@chromium.org <finnur@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-06-27 09:57:35 +0000
commitaa84e2ff2c1804e116fb4dfa5e729316e2fdfe4a (patch)
tree17f82ed149adff587d1ac46cb366a3a6a2dcb932 /chrome/common/extensions/extension_unittest.cc
parent49c8c9059b22c3bbd7af25d3a7d09f9c24a97888 (diff)
downloadchromium_src-aa84e2ff2c1804e116fb4dfa5e729316e2fdfe4a.zip
chromium_src-aa84e2ff2c1804e116fb4dfa5e729316e2fdfe4a.tar.gz
chromium_src-aa84e2ff2c1804e116fb4dfa5e729316e2fdfe4a.tar.bz2
Make sure all browser actions can be assigned a shortcut by synthesizing a generic command (with no keyboard shortcut assigned) when a browser action doesn't include one in its manifest.
BUG=134131 TEST=Install an extension that specifies a browser action but no command and make sure it is configurable. Review URL: https://chromiumcodereview.appspot.com/10639018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@144430 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/extensions/extension_unittest.cc')
-rw-r--r--chrome/common/extensions/extension_unittest.cc13
1 files changed, 13 insertions, 0 deletions
diff --git a/chrome/common/extensions/extension_unittest.cc b/chrome/common/extensions/extension_unittest.cc
index 6c12d19..8e7413e 100644
--- a/chrome/common/extensions/extension_unittest.cc
+++ b/chrome/common/extensions/extension_unittest.cc
@@ -13,6 +13,7 @@
#include "base/string_number_conversions.h"
#include "base/utf_string_conversions.h"
#include "chrome/common/chrome_paths.h"
+#include "chrome/common/extensions/command.h"
#include "chrome/common/extensions/extension_action.h"
#include "chrome/common/extensions/extension_error_utils.h"
#include "chrome/common/extensions/extension_file_util.h"
@@ -686,6 +687,18 @@ TEST(ExtensionTest, ExtraFlags) {
EXPECT_FALSE(extension->from_webstore());
}
+TEST(ExtensionTest, BrowserActionSynthesizesCommand) {
+ scoped_refptr<Extension> extension;
+
+ extension = LoadManifest("api_test/browser_action/synthesized",
+ "manifest.json");
+ // An extension with a browser action but no extension command specified
+ // should get a command assigned to it.
+ const extensions::Command* command = extension->browser_action_command();
+ ASSERT_TRUE(command != NULL);
+ ASSERT_EQ(ui::VKEY_UNKNOWN, command->accelerator().key_code());
+}
+
// Base class for testing the CanExecuteScriptOnPage and CanCaptureVisiblePage
// methods of Extension for extensions with various permissions.
class ExtensionScriptAndCaptureVisibleTest : public testing::Test {