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 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 | 571 |
572 static const KeyEventTestData kTestAccessDSuppress = { | 572 static const KeyEventTestData kTestAccessDSuppress = { |
573 ui::VKEY_D, false, false, true, false, | 573 ui::VKEY_D, false, false, true, false, |
574 true, true, true, false, 4, | 574 true, true, true, false, 4, |
575 { "D 18 0 false false true false", | 575 { "D 18 0 false false true false", |
576 "D 68 0 false false true false", | 576 "D 68 0 false false true false", |
577 "U 68 0 false false true false", | 577 "U 68 0 false false true false", |
578 "U 18 0 false false true false" } | 578 "U 18 0 false false true false" } |
579 }; | 579 }; |
580 | 580 |
| 581 #if !defined(USE_ASH) |
581 static const KeyEventTestData kTestAccess1 = { | 582 static const KeyEventTestData kTestAccess1 = { |
582 ui::VKEY_1, false, false, true, false, | 583 ui::VKEY_1, false, false, true, false, |
583 false, false, false, false, 4, | 584 false, false, false, false, 4, |
584 { "D 18 0 false false true false", | 585 { "D 18 0 false false true false", |
585 "D 49 0 false false true false", | 586 "D 49 0 false false true false", |
586 "U 49 0 false false true false", | 587 "U 49 0 false false true false", |
587 "U 18 0 false false true false" } | 588 "U 18 0 false false true false" } |
588 }; | 589 }; |
589 #endif | 590 #endif |
| 591 #endif |
590 | 592 |
591 ASSERT_TRUE(test_server()->Start()); | 593 ASSERT_TRUE(test_server()->Start()); |
592 | 594 |
593 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 595 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
594 GURL url = test_server()->GetURL(kTestingPage); | 596 GURL url = test_server()->GetURL(kTestingPage); |
595 ui_test_utils::NavigateToURL(browser(), url); | 597 ui_test_utils::NavigateToURL(browser(), url); |
596 | 598 |
597 ui_test_utils::RunAllPendingInMessageLoop(); | 599 ui_test_utils::RunAllPendingInMessageLoop(); |
598 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); | 600 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); |
599 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); | 601 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
638 // a part of the default action of the key event, so it should not be | 640 // a part of the default action of the key event, so it should not be |
639 // suppressed at all. | 641 // suppressed at all. |
640 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAccessDSuppress)); | 642 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAccessDSuppress)); |
641 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); | 643 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); |
642 EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L"D")); | 644 EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L"D")); |
643 | 645 |
644 // Blur the focused element. | 646 // Blur the focused element. |
645 EXPECT_NO_FATAL_FAILURE(SetFocusedElement(tab_index, L"")); | 647 EXPECT_NO_FATAL_FAILURE(SetFocusedElement(tab_index, L"")); |
646 // Make sure no element is focused. | 648 // Make sure no element is focused. |
647 EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L"")); | 649 EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L"")); |
| 650 #if !defined(USE_ASH) |
| 651 // On Ash, alt-1..9 are assigned as window selection global accelerators, so |
| 652 // they can not be used as accesskeys. |
648 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAccess1)); | 653 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAccess1)); |
649 #if defined(TOOLKIT_GTK) | 654 #if defined(TOOLKIT_GTK) |
650 // On GTK, alt-0..9 are assigned as tab selection accelerators, so they can | 655 // On GTK, alt-0..9 are assigned as tab selection accelerators, so they can |
651 // not be used as accesskeys. | 656 // not be used as accesskeys. |
652 EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L"")); | 657 EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L"")); |
653 #else | 658 #else |
654 EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L"1")); | 659 EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L"1")); |
655 #endif | 660 #endif |
| 661 #endif |
656 } | 662 } |
657 | 663 |
658 // Flaky, http://crbug.com/69475. | 664 // Flaky, http://crbug.com/69475. |
659 #if defined(OS_LINUX) | 665 #if defined(OS_LINUX) |
660 #define MAYBE_ReservedAccelerators DISABLED_ReservedAccelerators | 666 #define MAYBE_ReservedAccelerators DISABLED_ReservedAccelerators |
661 #else | 667 #else |
662 #define MAYBE_ReservedAccelerators ReservedAccelerators | 668 #define MAYBE_ReservedAccelerators ReservedAccelerators |
663 #endif | 669 #endif |
664 IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, MAYBE_ReservedAccelerators) { | 670 IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, MAYBE_ReservedAccelerators) { |
665 ASSERT_TRUE(test_server()->Start()); | 671 ASSERT_TRUE(test_server()->Start()); |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
859 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAltKeySuppress)); | 865 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAltKeySuppress)); |
860 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); | 866 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); |
861 | 867 |
862 // Ctrl+Alt should have no effect. | 868 // Ctrl+Alt should have no effect. |
863 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlAltKey)); | 869 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlAltKey)); |
864 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); | 870 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); |
865 } | 871 } |
866 #endif | 872 #endif |
867 | 873 |
868 } // namespace | 874 } // namespace |
OLD | NEW |