OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 | 144 |
145 void ClickOnView(ViewID vid) { | 145 void ClickOnView(ViewID vid) { |
146 ui_test_utils::ClickOnView(browser(), vid); | 146 ui_test_utils::ClickOnView(browser(), vid); |
147 } | 147 } |
148 | 148 |
149 ViewID location_bar_focus_view_id_; | 149 ViewID location_bar_focus_view_id_; |
150 }; | 150 }; |
151 | 151 |
152 class TestInterstitialPage : public InterstitialPage { | 152 class TestInterstitialPage : public InterstitialPage { |
153 public: | 153 public: |
154 TestInterstitialPage(TabContents* tab, bool new_navigation, const GURL& url) | 154 TestInterstitialPage(WebContents* tab, bool new_navigation, const GURL& url) |
155 : InterstitialPage(tab, new_navigation, url) { | 155 : InterstitialPage(tab, new_navigation, url) { |
156 FilePath file_path; | 156 FilePath file_path; |
157 bool r = PathService::Get(chrome::DIR_TEST_DATA, &file_path); | 157 bool r = PathService::Get(chrome::DIR_TEST_DATA, &file_path); |
158 EXPECT_TRUE(r); | 158 EXPECT_TRUE(r); |
159 file_path = file_path.AppendASCII("focus"); | 159 file_path = file_path.AppendASCII("focus"); |
160 file_path = file_path.AppendASCII(kTypicalPageName); | 160 file_path = file_path.AppendASCII(kTypicalPageName); |
161 r = file_util::ReadFileToString(file_path, &html_contents_); | 161 r = file_util::ReadFileToString(file_path, &html_contents_); |
162 EXPECT_TRUE(r); | 162 EXPECT_TRUE(r); |
163 } | 163 } |
164 | 164 |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 unfocused_browser = browser(); | 413 unfocused_browser = browser(); |
414 #endif | 414 #endif |
415 | 415 |
416 GURL steal_focus_url = test_server()->GetURL(kStealFocusPage); | 416 GURL steal_focus_url = test_server()->GetURL(kStealFocusPage); |
417 ui_test_utils::NavigateToURL(unfocused_browser, steal_focus_url); | 417 ui_test_utils::NavigateToURL(unfocused_browser, steal_focus_url); |
418 | 418 |
419 // Activate the first browser. | 419 // Activate the first browser. |
420 focused_browser->window()->Activate(); | 420 focused_browser->window()->Activate(); |
421 | 421 |
422 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( | 422 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( |
423 unfocused_browser->GetSelectedTabContents()->GetRenderViewHost(), L"", | 423 unfocused_browser->GetSelectedWebContents()->GetRenderViewHost(), L"", |
424 L"stealFocus();")); | 424 L"stealFocus();")); |
425 | 425 |
426 // Make sure the first browser is still active. | 426 // Make sure the first browser is still active. |
427 EXPECT_TRUE(focused_browser->window()->IsActive()); | 427 EXPECT_TRUE(focused_browser->window()->IsActive()); |
428 } | 428 } |
429 | 429 |
430 // Page cannot steal focus when focus is on location bar. | 430 // Page cannot steal focus when focus is on location bar. |
431 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, LocationBarLockFocus) { | 431 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, LocationBarLockFocus) { |
432 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 432 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
433 ASSERT_TRUE(test_server()->Start()); | 433 ASSERT_TRUE(test_server()->Start()); |
434 | 434 |
435 // Open the page that steals focus. | 435 // Open the page that steals focus. |
436 GURL url = test_server()->GetURL(kStealFocusPage); | 436 GURL url = test_server()->GetURL(kStealFocusPage); |
437 ui_test_utils::NavigateToURL(browser(), url); | 437 ui_test_utils::NavigateToURL(browser(), url); |
438 | 438 |
439 browser()->FocusLocationBar(); | 439 browser()->FocusLocationBar(); |
440 | 440 |
441 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( | 441 ASSERT_TRUE(ui_test_utils::ExecuteJavaScript( |
442 browser()->GetSelectedTabContents()->GetRenderViewHost(), L"", | 442 browser()->GetSelectedWebContents()->GetRenderViewHost(), L"", |
443 L"stealFocus();")); | 443 L"stealFocus();")); |
444 | 444 |
445 // Make sure the location bar is still focused. | 445 // Make sure the location bar is still focused. |
446 ASSERT_TRUE(IsViewFocused(location_bar_focus_view_id_)); | 446 ASSERT_TRUE(IsViewFocused(location_bar_focus_view_id_)); |
447 } | 447 } |
448 | 448 |
449 // Focus traversal on a regular page. | 449 // Focus traversal on a regular page. |
450 // Note that this test relies on a notification from the renderer that the | 450 // Note that this test relies on a notification from the renderer that the |
451 // focus has changed in the page. The notification in the renderer may change | 451 // focus has changed in the page. The notification in the renderer may change |
452 // at which point this test would fail (see comment in | 452 // at which point this test would fail (see comment in |
(...skipping 25 matching lines...) Expand all Loading... |
478 // Move the caret to the end, otherwise the next Tab key may not move focus. | 478 // Move the caret to the end, otherwise the next Tab key may not move focus. |
479 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( | 479 ASSERT_TRUE(ui_test_utils::SendKeyPressSync( |
480 browser(), ui::VKEY_END, false, false, false, false)); | 480 browser(), ui::VKEY_END, false, false, false, false)); |
481 | 481 |
482 // Now let's press tab to move the focus. | 482 // Now let's press tab to move the focus. |
483 for (size_t j = 0; j < arraysize(kExpElementIDs); ++j) { | 483 for (size_t j = 0; j < arraysize(kExpElementIDs); ++j) { |
484 SCOPED_TRACE(base::StringPrintf("inner loop %" PRIuS, j)); | 484 SCOPED_TRACE(base::StringPrintf("inner loop %" PRIuS, j)); |
485 // Let's make sure the focus is on the expected element in the page. | 485 // Let's make sure the focus is on the expected element in the page. |
486 std::string actual; | 486 std::string actual; |
487 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( | 487 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( |
488 browser()->GetSelectedTabContents()->GetRenderViewHost(), | 488 browser()->GetSelectedWebContents()->GetRenderViewHost(), |
489 L"", | 489 L"", |
490 L"window.domAutomationController.send(getFocusedElement());", | 490 L"window.domAutomationController.send(getFocusedElement());", |
491 &actual)); | 491 &actual)); |
492 ASSERT_STREQ(kExpElementIDs[j], actual.c_str()); | 492 ASSERT_STREQ(kExpElementIDs[j], actual.c_str()); |
493 | 493 |
494 if (j < arraysize(kExpElementIDs) - 1) { | 494 if (j < arraysize(kExpElementIDs) - 1) { |
495 // If the next element is the kTextElementID, we expect to be | 495 // If the next element is the kTextElementID, we expect to be |
496 // notified we have switched to an editable node. | 496 // notified we have switched to an editable node. |
497 bool is_editable_node = | 497 bool is_editable_node = |
498 (strcmp(kTextElementID, kExpElementIDs[j + 1]) == 0); | 498 (strcmp(kTextElementID, kExpElementIDs[j + 1]) == 0); |
499 content::Details<bool> details(&is_editable_node); | 499 content::Details<bool> details(&is_editable_node); |
500 | 500 |
501 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWaitWithDetails( | 501 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWaitWithDetails( |
502 browser(), ui::VKEY_TAB, false, false, false, false, | 502 browser(), ui::VKEY_TAB, false, false, false, false, |
503 content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, | 503 content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, |
504 content::NotificationSource(content::Source<RenderViewHost>( | 504 content::NotificationSource(content::Source<RenderViewHost>( |
505 browser()->GetSelectedTabContents()->GetRenderViewHost())), | 505 browser()->GetSelectedWebContents()->GetRenderViewHost())), |
506 details)); | 506 details)); |
507 } else { | 507 } else { |
508 // On the last tab key press, the focus returns to the browser. | 508 // On the last tab key press, the focus returns to the browser. |
509 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( | 509 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( |
510 browser(), ui::VKEY_TAB, false, false, false, false, | 510 browser(), ui::VKEY_TAB, false, false, false, false, |
511 chrome::NOTIFICATION_FOCUS_RETURNED_TO_BROWSER, | 511 chrome::NOTIFICATION_FOCUS_RETURNED_TO_BROWSER, |
512 content::NotificationSource(content::Source<Browser>(browser())))); | 512 content::NotificationSource(content::Source<Browser>(browser())))); |
513 } | 513 } |
514 } | 514 } |
515 | 515 |
(...skipping 22 matching lines...) Expand all Loading... |
538 if (j < arraysize(kExpElementIDs) - 1) { | 538 if (j < arraysize(kExpElementIDs) - 1) { |
539 // If the next element is the kTextElementID, we expect to be | 539 // If the next element is the kTextElementID, we expect to be |
540 // notified we have switched to an editable node. | 540 // notified we have switched to an editable node. |
541 bool is_editable_node = (strcmp(kTextElementID, next_element) == 0); | 541 bool is_editable_node = (strcmp(kTextElementID, next_element) == 0); |
542 content::Details<bool> details(&is_editable_node); | 542 content::Details<bool> details(&is_editable_node); |
543 | 543 |
544 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWaitWithDetails( | 544 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWaitWithDetails( |
545 browser(), ui::VKEY_TAB, false, true, false, false, | 545 browser(), ui::VKEY_TAB, false, true, false, false, |
546 content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, | 546 content::NOTIFICATION_FOCUS_CHANGED_IN_PAGE, |
547 content::NotificationSource(content::Source<RenderViewHost>( | 547 content::NotificationSource(content::Source<RenderViewHost>( |
548 browser()->GetSelectedTabContents()->GetRenderViewHost())), | 548 browser()->GetSelectedWebContents()->GetRenderViewHost())), |
549 details)); | 549 details)); |
550 } else { | 550 } else { |
551 // On the last tab key press, the focus returns to the browser. | 551 // On the last tab key press, the focus returns to the browser. |
552 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( | 552 ASSERT_TRUE(ui_test_utils::SendKeyPressAndWait( |
553 browser(), ui::VKEY_TAB, false, true, false, false, | 553 browser(), ui::VKEY_TAB, false, true, false, false, |
554 chrome::NOTIFICATION_FOCUS_RETURNED_TO_BROWSER, | 554 chrome::NOTIFICATION_FOCUS_RETURNED_TO_BROWSER, |
555 content::NotificationSource(content::Source<Browser>(browser())))); | 555 content::NotificationSource(content::Source<Browser>(browser())))); |
556 } | 556 } |
557 | 557 |
558 // Let's make sure the focus is on the expected element in the page. | 558 // Let's make sure the focus is on the expected element in the page. |
559 std::string actual; | 559 std::string actual; |
560 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( | 560 ASSERT_TRUE(ui_test_utils::ExecuteJavaScriptAndExtractString( |
561 browser()->GetSelectedTabContents()->GetRenderViewHost(), | 561 browser()->GetSelectedWebContents()->GetRenderViewHost(), |
562 L"", | 562 L"", |
563 L"window.domAutomationController.send(getFocusedElement());", | 563 L"window.domAutomationController.send(getFocusedElement());", |
564 &actual)); | 564 &actual)); |
565 ASSERT_STREQ(next_element, actual.c_str()); | 565 ASSERT_STREQ(next_element, actual.c_str()); |
566 } | 566 } |
567 | 567 |
568 // At this point the renderer has sent us a message asking to advance the | 568 // At this point the renderer has sent us a message asking to advance the |
569 // focus (as the end of the focus loop was reached in the renderer). | 569 // focus (as the end of the focus loop was reached in the renderer). |
570 // We need to run the message loop to process it. | 570 // We need to run the message loop to process it. |
571 ui_test_utils::RunAllPendingInMessageLoop(); | 571 ui_test_utils::RunAllPendingInMessageLoop(); |
572 } | 572 } |
573 } | 573 } |
574 | 574 |
575 // Focus traversal while an interstitial is showing. | 575 // Focus traversal while an interstitial is showing. |
576 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversalOnInterstitial) { | 576 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, MAYBE_FocusTraversalOnInterstitial) { |
577 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 577 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
578 ASSERT_TRUE(test_server()->Start()); | 578 ASSERT_TRUE(test_server()->Start()); |
579 | 579 |
580 // First we navigate to our test page. | 580 // First we navigate to our test page. |
581 GURL url = test_server()->GetURL(kSimplePage); | 581 GURL url = test_server()->GetURL(kSimplePage); |
582 ui_test_utils::NavigateToURL(browser(), url); | 582 ui_test_utils::NavigateToURL(browser(), url); |
583 | 583 |
584 // Focus should be on the page. | 584 // Focus should be on the page. |
585 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); | 585 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); |
586 | 586 |
587 // Let's show an interstitial. | 587 // Let's show an interstitial. |
588 TestInterstitialPage* interstitial_page = | 588 TestInterstitialPage* interstitial_page = |
589 new TestInterstitialPage(browser()->GetSelectedTabContents(), | 589 new TestInterstitialPage(browser()->GetSelectedWebContents(), |
590 true, GURL("http://interstitial.com")); | 590 true, GURL("http://interstitial.com")); |
591 interstitial_page->Show(); | 591 interstitial_page->Show(); |
592 // Give some time for the interstitial to show. | 592 // Give some time for the interstitial to show. |
593 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 593 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
594 MessageLoop::QuitClosure(), | 594 MessageLoop::QuitClosure(), |
595 1000); | 595 1000); |
596 ui_test_utils::RunMessageLoop(); | 596 ui_test_utils::RunMessageLoop(); |
597 | 597 |
598 browser()->FocusLocationBar(); | 598 browser()->FocusLocationBar(); |
599 | 599 |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 #endif | 700 #endif |
701 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 701 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
702 ASSERT_TRUE(test_server()->Start()); | 702 ASSERT_TRUE(test_server()->Start()); |
703 | 703 |
704 // First we navigate to our test page. | 704 // First we navigate to our test page. |
705 GURL url = test_server()->GetURL(kSimplePage); | 705 GURL url = test_server()->GetURL(kSimplePage); |
706 ui_test_utils::NavigateToURL(browser(), url); | 706 ui_test_utils::NavigateToURL(browser(), url); |
707 | 707 |
708 // Page should have focus. | 708 // Page should have focus. |
709 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); | 709 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); |
710 EXPECT_TRUE(browser()->GetSelectedTabContents()->GetRenderViewHost()->view()-> | 710 EXPECT_TRUE(browser()->GetSelectedWebContents()->GetRenderViewHost()->view()-> |
711 HasFocus()); | 711 HasFocus()); |
712 | 712 |
713 // Let's show an interstitial. | 713 // Let's show an interstitial. |
714 TestInterstitialPage* interstitial_page = | 714 TestInterstitialPage* interstitial_page = |
715 new TestInterstitialPage(browser()->GetSelectedTabContents(), | 715 new TestInterstitialPage(browser()->GetSelectedWebContents(), |
716 true, GURL("http://interstitial.com")); | 716 true, GURL("http://interstitial.com")); |
717 interstitial_page->Show(); | 717 interstitial_page->Show(); |
718 // Give some time for the interstitial to show. | 718 // Give some time for the interstitial to show. |
719 MessageLoop::current()->PostDelayedTask(FROM_HERE, | 719 MessageLoop::current()->PostDelayedTask(FROM_HERE, |
720 MessageLoop::QuitClosure(), | 720 MessageLoop::QuitClosure(), |
721 1000); | 721 1000); |
722 ui_test_utils::RunMessageLoop(); | 722 ui_test_utils::RunMessageLoop(); |
723 | 723 |
724 // The interstitial should have focus now. | 724 // The interstitial should have focus now. |
725 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); | 725 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
805 | 805 |
806 // Makes sure the focus is in the right location when opening the different | 806 // Makes sure the focus is in the right location when opening the different |
807 // types of tabs. | 807 // types of tabs. |
808 // Flaky, http://crbug.com/62539. | 808 // Flaky, http://crbug.com/62539. |
809 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FLAKY_TabInitialFocus) { | 809 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FLAKY_TabInitialFocus) { |
810 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 810 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
811 | 811 |
812 // Open the history tab, focus should be on the tab contents. | 812 // Open the history tab, focus should be on the tab contents. |
813 browser()->ShowHistoryTab(); | 813 browser()->ShowHistoryTab(); |
814 ASSERT_NO_FATAL_FAILURE(ui_test_utils::WaitForLoadStop( | 814 ASSERT_NO_FATAL_FAILURE(ui_test_utils::WaitForLoadStop( |
815 browser()->GetSelectedTabContents())); | 815 browser()->GetSelectedWebContents())); |
816 EXPECT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); | 816 EXPECT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); |
817 | 817 |
818 // Open the new tab, focus should be on the location bar. | 818 // Open the new tab, focus should be on the location bar. |
819 browser()->NewTab(); | 819 browser()->NewTab(); |
820 ASSERT_NO_FATAL_FAILURE(ui_test_utils::WaitForLoadStop( | 820 ASSERT_NO_FATAL_FAILURE(ui_test_utils::WaitForLoadStop( |
821 browser()->GetSelectedTabContents())); | 821 browser()->GetSelectedWebContents())); |
822 EXPECT_TRUE(IsViewFocused(location_bar_focus_view_id_)); | 822 EXPECT_TRUE(IsViewFocused(location_bar_focus_view_id_)); |
823 | 823 |
824 // Open the download tab, focus should be on the tab contents. | 824 // Open the download tab, focus should be on the tab contents. |
825 browser()->ShowDownloadsTab(); | 825 browser()->ShowDownloadsTab(); |
826 ASSERT_NO_FATAL_FAILURE(ui_test_utils::WaitForLoadStop( | 826 ASSERT_NO_FATAL_FAILURE(ui_test_utils::WaitForLoadStop( |
827 browser()->GetSelectedTabContents())); | 827 browser()->GetSelectedWebContents())); |
828 EXPECT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); | 828 EXPECT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); |
829 | 829 |
830 // Open about:blank, focus should be on the location bar. | 830 // Open about:blank, focus should be on the location bar. |
831 browser()->AddSelectedTabWithURL(GURL(chrome::kAboutBlankURL), | 831 browser()->AddSelectedTabWithURL(GURL(chrome::kAboutBlankURL), |
832 content::PAGE_TRANSITION_LINK); | 832 content::PAGE_TRANSITION_LINK); |
833 ASSERT_NO_FATAL_FAILURE(ui_test_utils::WaitForLoadStop( | 833 ASSERT_NO_FATAL_FAILURE(ui_test_utils::WaitForLoadStop( |
834 browser()->GetSelectedTabContents())); | 834 browser()->GetSelectedWebContents())); |
835 EXPECT_TRUE(IsViewFocused(location_bar_focus_view_id_)); | 835 EXPECT_TRUE(IsViewFocused(location_bar_focus_view_id_)); |
836 } | 836 } |
837 | 837 |
838 // Tests that focus goes where expected when using reload. | 838 // Tests that focus goes where expected when using reload. |
839 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusOnReload) { | 839 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, FocusOnReload) { |
840 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 840 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
841 ASSERT_TRUE(test_server()->Start()); | 841 ASSERT_TRUE(test_server()->Start()); |
842 | 842 |
843 // Open the new tab, reload. | 843 // Open the new tab, reload. |
844 { | 844 { |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
881 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); | 881 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); |
882 } | 882 } |
883 | 883 |
884 // Tests that focus goes where expected when using reload on a crashed tab. | 884 // Tests that focus goes where expected when using reload on a crashed tab. |
885 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_FocusOnReloadCrashedTab) { | 885 IN_PROC_BROWSER_TEST_F(BrowserFocusTest, DISABLED_FocusOnReloadCrashedTab) { |
886 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 886 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
887 ASSERT_TRUE(test_server()->Start()); | 887 ASSERT_TRUE(test_server()->Start()); |
888 | 888 |
889 // Open a regular page, crash, reload. | 889 // Open a regular page, crash, reload. |
890 ui_test_utils::NavigateToURL(browser(), test_server()->GetURL(kSimplePage)); | 890 ui_test_utils::NavigateToURL(browser(), test_server()->GetURL(kSimplePage)); |
891 ui_test_utils::CrashTab(browser()->GetSelectedTabContents()); | 891 ui_test_utils::CrashTab(browser()->GetSelectedWebContents()); |
892 { | 892 { |
893 ui_test_utils::WindowedNotificationObserver observer( | 893 ui_test_utils::WindowedNotificationObserver observer( |
894 content::NOTIFICATION_LOAD_STOP, | 894 content::NOTIFICATION_LOAD_STOP, |
895 content::Source<NavigationController>( | 895 content::Source<NavigationController>( |
896 &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> | 896 &browser()->GetSelectedTabContentsWrapper()->tab_contents()-> |
897 GetController())); | 897 GetController())); |
898 browser()->Reload(CURRENT_TAB); | 898 browser()->Reload(CURRENT_TAB); |
899 observer.Wait(); | 899 observer.Wait(); |
900 } | 900 } |
901 | 901 |
902 // Focus should now be on the tab contents. | 902 // Focus should now be on the tab contents. |
903 browser()->ShowDownloadsTab(); | 903 browser()->ShowDownloadsTab(); |
904 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); | 904 ASSERT_TRUE(IsViewFocused(VIEW_ID_TAB_CONTAINER_FOCUS_VIEW)); |
905 } | 905 } |
906 | 906 |
907 } // namespace | 907 } // namespace |
OLD | NEW |