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..9543abd2c56e768bbda35cbcaa9fdfbfb1a11110 100644 |
| --- a/chrome/browser/extensions/extension_keybinding_apitest.cc |
| +++ b/chrome/browser/extensions/extension_keybinding_apitest.cc |
| @@ -701,4 +701,31 @@ 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(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 |
| + // and notify the background page. |
|
Finnur
2014/08/28 11:15:38
I think it would help the casual reader to explain
David Tseng
2014/08/28 23:37:11
Done.
|
| + 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 |