Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(359)

Side by Side Diff: chrome/browser/browser_keyevents_browsertest.cc

Issue 10073014: Add more functionality to WebView. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
357 "U 65 0 false false false false" } }, 357 "U 65 0 false false false false" } },
358 }; 358 };
359 359
360 ASSERT_TRUE(test_server()->Start()); 360 ASSERT_TRUE(test_server()->Start());
361 361
362 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); 362 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
363 GURL url = test_server()->GetURL(kTestingPage); 363 GURL url = test_server()->GetURL(kTestingPage);
364 ui_test_utils::NavigateToURL(browser(), url); 364 ui_test_utils::NavigateToURL(browser(), url);
365 365
366 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); 366 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER));
367 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); 367 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
368 368
369 int tab_index = browser()->active_index(); 369 int tab_index = browser()->active_index();
370 for (size_t i = 0; i < arraysize(kTestNoInput); ++i) { 370 for (size_t i = 0; i < arraysize(kTestNoInput); ++i) {
371 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestNoInput[i])) 371 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestNoInput[i]))
372 << "kTestNoInput[" << i << "] failed:\n" 372 << "kTestNoInput[" << i << "] failed:\n"
373 << GetTestDataDescription(kTestNoInput[i]); 373 << GetTestDataDescription(kTestNoInput[i]);
374 } 374 }
375 375
376 // Input in normal text box. 376 // Input in normal text box.
377 ASSERT_NO_FATAL_FAILURE(SetFocusedElement(tab_index, L"A")); 377 ASSERT_NO_FATAL_FAILURE(SetFocusedElement(tab_index, L"A"));
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
442 "U 17 0 true false false false" } 442 "U 17 0 true false false false" }
443 }; 443 };
444 444
445 ASSERT_TRUE(test_server()->Start()); 445 ASSERT_TRUE(test_server()->Start());
446 446
447 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); 447 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
448 GURL url = test_server()->GetURL(kTestingPage); 448 GURL url = test_server()->GetURL(kTestingPage);
449 ui_test_utils::NavigateToURL(browser(), url); 449 ui_test_utils::NavigateToURL(browser(), url);
450 450
451 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); 451 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER));
452 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); 452 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
453 453
454 int tab_index = browser()->active_index(); 454 int tab_index = browser()->active_index();
455 // Press Ctrl+F, which will make the Find box open and request focus. 455 // Press Ctrl+F, which will make the Find box open and request focus.
456 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlF)); 456 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlF));
457 EXPECT_TRUE(IsViewFocused(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD)); 457 EXPECT_TRUE(IsViewFocused(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD));
458 458
459 // Press Escape to close the Find box and move the focus back to the web page. 459 // Press Escape to close the Find box and move the focus back to the web page.
460 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( 460 ASSERT_TRUE(ui_test_utils::SendKeyPressSync(
461 browser(), ui::VKEY_ESCAPE, false, false, false, false)); 461 browser(), ui::VKEY_ESCAPE, false, false, false, false));
462 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); 462 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
463 463
464 // Press Ctrl+F with keydown suppressed shall not open the find box. 464 // Press Ctrl+F with keydown suppressed shall not open the find box.
465 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlFSuppressKeyDown)); 465 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlFSuppressKeyDown));
466 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); 466 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
467 467
468 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlZ)); 468 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlZ));
469 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlZSuppressKeyDown)); 469 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlZSuppressKeyDown));
470 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlEnter)); 470 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlEnter));
471 } 471 }
472 #elif defined(OS_MACOSX) 472 #elif defined(OS_MACOSX)
473 // http://crbug.com/81451 473 // http://crbug.com/81451
474 IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, DISABLED_CommandKeyEvents) { 474 IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, DISABLED_CommandKeyEvents) {
475 static const KeyEventTestData kTestCmdF = { 475 static const KeyEventTestData kTestCmdF = {
476 ui::VKEY_F, false, false, false, true, 476 ui::VKEY_F, false, false, false, true,
(...skipping 11 matching lines...) Expand all
488 "U 91 0 false false false true" } 488 "U 91 0 false false false true" }
489 }; 489 };
490 490
491 ASSERT_TRUE(test_server()->Start()); 491 ASSERT_TRUE(test_server()->Start());
492 492
493 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); 493 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
494 GURL url = test_server()->GetURL(kTestingPage); 494 GURL url = test_server()->GetURL(kTestingPage);
495 ui_test_utils::NavigateToURL(browser(), url); 495 ui_test_utils::NavigateToURL(browser(), url);
496 496
497 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); 497 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER));
498 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); 498 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
499 499
500 int tab_index = browser()->active_index(); 500 int tab_index = browser()->active_index();
501 // Press Cmd+F, which will make the Find box open and request focus. 501 // Press Cmd+F, which will make the Find box open and request focus.
502 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCmdF)); 502 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCmdF));
503 EXPECT_TRUE(IsViewFocused(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD)); 503 EXPECT_TRUE(IsViewFocused(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD));
504 504
505 // Press Escape to close the Find box and move the focus back to the web page. 505 // Press Escape to close the Find box and move the focus back to the web page.
506 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( 506 ASSERT_TRUE(ui_test_utils::SendKeyPressSync(
507 browser(), ui::VKEY_ESCAPE, false, false, false, false)); 507 browser(), ui::VKEY_ESCAPE, false, false, false, false));
508 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); 508 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
509 509
510 // Press Cmd+F with keydown suppressed shall not open the find box. 510 // Press Cmd+F with keydown suppressed shall not open the find box.
511 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCmdFSuppressKeyDown)); 511 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCmdFSuppressKeyDown));
512 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); 512 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
513 } 513 }
514 #endif 514 #endif
515 515
516 #if defined(OS_MACOSX) 516 #if defined(OS_MACOSX)
517 // http://crbug.com/81451 for mac 517 // http://crbug.com/81451 for mac
518 IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, DISABLED_AccessKeys) { 518 IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, DISABLED_AccessKeys) {
519 #else 519 #else
520 IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, AccessKeys) { 520 IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, AccessKeys) {
521 #endif 521 #endif
522 #if defined(OS_MACOSX) 522 #if defined(OS_MACOSX)
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 #endif 590 #endif
591 591
592 ASSERT_TRUE(test_server()->Start()); 592 ASSERT_TRUE(test_server()->Start());
593 593
594 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); 594 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
595 GURL url = test_server()->GetURL(kTestingPage); 595 GURL url = test_server()->GetURL(kTestingPage);
596 ui_test_utils::NavigateToURL(browser(), url); 596 ui_test_utils::NavigateToURL(browser(), url);
597 597
598 ui_test_utils::RunAllPendingInMessageLoop(); 598 ui_test_utils::RunAllPendingInMessageLoop();
599 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); 599 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER));
600 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); 600 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
601 601
602 int tab_index = browser()->active_index(); 602 int tab_index = browser()->active_index();
603 // Make sure no element is focused. 603 // Make sure no element is focused.
604 EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L"")); 604 EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L""));
605 // Alt+A should focus the element with accesskey = "A". 605 // Alt+A should focus the element with accesskey = "A".
606 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAccessA)); 606 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAccessA));
607 EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L"A")); 607 EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L"A"));
608 608
609 // Blur the focused element. 609 // Blur the focused element.
610 EXPECT_NO_FATAL_FAILURE(SetFocusedElement(tab_index, L"")); 610 EXPECT_NO_FATAL_FAILURE(SetFocusedElement(tab_index, L""));
(...skipping 10 matching lines...) Expand all
621 #if defined(USE_AURA) 621 #if defined(USE_AURA)
622 EXPECT_TRUE(IsViewFocused(VIEW_ID_OMNIBOX)); 622 EXPECT_TRUE(IsViewFocused(VIEW_ID_OMNIBOX));
623 #else 623 #else
624 EXPECT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR)); 624 EXPECT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR));
625 #endif 625 #endif
626 // No element should be focused, as Alt+D was handled by the browser. 626 // No element should be focused, as Alt+D was handled by the browser.
627 EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L"")); 627 EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L""));
628 628
629 // Move the focus back to the web page. 629 // Move the focus back to the web page.
630 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); 630 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER));
631 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); 631 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
632 632
633 // Make sure no element is focused. 633 // Make sure no element is focused.
634 EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L"")); 634 EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L""));
635 #endif 635 #endif
636 636
637 // If the keydown event is suppressed, then Alt+D should be handled as an 637 // If the keydown event is suppressed, then Alt+D should be handled as an
638 // accesskey rather than an accelerator key. Activation of an accesskey is not 638 // accesskey rather than an accelerator key. Activation of an accesskey is not
639 // a part of the default action of the key event, so it should not be 639 // a part of the default action of the key event, so it should not be
640 // suppressed at all. 640 // suppressed at all.
641 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAccessDSuppress)); 641 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAccessDSuppress));
642 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); 642 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
643 EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L"D")); 643 EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L"D"));
644 644
645 // Blur the focused element. 645 // Blur the focused element.
646 EXPECT_NO_FATAL_FAILURE(SetFocusedElement(tab_index, L"")); 646 EXPECT_NO_FATAL_FAILURE(SetFocusedElement(tab_index, L""));
647 // Make sure no element is focused. 647 // Make sure no element is focused.
648 EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L"")); 648 EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L""));
649 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAccess1)); 649 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAccess1));
650 #if defined(TOOLKIT_GTK) 650 #if defined(TOOLKIT_GTK)
651 // On GTK, alt-0..9 are assigned as tab selection accelerators, so they can 651 // On GTK, alt-0..9 are assigned as tab selection accelerators, so they can
652 // not be used as accesskeys. 652 // not be used as accesskeys.
(...skipping 10 matching lines...) Expand all
663 #define MAYBE_ReservedAccelerators ReservedAccelerators 663 #define MAYBE_ReservedAccelerators ReservedAccelerators
664 #endif 664 #endif
665 IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, MAYBE_ReservedAccelerators) { 665 IN_PROC_BROWSER_TEST_F(BrowserKeyEventsTest, MAYBE_ReservedAccelerators) {
666 ASSERT_TRUE(test_server()->Start()); 666 ASSERT_TRUE(test_server()->Start());
667 667
668 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); 668 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
669 GURL url = test_server()->GetURL(kTestingPage); 669 GURL url = test_server()->GetURL(kTestingPage);
670 ui_test_utils::NavigateToURL(browser(), url); 670 ui_test_utils::NavigateToURL(browser(), url);
671 671
672 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); 672 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER));
673 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); 673 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
674 674
675 ASSERT_EQ(1, browser()->tab_count()); 675 ASSERT_EQ(1, browser()->tab_count());
676 676
677 static const KeyEventTestData kTestCtrlOrCmdT = { 677 static const KeyEventTestData kTestCtrlOrCmdT = {
678 #if defined(OS_MACOSX) 678 #if defined(OS_MACOSX)
679 ui::VKEY_T, false, false, false, true, 679 ui::VKEY_T, false, false, false, true,
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,
(...skipping 17 matching lines...) Expand all
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));
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_WEB_CONTENTS_DESTROYED, 717 content::NOTIFICATION_WEB_CONTENTS_DESTROYED,
718 content::Source<content::WebContents>(browser()->GetWebContentsAt(1))); 718 content::Source<content::WebContents>(browser()->GetWebContentsAt(1)));
719 719
720 // Press Ctrl/Cmd+W, which will close the tab. 720 // Press Ctrl/Cmd+W, which will close the tab.
721 #if defined(OS_MACOSX) 721 #if defined(OS_MACOSX)
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 "U 17 0 true false false false" } 760 "U 17 0 true false false false" }
761 }; 761 };
762 762
763 ASSERT_TRUE(test_server()->Start()); 763 ASSERT_TRUE(test_server()->Start());
764 764
765 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); 765 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
766 GURL url = test_server()->GetURL(kTestingPage); 766 GURL url = test_server()->GetURL(kTestingPage);
767 ui_test_utils::NavigateToURL(browser(), url); 767 ui_test_utils::NavigateToURL(browser(), url);
768 768
769 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); 769 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER));
770 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); 770 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
771 771
772 int tab_index = browser()->active_index(); 772 int tab_index = browser()->active_index();
773 ASSERT_NO_FATAL_FAILURE(SetFocusedElement(tab_index, L"A")); 773 ASSERT_NO_FATAL_FAILURE(SetFocusedElement(tab_index, L"A"));
774 ASSERT_NO_FATAL_FAILURE(SetTextBoxValue(tab_index, L"A", L"Hello")); 774 ASSERT_NO_FATAL_FAILURE(SetTextBoxValue(tab_index, L"A", L"Hello"));
775 // Move the caret to the beginning of the line. 775 // Move the caret to the beginning of the line.
776 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlA)); 776 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlA));
777 // Forward one character 777 // Forward one character
778 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlF)); 778 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlF));
779 // Delete to the end of the line. 779 // Delete to the end of the line.
780 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlK)); 780 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlK));
(...skipping 16 matching lines...) Expand all
797 "U 34 0 false false false false" } 797 "U 34 0 false false false false" }
798 }; 798 };
799 799
800 ASSERT_TRUE(test_server()->Start()); 800 ASSERT_TRUE(test_server()->Start());
801 801
802 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); 802 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
803 GURL url = test_server()->GetURL(kTestingPage); 803 GURL url = test_server()->GetURL(kTestingPage);
804 ui_test_utils::NavigateToURL(browser(), url); 804 ui_test_utils::NavigateToURL(browser(), url);
805 805
806 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); 806 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER));
807 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); 807 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
808 808
809 int tab_index = browser()->active_index(); 809 int tab_index = browser()->active_index();
810 ASSERT_NO_FATAL_FAILURE(SetFocusedElement(tab_index, L"A")); 810 ASSERT_NO_FATAL_FAILURE(SetFocusedElement(tab_index, L"A"));
811 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestPageUp)); 811 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestPageUp));
812 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestPageDown)); 812 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestPageDown));
813 EXPECT_NO_FATAL_FAILURE(CheckTextBoxValue(tab_index, L"A", L"")); 813 EXPECT_NO_FATAL_FAILURE(CheckTextBoxValue(tab_index, L"A", L""));
814 } 814 }
815 815
816 #if defined(OS_WIN) 816 #if defined(OS_WIN)
817 // AltKey is enabled only on Windows. See crbug.com/114537. 817 // AltKey is enabled only on Windows. See crbug.com/114537.
(...skipping 21 matching lines...) Expand all
839 "U 17 0 true false false false" } 839 "U 17 0 true false false false" }
840 }; 840 };
841 841
842 ASSERT_TRUE(test_server()->Start()); 842 ASSERT_TRUE(test_server()->Start());
843 843
844 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); 844 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser()));
845 GURL url = test_server()->GetURL(kTestingPage); 845 GURL url = test_server()->GetURL(kTestingPage);
846 ui_test_utils::NavigateToURL(browser(), url); 846 ui_test_utils::NavigateToURL(browser(), url);
847 847
848 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); 848 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER));
849 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); 849 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
850 850
851 int tab_index = browser()->active_index(); 851 int tab_index = browser()->active_index();
852 // Press and release Alt key to focus wrench menu button. 852 // Press and release Alt key to focus wrench menu button.
853 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAltKey)); 853 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAltKey));
854 EXPECT_TRUE(IsViewFocused(VIEW_ID_APP_MENU)); 854 EXPECT_TRUE(IsViewFocused(VIEW_ID_APP_MENU));
855 855
856 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); 856 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER));
857 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); 857 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
858 858
859 // Alt key can be suppressed. 859 // Alt key can be suppressed.
860 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAltKeySuppress)); 860 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAltKeySuppress));
861 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); 861 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
862 862
863 // Ctrl+Alt should have no effect. 863 // Ctrl+Alt should have no effect.
864 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlAltKey)); 864 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlAltKey));
865 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); 865 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
866 } 866 }
867 #endif 867 #endif
868 868
869 } // namespace 869 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/browser_focus_uitest.cc ('k') | chrome/browser/renderer_host/chrome_render_widget_host_view_mac_delegate.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698