Index: chrome/common/extensions/api/commands/commands_manifest_unittest.cc |
diff --git a/chrome/common/extensions/api/commands/commands_manifest_unittest.cc b/chrome/common/extensions/api/commands/commands_manifest_unittest.cc |
index 3d006b25844630d499b9f95f49a3703127825b00..a0eab03ef683cadb6b608345ff1a5582b9f8fd4f 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/strings/string_util.h" |
#include "chrome/common/chrome_switches.h" |
#include "chrome/common/extensions/api/commands/commands_handler.h" |
+#include "chrome/common/extensions/features/feature_channel.h" |
#include "extensions/common/manifest_constants.h" |
#include "testing/gtest/include/gtest/gtest.h" |
@@ -93,4 +94,42 @@ TEST_F(CommandsManifestTest, BrowserActionSynthesizesCommand) { |
ASSERT_EQ(ui::VKEY_UNKNOWN, command->accelerator().key_code()); |
} |
+// This test makes sure that the "commands" feature and the "commands.global" |
+// property behave as expected on dev and stable (enabled and working on dev, |
+// not working on stable). |
+TEST_F(CommandsManifestTest, ChannelTests) { |
+ // This tests the following combinations. |
+ // Ext+Command Stable : OK. |
+ // Ext+Command+Global Stable : Property is silently ignored (expect success). |
+ // App+Command Stable : NOT OK. |
+ // App+Command+Global Stable : NOT OK. |
+ { |
+ std::string warning = "'commands' requires Google Chrome dev channel or " |
+ "newer, but this is the stable channel."; |
+ ScopedCurrentChannel channel(chrome::VersionInfo::CHANNEL_STABLE); |
+ scoped_refptr<Extension> extension1 = |
+ LoadAndExpectSuccess("command_ext.json"); |
+ scoped_refptr<Extension> extension2 = |
+ LoadAndExpectSuccess("command_ext_global.json"); |
+ LoadAndExpectWarning("command_app.json", warning); |
+ LoadAndExpectWarning("command_app_global.json", warning); |
+ } |
+ |
+ // Ext+Command Dev : OK. |
+ // App+Command Dev : OK. |
+ // Ext+Command+Global Dev : OK. |
+ // App+Command+Global Dev : OK. |
+ { |
+ ScopedCurrentChannel channel(chrome::VersionInfo::CHANNEL_DEV); |
+ scoped_refptr<Extension> extension1 = |
+ LoadAndExpectSuccess("command_ext.json"); |
+ scoped_refptr<Extension> extension2 = |
+ LoadAndExpectSuccess("command_app.json"); |
+ scoped_refptr<Extension> extension3 = |
+ LoadAndExpectSuccess("command_ext_global.json"); |
+ scoped_refptr<Extension> extension4 = |
+ LoadAndExpectSuccess("command_app_global.json"); |
+ } |
+} |
+ |
} // namespace extensions |