OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "chrome/browser/extensions/active_tab_permission_granter.h" | 6 #include "chrome/browser/extensions/active_tab_permission_granter.h" |
7 #include "chrome/browser/extensions/api/commands/command_service.h" | 7 #include "chrome/browser/extensions/api/commands/command_service.h" |
8 #include "chrome/browser/extensions/browser_action_test_util.h" | 8 #include "chrome/browser/extensions/browser_action_test_util.h" |
9 #include "chrome/browser/extensions/extension_action.h" | 9 #include "chrome/browser/extensions/extension_action.h" |
10 #include "chrome/browser/extensions/extension_action_manager.h" | 10 #include "chrome/browser/extensions/extension_action_manager.h" |
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
724 browser(), ui::VKEY_F, true, true, false, false)); | 724 browser(), ui::VKEY_F, true, true, false, false)); |
725 ASSERT_TRUE(catcher.GetNextResult()); | 725 ASSERT_TRUE(catcher.GetNextResult()); |
726 | 726 |
727 // The extension should now have removed its |onCommand| event listener. | 727 // The extension should now have removed its |onCommand| event listener. |
728 // Finally, the page should again receive the key. | 728 // Finally, the page should again receive the key. |
729 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( | 729 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
730 browser(), ui::VKEY_F, true, true, false, false)); | 730 browser(), ui::VKEY_F, true, true, false, false)); |
731 ASSERT_TRUE(catcher.GetNextResult()); | 731 ASSERT_TRUE(catcher.GetNextResult()); |
732 } | 732 } |
733 | 733 |
| 734 // Test is only applicable on Chrome OS. |
| 735 #if defined(OS_CHROMEOS) |
| 736 IN_PROC_BROWSER_TEST_F(CommandsApiTest, ChromeOSConversions) { |
| 737 // Setup the environment. |
| 738 ASSERT_TRUE(test_server()->Start()); |
| 739 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
| 740 ASSERT_TRUE(RunExtensionTest("keybinding/chromeos_conversions")) << message_; |
| 741 ui_test_utils::NavigateToURL( |
| 742 browser(), test_server()->GetURL("files/extensions/test_file.txt")); |
| 743 |
| 744 ResultCatcher catcher; |
| 745 |
| 746 // Send all expected keys. |
| 747 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
| 748 browser(), ui::VKEY_LEFT, false, true, false, true)); |
| 749 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
| 750 browser(), ui::VKEY_UP, false, true, false, true)); |
| 751 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
| 752 browser(), ui::VKEY_RIGHT, false, true, false, true)); |
| 753 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
| 754 browser(), ui::VKEY_DOWN, false, true, false, true)); |
| 755 |
| 756 ASSERT_TRUE(catcher.GetNextResult()); |
| 757 } |
| 758 #endif // OS_CHROMEOS |
| 759 |
734 } // namespace extensions | 760 } // namespace extensions |
OLD | NEW |