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

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

Issue 10825085: Move RunAllPendingInMessageLoop from ui_test_utils.h to test_utils.h, so that it can be reused by c… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 4 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 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 }; 606 };
607 #endif 607 #endif
608 #endif 608 #endif
609 609
610 ASSERT_TRUE(test_server()->Start()); 610 ASSERT_TRUE(test_server()->Start());
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 = test_server()->GetURL(kTestingPage);
614 ui_test_utils::NavigateToURL(browser(), url); 614 ui_test_utils::NavigateToURL(browser(), url);
615 615
616 ui_test_utils::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()->active_index(); 620 int tab_index = browser()->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".
624 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAccessA)); 624 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAccessA));
625 EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L"A")); 625 EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L"A"));
626 626
627 // Blur the focused element. 627 // Blur the focused element.
628 EXPECT_NO_FATAL_FAILURE(SetFocusedElement(tab_index, L"")); 628 EXPECT_NO_FATAL_FAILURE(SetFocusedElement(tab_index, L""));
629 // Make sure no element is focused. 629 // Make sure no element is focused.
630 EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L"")); 630 EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L""));
631 631
632 #if !defined(OS_MACOSX) 632 #if !defined(OS_MACOSX)
633 // Alt+D should move the focus to the location entry. 633 // Alt+D should move the focus to the location entry.
634 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAccessD)); 634 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAccessD));
635 635
636 // TODO(isherman): This is an experimental change to help diagnose 636 // TODO(isherman): This is an experimental change to help diagnose
637 // http://crbug.com/55713 637 // http://crbug.com/55713
638 ui_test_utils::RunAllPendingInMessageLoop(); 638 content::RunAllPendingInMessageLoop();
639 #if defined(USE_AURA) 639 #if defined(USE_AURA)
640 EXPECT_TRUE(IsViewFocused(VIEW_ID_OMNIBOX)); 640 EXPECT_TRUE(IsViewFocused(VIEW_ID_OMNIBOX));
641 #else 641 #else
642 EXPECT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR)); 642 EXPECT_TRUE(IsViewFocused(VIEW_ID_LOCATION_BAR));
643 #endif 643 #endif
644 // No element should be focused, as Alt+D was handled by the browser. 644 // No element should be focused, as Alt+D was handled by the browser.
645 EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L"")); 645 EXPECT_NO_FATAL_FAILURE(CheckFocusedElement(tab_index, L""));
646 646
647 // Move the focus back to the web page. 647 // Move the focus back to the web page.
648 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER)); 648 ASSERT_NO_FATAL_FAILURE(ClickOnView(VIEW_ID_TAB_CONTAINER));
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAltKeySuppress)); 882 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestAltKeySuppress));
883 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); 883 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
884 884
885 // Ctrl+Alt should have no effect. 885 // Ctrl+Alt should have no effect.
886 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlAltKey)); 886 EXPECT_NO_FATAL_FAILURE(TestKeyEvent(tab_index, kTestCtrlAltKey));
887 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER)); 887 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER));
888 } 888 }
889 #endif 889 #endif
890 890
891 } // namespace 891 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/browser_focus_uitest.cc ('k') | chrome/browser/chromeos/extensions/file_browser_notifications_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698