Index: chrome/browser/extensions/extension_keybinding_apitest.cc |
=================================================================== |
--- chrome/browser/extensions/extension_keybinding_apitest.cc (revision 149159) |
+++ chrome/browser/extensions/extension_keybinding_apitest.cc (working copy) |
@@ -18,13 +18,13 @@ |
using content::WebContents; |
-class KeybindingApiTest : public ExtensionApiTest { |
+class CommandsApiTest : public ExtensionApiTest { |
public: |
- KeybindingApiTest() { |
+ CommandsApiTest() { |
CommandLine::ForCurrentProcess()->AppendSwitch( |
switches::kEnableExperimentalExtensionApis); |
} |
- virtual ~KeybindingApiTest() {} |
+ virtual ~CommandsApiTest() {} |
protected: |
BrowserActionTestUtil GetBrowserActionsBar() { |
@@ -32,6 +32,17 @@ |
} |
}; |
+class ScriptBadgesCommandsApiTest : public ExtensionApiTest { |
+ public: |
+ ScriptBadgesCommandsApiTest() { |
+ // We cannot add this to CommandsApiTest because then PageActions get |
+ // treated like BrowserActions and the PageAction test starts failing. |
+ CommandLine::ForCurrentProcess()->AppendSwitch( |
+ switches::kEnableScriptBadges); |
+ } |
+ virtual ~ScriptBadgesCommandsApiTest() {} |
+}; |
+ |
#if !defined(OS_MACOSX) |
// Test the basic functionality of the Keybinding API: |
// - That pressing the shortcut keys should perform actions (activate the |
@@ -39,7 +50,7 @@ |
// - Note: Page action keybindings are tested in PageAction test below. |
// - The shortcut keys taken by one extension are not overwritten by the last |
// installed extension. |
-IN_PROC_BROWSER_TEST_F(KeybindingApiTest, Basic) { |
+IN_PROC_BROWSER_TEST_F(CommandsApiTest, Basic) { |
ASSERT_TRUE(test_server()->Start()); |
ASSERT_TRUE(RunExtensionTest("keybinding/basics")) << message_; |
const extensions::Extension* extension = GetSingleLoadedExtension(); |
@@ -86,7 +97,7 @@ |
ASSERT_TRUE(result); |
} |
-IN_PROC_BROWSER_TEST_F(KeybindingApiTest, PageAction) { |
+IN_PROC_BROWSER_TEST_F(CommandsApiTest, PageAction) { |
ASSERT_TRUE(test_server()->Start()); |
ASSERT_TRUE(RunExtensionTest("keybinding/page_action")) << message_; |
const extensions::Extension* extension = GetSingleLoadedExtension(); |
@@ -125,4 +136,33 @@ |
ASSERT_TRUE(result); |
} |
+// Checked-in in a disabled state, because the necessary functionality to |
+// automatically verify that the test works hasn't been implemented for the |
+// script badges yet (see http://crbug.com/140016). The test results, can be |
+// verified manually by running the test and verifying that the synthesized |
+// popup for script badges appear. When bug 140016 has been fixed, the popup |
Yoyo Zhou
2012/08/02 09:59:29
This seems obvious, but it's still good bookkeepin
|
+// code can signal to the test that the test passed. |
+IN_PROC_BROWSER_TEST_F(ScriptBadgesCommandsApiTest, ScriptBadge_DISABLED) { |
+ ASSERT_TRUE(test_server()->Start()); |
+ ASSERT_TRUE(RunExtensionTest("keybinding/script_badge")) << message_; |
+ const extensions::Extension* extension = GetSingleLoadedExtension(); |
+ ASSERT_TRUE(extension) << message_; |
+ |
+ { |
+ ResultCatcher catcher; |
+ // Tell the extension to update the script badge state. |
+ ui_test_utils::NavigateToURL( |
+ browser(), GURL(extension->GetResourceURL("show.html"))); |
+ ASSERT_TRUE(catcher.GetNextResult()); |
+ } |
+ |
+ { |
+ ResultCatcher catcher; |
+ // Activate the shortcut (Ctrl+Shift+F). |
+ ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
+ browser(), ui::VKEY_F, true, true, false, false)); |
+ ASSERT_TRUE(catcher.GetNextResult()); |
+ } |
+} |
+ |
#endif // !OS_MACOSX |