OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <sstream> | 5 #include <sstream> |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "base/stringprintf.h" | 10 #include "base/stringprintf.h" |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 ui_test_utils::NavigateToURLWithDisposition( | 741 ui_test_utils::NavigateToURLWithDisposition( |
742 browser(), | 742 browser(), |
743 GURL(chrome::kChromeUINewTabURL), | 743 GURL(chrome::kChromeUINewTabURL), |
744 NEW_FOREGROUND_TAB, | 744 NEW_FOREGROUND_TAB, |
745 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); | 745 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); |
746 content::WebContents* active_tab = | 746 content::WebContents* active_tab = |
747 browser()->tab_strip_model()->GetActiveWebContents(); | 747 browser()->tab_strip_model()->GetActiveWebContents(); |
748 EXPECT_EQ(instant()->GetLocalInstantURL(), active_tab->GetURL().spec()); | 748 EXPECT_EQ(instant()->GetLocalInstantURL(), active_tab->GetURL().spec()); |
749 } | 749 } |
750 | 750 |
| 751 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, RedirectToLocalOnLoadFailure) { |
| 752 // Change providers. |
| 753 InstantTestBase::Init(GURL("chrome://path-that-will-surely-404"));//asdf |
| 754 |
| 755 // Setup Instant. |
| 756 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| 757 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport(); |
| 758 |
| 759 content::WindowedNotificationObserver instant_tab_observer( |
| 760 chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED, |
| 761 content::NotificationService::AllSources()); |
| 762 instant_tab_observer.Wait(); |
| 763 |
| 764 // DO NOT SUBMIT: None of this works yet. |
| 765 |
| 766 // NTP contents should be preloaded. |
| 767 ASSERT_NE(static_cast<InstantNTP*>(NULL), instant()->ntp()); |
| 768 content::WebContents* ntp_contents = instant()->ntp_->contents(); |
| 769 EXPECT_TRUE(ntp_contents); |
| 770 GURL ntp_url = ntp_contents->GetURL(); |
| 771 EXPECT_EQ(chrome::kChromeSearchLocalNtpUrl, ntp_url.spec());//DEBUG asdf |
| 772 |
| 773 // Overlay contents should be preloaded. |
| 774 ASSERT_NE(static_cast<InstantOverlay*>(NULL), instant()->overlay()); |
| 775 content::WebContents* overlay_contents = instant()->overlay_->contents(); |
| 776 EXPECT_TRUE(overlay_contents); |
| 777 GURL overlay_url = overlay_contents->GetURL(); |
| 778 EXPECT_EQ(chrome::kChromeSearchLocalNtpUrl, overlay_url.spec());//DEBUG asdf |
| 779 |
| 780 // Instant tab contents should be preloaded. |
| 781 ASSERT_NE(static_cast<InstantTab*>(NULL), instant()->instant_tab()); |
| 782 content::WebContents* instant_tab_contents = |
| 783 instant()->instant_tab_->contents(); |
| 784 EXPECT_TRUE(instant_tab_contents); |
| 785 GURL instant_tab_url = instant_tab_contents->GetURL(); |
| 786 EXPECT_EQ(chrome::kChromeSearchLocalNtpUrl, instant_tab_url.spec());//DEBUG |
| 787 } |
| 788 |
751 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, OmniboxHasFocusOnNewTab) { | 789 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, OmniboxHasFocusOnNewTab) { |
752 // Setup Instant. | 790 // Setup Instant. |
753 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); | 791 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
754 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport(); | 792 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport(); |
755 | 793 |
756 // Explicitly unfocus the omnibox. | 794 // Explicitly unfocus the omnibox. |
757 EXPECT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 795 EXPECT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
758 ui_test_utils::ClickOnView(browser(), VIEW_ID_TAB_CONTAINER); | 796 ui_test_utils::ClickOnView(browser(), VIEW_ID_TAB_CONTAINER); |
759 EXPECT_FALSE(omnibox()->model()->has_focus()); | 797 EXPECT_FALSE(omnibox()->model()->has_focus()); |
760 | 798 |
(...skipping 1281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2042 | 2080 |
2043 SendDownArrow(); | 2081 SendDownArrow(); |
2044 EXPECT_EQ("result 1", GetOmniboxText()); | 2082 EXPECT_EQ("result 1", GetOmniboxText()); |
2045 | 2083 |
2046 // Press Enter. | 2084 // Press Enter. |
2047 browser()->window()->GetLocationBar()->AcceptInput(); | 2085 browser()->window()->GetLocationBar()->AcceptInput(); |
2048 | 2086 |
2049 // Confirm that the Instant overlay was NOT committed. | 2087 // Confirm that the Instant overlay was NOT committed. |
2050 EXPECT_NE(overlay, browser()->tab_strip_model()->GetActiveWebContents()); | 2088 EXPECT_NE(overlay, browser()->tab_strip_model()->GetActiveWebContents()); |
2051 } | 2089 } |
OLD | NEW |