Chromium Code Reviews| 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/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 695 ui_test_utils::NavigateToURLWithDisposition( | 695 ui_test_utils::NavigateToURLWithDisposition( |
| 696 browser(), | 696 browser(), |
| 697 GURL(chrome::kChromeUINewTabURL), | 697 GURL(chrome::kChromeUINewTabURL), |
| 698 NEW_FOREGROUND_TAB, | 698 NEW_FOREGROUND_TAB, |
| 699 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); | 699 ui_test_utils::BROWSER_TEST_WAIT_FOR_TAB); |
| 700 content::WebContents* active_tab = | 700 content::WebContents* active_tab = |
| 701 browser()->tab_strip_model()->GetActiveWebContents(); | 701 browser()->tab_strip_model()->GetActiveWebContents(); |
| 702 EXPECT_NE(ntp_url, active_tab->GetURL()); | 702 EXPECT_NE(ntp_url, active_tab->GetURL()); |
| 703 } | 703 } |
| 704 | 704 |
| 705 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, RedirectToLocalOnLoadFailure) { | |
|
samarth
2013/05/02 03:12:56
Please also add a test to test that instanttabs ge
David Black
2013/05/02 05:02:49
Ok. Will work on that (and on making this test wo
| |
| 706 // Change providers. | |
| 707 InstantTestBase::Init(GURL("chrome://path-that-will-surely-404"));//asdf | |
| 708 | |
| 709 // Setup Instant. | |
| 710 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); | |
| 711 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport(); | |
| 712 | |
| 713 content::WindowedNotificationObserver instant_tab_observer( | |
| 714 chrome::NOTIFICATION_INSTANT_TAB_SUPPORT_DETERMINED, | |
| 715 content::NotificationService::AllSources()); | |
| 716 instant_tab_observer.Wait(); | |
| 717 | |
| 718 // DO NOT SUBMIT: None of this works yet. | |
| 719 | |
| 720 // NTP contents should be preloaded. | |
| 721 ASSERT_NE(static_cast<InstantNTP*>(NULL), instant()->ntp()); | |
| 722 content::WebContents* ntp_contents = instant()->ntp_->contents(); | |
| 723 EXPECT_TRUE(ntp_contents); | |
| 724 GURL ntp_url = ntp_contents->GetURL(); | |
| 725 EXPECT_EQ(chrome::kChromeSearchLocalNtpUrl, ntp_url.spec());//DEBUG asdf | |
| 726 | |
| 727 // Overlay contents should be preloaded. | |
| 728 ASSERT_NE(static_cast<InstantOverlay*>(NULL), instant()->overlay()); | |
| 729 content::WebContents* overlay_contents = instant()->overlay_->contents(); | |
| 730 EXPECT_TRUE(overlay_contents); | |
| 731 GURL overlay_url = overlay_contents->GetURL(); | |
| 732 EXPECT_EQ(chrome::kChromeSearchLocalNtpUrl, overlay_url.spec());//DEBUG asdf | |
| 733 | |
| 734 // Instant tab contents should be preloaded. | |
| 735 ASSERT_NE(static_cast<InstantTab*>(NULL), instant()->instant_tab()); | |
| 736 content::WebContents* instant_tab_contents = | |
| 737 instant()->instant_tab_->contents(); | |
| 738 EXPECT_TRUE(instant_tab_contents); | |
| 739 GURL instant_tab_url = instant_tab_contents->GetURL(); | |
| 740 EXPECT_EQ(chrome::kChromeSearchLocalNtpUrl, instant_tab_url.spec());//DEBUG | |
| 741 } | |
| 742 | |
| 705 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, OmniboxHasFocusOnNewTab) { | 743 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, OmniboxHasFocusOnNewTab) { |
| 706 // Setup Instant. | 744 // Setup Instant. |
| 707 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); | 745 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| 708 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport(); | 746 FocusOmniboxAndWaitForInstantOverlayAndNTPSupport(); |
| 709 | 747 |
| 710 // Explicitly unfocus the omnibox. | 748 // Explicitly unfocus the omnibox. |
| 711 EXPECT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 749 EXPECT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
| 712 ui_test_utils::ClickOnView(browser(), VIEW_ID_TAB_CONTAINER); | 750 ui_test_utils::ClickOnView(browser(), VIEW_ID_TAB_CONTAINER); |
| 713 EXPECT_FALSE(omnibox()->model()->has_focus()); | 751 EXPECT_FALSE(omnibox()->model()->has_focus()); |
| 714 | 752 |
| (...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1854 | 1892 |
| 1855 SendDownArrow(); | 1893 SendDownArrow(); |
| 1856 EXPECT_EQ("result 1", GetOmniboxText()); | 1894 EXPECT_EQ("result 1", GetOmniboxText()); |
| 1857 | 1895 |
| 1858 // Press Enter. | 1896 // Press Enter. |
| 1859 browser()->window()->GetLocationBar()->AcceptInput(); | 1897 browser()->window()->GetLocationBar()->AcceptInput(); |
| 1860 | 1898 |
| 1861 // Confirm that the Instant overlay was NOT committed. | 1899 // Confirm that the Instant overlay was NOT committed. |
| 1862 EXPECT_NE(overlay, browser()->tab_strip_model()->GetActiveWebContents()); | 1900 EXPECT_NE(overlay, browser()->tab_strip_model()->GetActiveWebContents()); |
| 1863 } | 1901 } |
| OLD | NEW |