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

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

Issue 271030: Disable test that is hanging or crashing or something on the buildbots.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/ref_counted.h" 8 #include "base/ref_counted.h"
9 #include "chrome/browser/automation/ui_controls.h" 9 #include "chrome/browser/automation/ui_controls.h"
10 #include "chrome/browser/browser.h" 10 #include "chrome/browser/browser.h"
(...skipping 18 matching lines...) Expand all
29 #endif 29 #endif
30 30
31 #if defined(OS_LINUX) 31 #if defined(OS_LINUX)
32 #include "chrome/browser/gtk/view_id_util.h" 32 #include "chrome/browser/gtk/view_id_util.h"
33 #endif 33 #endif
34 34
35 #if defined(OS_LINUX) 35 #if defined(OS_LINUX)
36 // For some reason we hit an external DNS lookup in this test in Linux but not 36 // For some reason we hit an external DNS lookup in this test in Linux but not
37 // on Windows. TODO(estade): investigate. 37 // on Windows. TODO(estade): investigate.
38 #define MAYBE_FocusTraversalOnInterstitial DISABLED_FocusTraversalOnInterstitial 38 #define MAYBE_FocusTraversalOnInterstitial DISABLED_FocusTraversalOnInterstitial
39 #define MAYBE(x) x
39 #else 40 #else
40 #define MAYBE_FocusTraversalOnInterstitial FocusTraversalOnInterstitial 41 #define MAYBE_FocusTraversalOnInterstitial DISABLED_FocusTraversalOnInterstitial
42 // http://crbug.com/24400
43 #define MAYBE(x) DISABLED_##x
41 #endif 44 #endif
42 45
43 namespace { 46 namespace {
44 47
45 // The delay waited in some cases where we don't have a notifications for an 48 // The delay waited in some cases where we don't have a notifications for an
46 // action we take. 49 // action we take.
47 const int kActionDelayMs = 500; 50 const int kActionDelayMs = 500;
48 51
49 const wchar_t kSimplePage[] = L"files/focus/page_with_focus.html"; 52 const wchar_t kSimplePage[] = L"files/focus/page_with_focus.html";
50 const wchar_t kStealFocusPage[] = L"files/focus/page_steals_focus.html"; 53 const wchar_t kStealFocusPage[] = L"files/focus/page_steals_focus.html";
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 browser()->window()->GetNativeHandle())->GetFocusedView()); 310 browser()->window()->GetNativeHandle())->GetFocusedView());
308 EXPECT_EQ(browser_view2->GetTabContentsContainerView(), 311 EXPECT_EQ(browser_view2->GetTabContentsContainerView(),
309 focus_manager2->GetFocusedView()); 312 focus_manager2->GetFocusedView());
310 313
311 // Close the 2nd browser to avoid a DCHECK(). 314 // Close the 2nd browser to avoid a DCHECK().
312 browser_view2->Close(); 315 browser_view2->Close();
313 #endif 316 #endif
314 } 317 }
315 318
316 // Tabs remember focus. 319 // Tabs remember focus.
317 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, TabsRememberFocus) { 320 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE(TabsRememberFocus)) {
318 HTTPTestServer* server = StartHTTPServer(); 321 HTTPTestServer* server = StartHTTPServer();
319 322
320 // First we navigate to our test page. 323 // First we navigate to our test page.
321 GURL url = server->TestServerPageW(kSimplePage); 324 GURL url = server->TestServerPageW(kSimplePage);
322 ui_test_utils::NavigateToURL(browser(), url); 325 ui_test_utils::NavigateToURL(browser(), url);
323 326
324 // Create several tabs. 327 // Create several tabs.
325 for (int i = 0; i < 4; ++i) { 328 for (int i = 0; i < 4; ++i) {
326 browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, true, -1, 329 browser()->AddTabWithURL(url, GURL(), PageTransition::TYPED, true, -1,
327 false, NULL); 330 false, NULL);
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
441 PlatformThread::Sleep(2000); 444 PlatformThread::Sleep(2000);
442 445
443 // Make sure the first browser is still active. 446 // Make sure the first browser is still active.
444 EXPECT_TRUE(focused_browser->window()->IsActive()); 447 EXPECT_TRUE(focused_browser->window()->IsActive());
445 448
446 // Close the 2nd browser to avoid a DCHECK(). 449 // Close the 2nd browser to avoid a DCHECK().
447 browser2->window()->Close(); 450 browser2->window()->Close();
448 } 451 }
449 452
450 // Page cannot steal focus when focus is on location bar. 453 // Page cannot steal focus when focus is on location bar.
451 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, LocationBarLockFocus) { 454 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE(LocationBarLockFocus)) {
452 HTTPTestServer* server = StartHTTPServer(); 455 HTTPTestServer* server = StartHTTPServer();
453 456
454 // Open the page that steals focus. 457 // Open the page that steals focus.
455 GURL url = server->TestServerPageW(kStealFocusPage); 458 GURL url = server->TestServerPageW(kStealFocusPage);
456 ui_test_utils::NavigateToURL(browser(), url); 459 ui_test_utils::NavigateToURL(browser(), url);
457 460
458 browser()->FocusLocationBar(); 461 browser()->FocusLocationBar();
459 462
460 // Wait for the page to steal focus. 463 // Wait for the page to steal focus.
461 PlatformThread::Sleep(2000); 464 PlatformThread::Sleep(2000);
462 465
463 // Make sure the location bar is still focused. 466 // Make sure the location bar is still focused.
464 CheckViewHasFocus(VIEW_ID_LOCATION_BAR); 467 CheckViewHasFocus(VIEW_ID_LOCATION_BAR);
465 } 468 }
466 469
467 // Focus traversal on a regular page. 470 // Focus traversal on a regular page.
468 // Note that this test relies on a notification from the renderer that the 471 // Note that this test relies on a notification from the renderer that the
469 // focus has changed in the page. The notification in the renderer may change 472 // focus has changed in the page. The notification in the renderer may change
470 // at which point this test would fail (see comment in 473 // at which point this test would fail (see comment in
471 // RenderWidget::didFocus()). 474 // RenderWidget::didFocus()).
472 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusTraversal) { 475 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE(FocusTraversal)) {
473 HTTPTestServer* server = StartHTTPServer(); 476 HTTPTestServer* server = StartHTTPServer();
474 477
475 // First we navigate to our test page. 478 // First we navigate to our test page.
476 GURL url = server->TestServerPageW(kTypicalPage); 479 GURL url = server->TestServerPageW(kTypicalPage);
477 ui_test_utils::NavigateToURL(browser(), url); 480 ui_test_utils::NavigateToURL(browser(), url);
478 481
479 browser()->FocusLocationBar(); 482 browser()->FocusLocationBar();
480 483
481 const char* kExpElementIDs[] = { 484 const char* kExpElementIDs[] = {
482 "", // Initially no element in the page should be focused 485 "", // Initially no element in the page should be focused
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
640 } 643 }
641 644
642 // At this point the renderer has sent us a message asking to advance the 645 // At this point the renderer has sent us a message asking to advance the
643 // focus (as the end of the focus loop was reached in the renderer). 646 // focus (as the end of the focus loop was reached in the renderer).
644 // We need to run the message loop to process it. 647 // We need to run the message loop to process it.
645 MessageLoop::current()->RunAllPending(); 648 MessageLoop::current()->RunAllPending();
646 } 649 }
647 } 650 }
648 651
649 // Focus stays on page with interstitials. 652 // Focus stays on page with interstitials.
650 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, InterstitialFocus) { 653 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE(InterstitialFocus)) {
651 HTTPTestServer* server = StartHTTPServer(); 654 HTTPTestServer* server = StartHTTPServer();
652 655
653 // First we navigate to our test page. 656 // First we navigate to our test page.
654 GURL url = server->TestServerPageW(kSimplePage); 657 GURL url = server->TestServerPageW(kSimplePage);
655 ui_test_utils::NavigateToURL(browser(), url); 658 ui_test_utils::NavigateToURL(browser(), url);
656 659
657 // Page should have focus. 660 // Page should have focus.
658 CheckViewHasFocus(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW); 661 CheckViewHasFocus(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW);
659 EXPECT_TRUE(browser()->GetSelectedTabContents()->render_view_host()->view()-> 662 EXPECT_TRUE(browser()->GetSelectedTabContents()->render_view_host()->view()->
660 HasFocus()); 663 HasFocus());
(...skipping 14 matching lines...) Expand all
675 EXPECT_TRUE(interstitial_page->HasFocus()); 678 EXPECT_TRUE(interstitial_page->HasFocus());
676 679
677 // Hide the interstitial. 680 // Hide the interstitial.
678 interstitial_page->DontProceed(); 681 interstitial_page->DontProceed();
679 682
680 // Focus should be back on the original page. 683 // Focus should be back on the original page.
681 CheckViewHasFocus(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW); 684 CheckViewHasFocus(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW);
682 } 685 }
683 686
684 // Make sure Find box can request focus, even when it is already open. 687 // Make sure Find box can request focus, even when it is already open.
685 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FindFocusTest) { 688 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE(FindFocusTest)) {
686 HTTPTestServer* server = StartHTTPServer(); 689 HTTPTestServer* server = StartHTTPServer();
687 690
688 // Open some page (any page that doesn't steal focus). 691 // Open some page (any page that doesn't steal focus).
689 GURL url = server->TestServerPageW(kTypicalPage); 692 GURL url = server->TestServerPageW(kTypicalPage);
690 ui_test_utils::NavigateToURL(browser(), url); 693 ui_test_utils::NavigateToURL(browser(), url);
691 694
692 gfx::NativeWindow window = browser()->window()->GetNativeHandle(); 695 gfx::NativeWindow window = browser()->window()->GetNativeHandle();
693 696
694 // Press Ctrl+F, which will make the Find box open and request focus. 697 // Press Ctrl+F, which will make the Find box open and request focus.
695 ui_controls::SendKeyPressNotifyWhenDone(window, base::VKEY_F, true, 698 ui_controls::SendKeyPressNotifyWhenDone(window, base::VKEY_F, true,
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 732
730 // See remark above on why we wait. 733 // See remark above on why we wait.
731 MessageLoop::current()->PostDelayedTask( 734 MessageLoop::current()->PostDelayedTask(
732 FROM_HERE, new MessageLoop::QuitTask(), kActionDelayMs); 735 FROM_HERE, new MessageLoop::QuitTask(), kActionDelayMs);
733 ui_test_utils::RunMessageLoop(); 736 ui_test_utils::RunMessageLoop();
734 CheckViewHasFocus(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD); 737 CheckViewHasFocus(VIEW_ID_FIND_IN_PAGE_TEXT_FIELD);
735 } 738 }
736 739
737 // Makes sure the focus is in the right location when opening the different 740 // Makes sure the focus is in the right location when opening the different
738 // types of tabs. 741 // types of tabs.
739 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, TabInitialFocus) { 742 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE(TabInitialFocus)) {
740 // Open the history tab, focus should be on the tab contents. 743 // Open the history tab, focus should be on the tab contents.
741 browser()->ShowHistoryTab(); 744 browser()->ShowHistoryTab();
742 CheckViewHasFocus(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW); 745 CheckViewHasFocus(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW);
743 746
744 // Open the new tab, focus should be on the location bar. 747 // Open the new tab, focus should be on the location bar.
745 browser()->NewTab(); 748 browser()->NewTab();
746 CheckViewHasFocus(VIEW_ID_LOCATION_BAR); 749 CheckViewHasFocus(VIEW_ID_LOCATION_BAR);
747 750
748 // Open the download tab, focus should be on the tab contents. 751 // Open the download tab, focus should be on the tab contents.
749 browser()->ShowDownloadsTab(); 752 browser()->ShowDownloadsTab();
750 CheckViewHasFocus(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW); 753 CheckViewHasFocus(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW);
751 754
752 // Open about:blank, focus should be on the location bar. 755 // Open about:blank, focus should be on the location bar.
753 browser()->AddTabWithURL(GURL("about:blank"), GURL(), PageTransition::LINK, 756 browser()->AddTabWithURL(GURL("about:blank"), GURL(), PageTransition::LINK,
754 true, -1, false, NULL); 757 true, -1, false, NULL);
755 CheckViewHasFocus(VIEW_ID_LOCATION_BAR); 758 CheckViewHasFocus(VIEW_ID_LOCATION_BAR);
756 } 759 }
757 760
758 // Tests that focus goes where expected when using reload. 761 // Tests that focus goes where expected when using reload.
759 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusOnReload) { 762 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE(FocusOnReload)) {
760 HTTPTestServer* server = StartHTTPServer(); 763 HTTPTestServer* server = StartHTTPServer();
761 764
762 // Open the new tab, reload. 765 // Open the new tab, reload.
763 browser()->NewTab(); 766 browser()->NewTab();
764 browser()->Reload(); 767 browser()->Reload();
765 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); 768 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser()));
766 // Focus should stay on the location bar. 769 // Focus should stay on the location bar.
767 CheckViewHasFocus(VIEW_ID_LOCATION_BAR); 770 CheckViewHasFocus(VIEW_ID_LOCATION_BAR);
768 771
769 // Open a regular page, focus the location bar, reload. 772 // Open a regular page, focus the location bar, reload.
770 ui_test_utils::NavigateToURL(browser(), server->TestServerPageW(kSimplePage)); 773 ui_test_utils::NavigateToURL(browser(), server->TestServerPageW(kSimplePage));
771 browser()->FocusLocationBar(); 774 browser()->FocusLocationBar();
772 CheckViewHasFocus(VIEW_ID_LOCATION_BAR); 775 CheckViewHasFocus(VIEW_ID_LOCATION_BAR);
773 browser()->Reload(); 776 browser()->Reload();
774 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); 777 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser()));
775 // Focus should now be on the tab contents. 778 // Focus should now be on the tab contents.
776 browser()->ShowDownloadsTab(); 779 browser()->ShowDownloadsTab();
777 CheckViewHasFocus(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW); 780 CheckViewHasFocus(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW);
778 } 781 }
779 782
780 // Tests that focus goes where expected when using reload on a crashed tab. 783 // Tests that focus goes where expected when using reload on a crashed tab.
781 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusOnReloadCrashedTab) { 784 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE(FocusOnReloadCrashedTab)) {
782 HTTPTestServer* server = StartHTTPServer(); 785 HTTPTestServer* server = StartHTTPServer();
783 786
784 // Open a regular page, crash, reload. 787 // Open a regular page, crash, reload.
785 ui_test_utils::NavigateToURL(browser(), server->TestServerPageW(kSimplePage)); 788 ui_test_utils::NavigateToURL(browser(), server->TestServerPageW(kSimplePage));
786 ui_test_utils::CrashTab(browser()->GetSelectedTabContents()); 789 ui_test_utils::CrashTab(browser()->GetSelectedTabContents());
787 browser()->Reload(); 790 browser()->Reload();
788 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser())); 791 ASSERT_TRUE(ui_test_utils::WaitForNavigationInCurrentTab(browser()));
789 // Focus should now be on the tab contents. 792 // Focus should now be on the tab contents.
790 browser()->ShowDownloadsTab(); 793 browser()->ShowDownloadsTab();
791 CheckViewHasFocus(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW); 794 CheckViewHasFocus(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW);
792 } 795 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698