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/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/browser/ui/browser.h" | 13 #include "chrome/browser/ui/browser.h" |
14 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 14 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
15 #include "chrome/common/chrome_notification_types.h" | 15 #include "chrome/common/chrome_notification_types.h" |
16 #include "chrome/common/chrome_paths.h" | 16 #include "chrome/common/chrome_paths.h" |
17 #include "chrome/test/base/in_process_browser_test.h" | 17 #include "chrome/test/base/in_process_browser_test.h" |
18 #include "chrome/test/base/interactive_test_utils.h" | 18 #include "chrome/test/base/interactive_test_utils.h" |
19 #include "chrome/test/base/ui_test_utils.h" | 19 #include "chrome/test/base/ui_test_utils.h" |
20 #include "content/public/browser/dom_operation_notification_details.h" | 20 #include "content/public/browser/dom_operation_notification_details.h" |
21 #include "content/public/browser/notification_registrar.h" | 21 #include "content/public/browser/notification_registrar.h" |
22 #include "content/public/browser/notification_service.h" | 22 #include "content/public/browser/notification_service.h" |
23 #include "content/public/browser/render_view_host.h" | 23 #include "content/public/browser/render_view_host.h" |
24 #include "content/public/browser/render_widget_host_view.h" | 24 #include "content/public/browser/render_widget_host_view.h" |
25 #include "content/public/browser/web_contents.h" | 25 #include "content/public/browser/web_contents.h" |
26 #include "content/public/browser/web_contents_view.h" | 26 #include "content/public/browser/web_contents_view.h" |
27 #include "content/public/test/browser_test_utils.h" | 27 #include "content/public/test/browser_test_utils.h" |
28 #include "net/test/spawned_test_server/spawned_test_server.h" | 28 #include "net/test/embedded_test_server/embedded_test_server.h" |
29 #include "ui/base/keycodes/keyboard_codes.h" | 29 #include "ui/base/keycodes/keyboard_codes.h" |
30 #include "ui/views/controls/textfield/textfield.h" | 30 #include "ui/views/controls/textfield/textfield.h" |
31 | 31 |
32 // TODO(kbr): remove: http://crbug.com/222296 | 32 // TODO(kbr): remove: http://crbug.com/222296 |
33 #if defined(OS_MACOSX) | 33 #if defined(OS_MACOSX) |
34 #import "base/mac/mac_util.h" | 34 #import "base/mac/mac_util.h" |
35 #endif | 35 #endif |
36 | 36 |
37 using content::DomOperationNotificationDetails; | 37 using content::DomOperationNotificationDetails; |
38 using content::NavigationController; | 38 using content::NavigationController; |
39 using content::RenderViewHost; | 39 using content::RenderViewHost; |
40 | 40 |
41 namespace { | 41 namespace { |
42 | 42 |
43 const char kTestingPage[] = "files/keyevents_test.html"; | 43 const char kTestingPage[] = "/keyevents_test.html"; |
44 const char kSuppressEventJS[] = | 44 const char kSuppressEventJS[] = |
45 "window.domAutomationController.send(setDefaultAction('%ls', %ls));"; | 45 "window.domAutomationController.send(setDefaultAction('%ls', %ls));"; |
46 const char kGetResultJS[] = | 46 const char kGetResultJS[] = |
47 "window.domAutomationController.send(keyEventResult[%d]);"; | 47 "window.domAutomationController.send(keyEventResult[%d]);"; |
48 const char kGetResultLengthJS[] = | 48 const char kGetResultLengthJS[] = |
49 "window.domAutomationController.send(keyEventResult.length);"; | 49 "window.domAutomationController.send(keyEventResult.length);"; |
50 const char kGetFocusedElementJS[] = | 50 const char kGetFocusedElementJS[] = |
51 "window.domAutomationController.send(focusedElement);"; | 51 "window.domAutomationController.send(focusedElement);"; |
52 const char kSetFocusedElementJS[] = | 52 const char kSetFocusedElementJS[] = |
53 "window.domAutomationController.send(setFocusedElement('%ls'));"; | 53 "window.domAutomationController.send(setFocusedElement('%ls'));"; |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
361 "U 65 0 false false false false" } }, | 361 "U 65 0 false false false false" } }, |
362 // a, suppress textInput | 362 // a, suppress textInput |
363 { ui::VKEY_A, false, false, false, false, | 363 { ui::VKEY_A, false, false, false, false, |
364 false, false, false, true, 4, | 364 false, false, false, true, 4, |
365 { "D 65 0 false false false false", | 365 { "D 65 0 false false false false", |
366 "P 97 97 false false false false", | 366 "P 97 97 false false false false", |
367 "T a", | 367 "T a", |
368 "U 65 0 false false false false" } }, | 368 "U 65 0 false false false false" } }, |
369 }; | 369 }; |
370 | 370 |
371 ASSERT_TRUE(test_server()->Start()); | 371 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
372 | 372 |
373 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 373 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
374 GURL url = test_server()->GetURL(kTestingPage); | 374 GURL url = embedded_test_server()->GetURL(kTestingPage); |
375 ui_test_utils::NavigateToURL(browser(), url); | 375 ui_test_utils::NavigateToURL(browser(), url); |
376 | 376 |
377 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); | 377 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); |
378 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); | 378 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); |
379 | 379 |
380 int tab_index = browser()->tab_strip_model()->active_index(); | 380 int tab_index = browser()->tab_strip_model()->active_index(); |
381 for (size_t i = 0; i < arraysize(kTestNoInput); ++i) { | 381 for (size_t i = 0; i < arraysize(kTestNoInput); ++i) { |
382 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestNoInput[i])) | 382 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestNoInput[i])) |
383 << "kTestNoInput[" << i << "] failed:\n" | 383 << "kTestNoInput[" << i << "] failed:\n" |
384 << GetTestDataDescription(kTestNoInput[i]); | 384 << GetTestDataDescription(kTestNoInput[i]); |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
454 static const KeyEventTestData kTestCtrlEnter = { | 454 static const KeyEventTestData kTestCtrlEnter = { |
455 ui::VKEY_RETURN, true, false, false, false, | 455 ui::VKEY_RETURN, true, false, false, false, |
456 false, false, false, false, 5, | 456 false, false, false, false, 5, |
457 { "D 17 0 true false false false", | 457 { "D 17 0 true false false false", |
458 "D 13 0 true false false false", | 458 "D 13 0 true false false false", |
459 "P 10 10 true false false false", | 459 "P 10 10 true false false false", |
460 "U 13 0 true false false false", | 460 "U 13 0 true false false false", |
461 "U 17 0 true false false false" } | 461 "U 17 0 true false false false" } |
462 }; | 462 }; |
463 | 463 |
464 ASSERT_TRUE(test_server()->Start()); | 464 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
465 | 465 |
466 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 466 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
467 GURL url = test_server()->GetURL(kTestingPage); | 467 GURL url = embedded_test_server()->GetURL(kTestingPage); |
468 ui_test_utils::NavigateToURL(browser(), url); | 468 ui_test_utils::NavigateToURL(browser(), url); |
469 | 469 |
470 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); | 470 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); |
471 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); | 471 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); |
472 | 472 |
473 int tab_index = browser()->tab_strip_model()->active_index(); | 473 int tab_index = browser()->tab_strip_model()->active_index(); |
474 // Press Ctrl+F, which will make the Find box open and request focus. | 474 // Press Ctrl+F, which will make the Find box open and request focus. |
475 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlF)); | 475 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlF)); |
476 EXPECT_TRUE(IsViewFocused(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD)); | 476 EXPECT_TRUE(IsViewFocused(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD)); |
477 | 477 |
(...skipping 22 matching lines...) Expand all Loading... |
500 | 500 |
501 // On Mac we don't send key up events when command modifier is down. | 501 // On Mac we don't send key up events when command modifier is down. |
502 static const KeyEventTestData kTestCmdFSuppressKeyDown = { | 502 static const KeyEventTestData kTestCmdFSuppressKeyDown = { |
503 ui::VKEY_F, false, false, false, true, | 503 ui::VKEY_F, false, false, false, true, |
504 true, false, false, false, 3, | 504 true, false, false, false, 3, |
505 { "D 91 0 false false false true", | 505 { "D 91 0 false false false true", |
506 "D 70 0 false false false true", | 506 "D 70 0 false false false true", |
507 "U 91 0 false false false true" } | 507 "U 91 0 false false false true" } |
508 }; | 508 }; |
509 | 509 |
510 ASSERT_TRUE(test_server()->Start()); | 510 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
511 | 511 |
512 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 512 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
513 GURL url = test_server()->GetURL(kTestingPage); | 513 GURL url = embedded_test_server()->GetURL(kTestingPage); |
514 ui_test_utils::NavigateToURL(browser(), url); | 514 ui_test_utils::NavigateToURL(browser(), url); |
515 | 515 |
516 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); | 516 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); |
517 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); | 517 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); |
518 | 518 |
519 int tab_index = browser()->tab_strip_model()->active_index(); | 519 int tab_index = browser()->tab_strip_model()->active_index(); |
520 // Press Cmd+F, which will make the Find box open and request focus. | 520 // Press Cmd+F, which will make the Find box open and request focus. |
521 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCmdF)); | 521 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCmdF)); |
522 EXPECT_TRUE(IsViewFocused(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD)); | 522 EXPECT_TRUE(IsViewFocused(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD)); |
523 | 523 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 ui::VKEY_1, false, false, true, false, | 600 ui::VKEY_1, false, false, true, false, |
601 false, false, false, false, 4, | 601 false, false, false, false, 4, |
602 { "D 18 0 false false true false", | 602 { "D 18 0 false false true false", |
603 "D 49 0 false false true false", | 603 "D 49 0 false false true false", |
604 "U 49 0 false false true false", | 604 "U 49 0 false false true false", |
605 "U 18 0 false false true false" } | 605 "U 18 0 false false true false" } |
606 }; | 606 }; |
607 #endif | 607 #endif |
608 #endif | 608 #endif |
609 | 609 |
610 ASSERT_TRUE(test_server()->Start()); | 610 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
611 | 611 |
612 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 612 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
613 GURL url = test_server()->GetURL(kTestingPage); | 613 GURL url = embedded_test_server()->GetURL(kTestingPage); |
614 ui_test_utils::NavigateToURL(browser(), url); | 614 ui_test_utils::NavigateToURL(browser(), url); |
615 | 615 |
616 content::RunAllPendingInMessageLoop(); | 616 content::RunAllPendingInMessageLoop(); |
617 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); | 617 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); |
618 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); | 618 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); |
619 | 619 |
620 int tab_index = browser()->tab_strip_model()->active_index(); | 620 int tab_index = browser()->tab_strip_model()->active_index(); |
621 // Make sure no element is focused. | 621 // Make sure no element is focused. |
622 EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L"")); | 622 EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L"")); |
623 // Alt+A should focus the element with accesskey = "A". | 623 // Alt+A should focus the element with accesskey = "A". |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 #endif | 674 #endif |
675 } | 675 } |
676 | 676 |
677 // Flaky, http://crbug.com/69475. | 677 // Flaky, http://crbug.com/69475. |
678 #if defined(OS_LINUX) | 678 #if defined(OS_LINUX) |
679 #define MAYBE_ReservedAccelerators DISABLED_ReservedAccelerators | 679 #define MAYBE_ReservedAccelerators DISABLED_ReservedAccelerators |
680 #else | 680 #else |
681 #define MAYBE_ReservedAccelerators ReservedAccelerators | 681 #define MAYBE_ReservedAccelerators ReservedAccelerators |
682 #endif | 682 #endif |
683 IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, MAYBE_ReservedAccelerators) { | 683 IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, MAYBE_ReservedAccelerators) { |
684 ASSERT_TRUE(test_server()->Start()); | 684 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
685 | 685 |
686 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 686 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
687 GURL url = test_server()->GetURL(kTestingPage); | 687 GURL url = embedded_test_server()->GetURL(kTestingPage); |
688 ui_test_utils::NavigateToURL(browser(), url); | 688 ui_test_utils::NavigateToURL(browser(), url); |
689 | 689 |
690 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); | 690 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); |
691 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); | 691 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); |
692 | 692 |
693 ASSERT_EQ(1, browser()->tab_strip_model()->count()); | 693 ASSERT_EQ(1, browser()->tab_strip_model()->count()); |
694 | 694 |
695 static const KeyEventTestData kTestCtrlOrCmdT = { | 695 static const KeyEventTestData kTestCtrlOrCmdT = { |
696 #if defined(OS_MACOSX) | 696 #if defined(OS_MACOSX) |
697 ui::VKEY_T, false, false, false, true, | 697 ui::VKEY_T, false, false, false, true, |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 | 776 |
777 static const KeyEventTestData kTestCtrlK = { | 777 static const KeyEventTestData kTestCtrlK = { |
778 ui::VKEY_K, true, false, false, false, | 778 ui::VKEY_K, true, false, false, false, |
779 false, false, false, false, 4, | 779 false, false, false, false, 4, |
780 { "D 17 0 true false false false", | 780 { "D 17 0 true false false false", |
781 "D 75 0 true false false false", | 781 "D 75 0 true false false false", |
782 "U 75 0 true false false false", | 782 "U 75 0 true false false false", |
783 "U 17 0 true false false false" } | 783 "U 17 0 true false false false" } |
784 }; | 784 }; |
785 | 785 |
786 ASSERT_TRUE(test_server()->Start()); | 786 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
787 | 787 |
788 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 788 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
789 GURL url = test_server()->GetURL(kTestingPage); | 789 GURL url = embedded_test_server()->GetURL(kTestingPage); |
790 ui_test_utils::NavigateToURL(browser(), url); | 790 ui_test_utils::NavigateToURL(browser(), url); |
791 | 791 |
792 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); | 792 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); |
793 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); | 793 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); |
794 | 794 |
795 int tab_index = browser()->tab_strip_model()->active_index(); | 795 int tab_index = browser()->tab_strip_model()->active_index(); |
796 ASSERT_NO_FATAL_FAILURE(SetFocusedElement(tab_index, L"A")); | 796 ASSERT_NO_FATAL_FAILURE(SetFocusedElement(tab_index, L"A")); |
797 ASSERT_NO_FATAL_FAILURE(SetTextBoxValue(tab_index, L"A", L"Hello")); | 797 ASSERT_NO_FATAL_FAILURE(SetTextBoxValue(tab_index, L"A", L"Hello")); |
798 // Move the caret to the beginning of the line. | 798 // Move the caret to the beginning of the line. |
799 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlA)); | 799 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlA)); |
(...skipping 14 matching lines...) Expand all Loading... |
814 "U 33 0 false false false false" } | 814 "U 33 0 false false false false" } |
815 }; | 815 }; |
816 | 816 |
817 static const KeyEventTestData kTestPageDown = { | 817 static const KeyEventTestData kTestPageDown = { |
818 ui::VKEY_NEXT, false, false, false, false, | 818 ui::VKEY_NEXT, false, false, false, false, |
819 false, false, false, false, 2, | 819 false, false, false, false, 2, |
820 { "D 34 0 false false false false", | 820 { "D 34 0 false false false false", |
821 "U 34 0 false false false false" } | 821 "U 34 0 false false false false" } |
822 }; | 822 }; |
823 | 823 |
824 ASSERT_TRUE(test_server()->Start()); | 824 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
825 | 825 |
826 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 826 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
827 GURL url = test_server()->GetURL(kTestingPage); | 827 GURL url = embedded_test_server()->GetURL(kTestingPage); |
828 ui_test_utils::NavigateToURL(browser(), url); | 828 ui_test_utils::NavigateToURL(browser(), url); |
829 | 829 |
830 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); | 830 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); |
831 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); | 831 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); |
832 | 832 |
833 int tab_index = browser()->tab_strip_model()->active_index(); | 833 int tab_index = browser()->tab_strip_model()->active_index(); |
834 ASSERT_NO_FATAL_FAILURE(SetFocusedElement(tab_index, L"A")); | 834 ASSERT_NO_FATAL_FAILURE(SetFocusedElement(tab_index, L"A")); |
835 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestPageUp)); | 835 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestPageUp)); |
836 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestPageDown)); | 836 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestPageDown)); |
837 EXPECT_NO_FATAL_FAILURE(CheckTextBoxValue(tab_index, L"A", L"")); | 837 EXPECT_NO_FATAL_FAILURE(CheckTextBoxValue(tab_index, L"A", L"")); |
(...skipping 18 matching lines...) Expand all Loading... |
856 | 856 |
857 static const KeyEventTestData kTestCtrlAltKey = { | 857 static const KeyEventTestData kTestCtrlAltKey = { |
858 ui::VKEY_MENU, true, false, false, false, | 858 ui::VKEY_MENU, true, false, false, false, |
859 false, false, false, false, 4, | 859 false, false, false, false, 4, |
860 { "D 17 0 true false false false", | 860 { "D 17 0 true false false false", |
861 "D 18 0 true false true false", | 861 "D 18 0 true false true false", |
862 "U 18 0 true false true false", | 862 "U 18 0 true false true false", |
863 "U 17 0 true false false false" } | 863 "U 17 0 true false false false" } |
864 }; | 864 }; |
865 | 865 |
866 ASSERT_TRUE(test_server()->Start()); | 866 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); |
867 | 867 |
868 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 868 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
869 GURL url = test_server()->GetURL(kTestingPage); | 869 GURL url = embedded_test_server()->GetURL(kTestingPage); |
870 ui_test_utils::NavigateToURL(browser(), url); | 870 ui_test_utils::NavigateToURL(browser(), url); |
871 | 871 |
872 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); | 872 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); |
873 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); | 873 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); |
874 | 874 |
875 int tab_index = browser()->tab_strip_model()->active_index(); | 875 int tab_index = browser()->tab_strip_model()->active_index(); |
876 // Press and release Alt key to focus wrench menu button. | 876 // Press and release Alt key to focus wrench menu button. |
877 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAltKey)); | 877 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAltKey)); |
878 EXPECT_TRUE(IsViewFocused(VIEW_ID_APP_MENU)); | 878 EXPECT_TRUE(IsViewFocused(VIEW_ID_APP_MENU)); |
879 | 879 |
880 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); | 880 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); |
881 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); | 881 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); |
882 | 882 |
883 // Alt key can be suppressed. | 883 // Alt key can be suppressed. |
884 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAltKeySuppress)); | 884 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAltKeySuppress)); |
885 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); | 885 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); |
886 | 886 |
887 // Ctrl+Alt should have no effect. | 887 // Ctrl+Alt should have no effect. |
888 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlAltKey)); | 888 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlAltKey)); |
889 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); | 889 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); |
890 } | 890 } |
891 #endif | 891 #endif |
892 | 892 |
893 } // namespace | 893 } // namespace |
OLD | NEW |