| 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
| (...skipping 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 ui::VKEY_T, false, false, false, true, | 700 ui::VKEY_T, false, false, false, true, |
| 701 true, false, false, false, 1, | 701 true, false, false, false, 1, |
| 702 { "D 91 0 false false false true" } | 702 { "D 91 0 false false false true" } |
| 703 #else | 703 #else |
| 704 ui::VKEY_T, true, false, false, false, | 704 ui::VKEY_T, true, false, false, false, |
| 705 true, false, false, false, 1, | 705 true, false, false, false, 1, |
| 706 { "D 17 0 true false false false" } | 706 { "D 17 0 true false false false" } |
| 707 #endif | 707 #endif |
| 708 }; | 708 }; |
| 709 | 709 |
| 710 ui_test_utils::WindowedNotificationObserver wait_for_new_tab( | 710 content::WindowedNotificationObserver wait_for_new_tab( |
| 711 chrome::NOTIFICATION_TAB_PARENTED, | 711 chrome::NOTIFICATION_TAB_PARENTED, |
| 712 content::NotificationService::AllSources()); | 712 content::NotificationService::AllSources()); |
| 713 | 713 |
| 714 // Press Ctrl/Cmd+T, which will open a new tab. It cannot be suppressed. | 714 // Press Ctrl/Cmd+T, which will open a new tab. It cannot be suppressed. |
| 715 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(0, kTestCtrlOrCmdT)); | 715 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(0, kTestCtrlOrCmdT)); |
| 716 wait_for_new_tab.Wait(); | 716 wait_for_new_tab.Wait(); |
| 717 | 717 |
| 718 int result_length; | 718 int result_length; |
| 719 ASSERT_NO_FATAL_FAILURE(GetResultLength(0, &result_length)); | 719 ASSERT_NO_FATAL_FAILURE(GetResultLength(0, &result_length)); |
| 720 EXPECT_EQ(1, result_length); | 720 EXPECT_EQ(1, result_length); |
| 721 | 721 |
| 722 EXPECT_EQ(2, browser()->tab_count()); | 722 EXPECT_EQ(2, browser()->tab_count()); |
| 723 ASSERT_EQ(1, browser()->active_index()); | 723 ASSERT_EQ(1, browser()->active_index()); |
| 724 | 724 |
| 725 // Because of issue <http://crbug.com/65375>, switching back to the first tab | 725 // Because of issue <http://crbug.com/65375>, switching back to the first tab |
| 726 // may cause the focus to be grabbed by omnibox. So instead, we load our | 726 // may cause the focus to be grabbed by omnibox. So instead, we load our |
| 727 // testing page in the newly created tab and try Cmd-W here. | 727 // testing page in the newly created tab and try Cmd-W here. |
| 728 ui_test_utils::NavigateToURL(browser(), url); | 728 ui_test_utils::NavigateToURL(browser(), url); |
| 729 | 729 |
| 730 // Make sure the focus is in the testing page. | 730 // Make sure the focus is in the testing page. |
| 731 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); | 731 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); |
| 732 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); | 732 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); |
| 733 | 733 |
| 734 // Reserved accelerators can't be suppressed. | 734 // Reserved accelerators can't be suppressed. |
| 735 ASSERT_NO_FATAL_FAILURE(SuppressAllEvents(1, true)); | 735 ASSERT_NO_FATAL_FAILURE(SuppressAllEvents(1, true)); |
| 736 | 736 |
| 737 ui_test_utils::WindowedNotificationObserver wait_for_tab_closed( | 737 content::WindowedNotificationObserver wait_for_tab_closed( |
| 738 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, | 738 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
| 739 content::Source<content::WebContents>(chrome::GetWebContentsAt(browser(),
1))); | 739 content::Source<content::WebContents>(chrome::GetWebContentsAt(browser(),
1))); |
| 740 | 740 |
| 741 // Press Ctrl/Cmd+W, which will close the tab. | 741 // Press Ctrl/Cmd+W, which will close the tab. |
| 742 #if defined(OS_MACOSX) | 742 #if defined(OS_MACOSX) |
| 743 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( | 743 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
| 744 browser(), ui::VKEY_W, false, false, false, true)); | 744 browser(), ui::VKEY_W, false, false, false, true)); |
| 745 #else | 745 #else |
| 746 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( | 746 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
| 747 browser(), ui::VKEY_W, true, false, false, false)); | 747 browser(), ui::VKEY_W, true, false, false, false)); |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 881 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAltKeySuppress)); | 881 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAltKeySuppress)); |
| 882 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); | 882 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); |
| 883 | 883 |
| 884 // Ctrl+Alt should have no effect. | 884 // Ctrl+Alt should have no effect. |
| 885 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlAltKey)); | 885 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlAltKey)); |
| 886 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); | 886 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); |
| 887 } | 887 } |
| 888 #endif | 888 #endif |
| 889 | 889 |
| 890 } // namespace | 890 } // namespace |
| OLD | NEW |