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

Unified Diff: chrome/browser/extensions/extension_keybinding_apitest.cc

Issue 10834106: Implement Keybinding for script badges. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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
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,34 @@
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
+// code can signal to the test that the test passed.
+// TODO(finnur): Enable this test once the bug is fixed.
+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

Powered by Google App Engine
This is Rietveld 408576698