Chromium Code Reviews| Index: chrome/browser/extensions/extension_keybinding_apitest.cc |
| diff --git a/chrome/browser/extensions/extension_keybinding_apitest.cc b/chrome/browser/extensions/extension_keybinding_apitest.cc |
| index e62129a35f98e48000da35c48721cfd3d799e0f1..28beec5aee28b569b25c2b5aad347e41939e7423 100644 |
| --- a/chrome/browser/extensions/extension_keybinding_apitest.cc |
| +++ b/chrome/browser/extensions/extension_keybinding_apitest.cc |
| @@ -701,4 +701,33 @@ IN_PROC_BROWSER_TEST_F(CommandsApiTest, |
| EXPECT_TRUE(accelerator.IsAltDown()); |
| } |
| +IN_PROC_BROWSER_TEST_F(CommandsApiTest, ContinuePropagation) { |
| + // Setup the environment. |
| + ASSERT_TRUE(test_server()->Start()); |
| + ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
| + ASSERT_TRUE(RunExtensionTest("keybinding/continue_propagation")) << message_; |
| + ui_test_utils::NavigateToURL( |
| + browser(), test_server()->GetURL("files/extensions/test_file.txt")); |
| + |
| + ResultCatcher catcher; |
| + // Activate the shortcut (Ctrl+Shift+F). The page should capture the keydown |
|
Finnur
2014/08/29 12:17:00
s/The page/The page (as opposed to the extension)/
David Tseng
2014/08/29 17:18:46
Way too wordy now...rephrased.
|
| + // and notify the background page because |onCommands| has no event listeners |
|
Finnur
2014/08/29 12:17:00
s/onCommands/onCommand/
s/listeners/listener/
David Tseng
2014/08/29 17:18:46
Done.
|
| + // initially. |
| + ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
| + browser(), ui::VKEY_F, true, true, false, false)); |
| + ASSERT_TRUE(catcher.GetNextResult()); |
| + |
| + // Now, the extension should have added an |onCommands| event listener. |
| + // Send the same key, but the |onCommands| listener should now receive it. |
| + ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
| + browser(), ui::VKEY_F, true, true, false, false)); |
| + ASSERT_TRUE(catcher.GetNextResult()); |
| + |
| + // The extension should now have removed its |onCommands| event listener. |
| + // Finally, the page should again receive the key. |
| + ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
| + browser(), ui::VKEY_F, true, true, false, false)); |
| + ASSERT_TRUE(catcher.GetNextResult()); |
| +} |
| + |
| } // namespace extensions |