| 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 669 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 680 true, false, false, false, 1, | 680 true, false, false, false, 1, |
| 681 { "D 91 0 false false false true" } | 681 { "D 91 0 false false false true" } |
| 682 #else | 682 #else |
| 683 ui::VKEY_T, true, false, false, false, | 683 ui::VKEY_T, true, false, false, false, |
| 684 true, false, false, false, 1, | 684 true, false, false, false, 1, |
| 685 { "D 17 0 true false false false" } | 685 { "D 17 0 true false false false" } |
| 686 #endif | 686 #endif |
| 687 }; | 687 }; |
| 688 | 688 |
| 689 ui_test_utils::WindowedNotificationObserver wait_for_new_tab( | 689 ui_test_utils::WindowedNotificationObserver wait_for_new_tab( |
| 690 content::NOTIFICATION_TAB_PARENTED, | 690 chrome::NOTIFICATION_TAB_PARENTED, |
| 691 content::NotificationService::AllSources()); | 691 content::NotificationService::AllSources()); |
| 692 | 692 |
| 693 // Press Ctrl/Cmd+T, which will open a new tab. It cannot be suppressed. | 693 // Press Ctrl/Cmd+T, which will open a new tab. It cannot be suppressed. |
| 694 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(0, kTestCtrlOrCmdT)); | 694 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(0, kTestCtrlOrCmdT)); |
| 695 wait_for_new_tab.Wait(); | 695 wait_for_new_tab.Wait(); |
| 696 | 696 |
| 697 int result_length; | 697 int result_length; |
| 698 ASSERT_NO_FATAL_FAILURE(GetResultLength(0, &result_length)); | 698 ASSERT_NO_FATAL_FAILURE(GetResultLength(0, &result_length)); |
| 699 EXPECT_EQ(1, result_length); | 699 EXPECT_EQ(1, result_length); |
| 700 | 700 |
| 701 EXPECT_EQ(2, browser()->tab_count()); | 701 EXPECT_EQ(2, browser()->tab_count()); |
| 702 ASSERT_EQ(1, browser()->active_index()); | 702 ASSERT_EQ(1, browser()->active_index()); |
| 703 | 703 |
| 704 // Because of issue http://crbug.com/65375, switching back to the first tab | 704 // Because of issue <http://crbug.com/65375>, switching back to the first tab |
| 705 // may cause the focus to be grabbed by omnibox. So instead, we load our | 705 // may cause the focus to be grabbed by omnibox. So instead, we load our |
| 706 // testing page in the newly created tab and try Cmd-W here. | 706 // testing page in the newly created tab and try Cmd-W here. |
| 707 ui_test_utils::NavigateToURL(browser(), url); | 707 ui_test_utils::NavigateToURL(browser(), url); |
| 708 | 708 |
| 709 // Make sure the focus is in the testing page. | 709 // Make sure the focus is in the testing page. |
| 710 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); | 710 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); |
| 711 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); | 711 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); |
| 712 | 712 |
| 713 // Reserved accelerators can't be suppressed. | 713 // Reserved accelerators can't be suppressed. |
| 714 ASSERT_NO_FATAL_FAILURE(SuppressAllEvents(1, true)); | 714 ASSERT_NO_FATAL_FAILURE(SuppressAllEvents(1, true)); |
| 715 | 715 |
| 716 ui_test_utils::WindowedNotificationObserver wait_for_tab_closed( | 716 ui_test_utils::WindowedNotificationObserver wait_for_tab_closed( |
| 717 content::NOTIFICATION_TAB_CLOSED, | 717 content::NOTIFICATION_WEB_CONTENTS_DESTROYED, |
| 718 content::Source<NavigationController>( | 718 content::Source<content::WebContents>(browser()->GetWebContentsAt(1))); |
| 719 &browser()->GetWebContentsAt(1)->GetController())); | |
| 720 | 719 |
| 721 // Press Ctrl/Cmd+W, which will close the tab. | 720 // Press Ctrl/Cmd+W, which will close the tab. |
| 722 #if defined(OS_MACOSX) | 721 #if defined(OS_MACOSX) |
| 723 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( | 722 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
| 724 browser(), ui::VKEY_W, false, false, false, true)); | 723 browser(), ui::VKEY_W, false, false, false, true)); |
| 725 #else | 724 #else |
| 726 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( | 725 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
| 727 browser(), ui::VKEY_W, true, false, false, false)); | 726 browser(), ui::VKEY_W, true, false, false, false)); |
| 728 #endif | 727 #endif |
| 729 | 728 |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 861 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAltKeySuppress)); | 860 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAltKeySuppress)); |
| 862 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); | 861 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); |
| 863 | 862 |
| 864 // Ctrl+Alt should have no effect. | 863 // Ctrl+Alt should have no effect. |
| 865 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlAltKey)); | 864 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlAltKey)); |
| 866 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); | 865 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); |
| 867 } | 866 } |
| 868 #endif | 867 #endif |
| 869 | 868 |
| 870 } // namespace | 869 } // namespace |
| OLD | NEW |