| 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 1793 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1804 EXPECT_FALSE(instant_service->IsInstantProcess( | 1804 EXPECT_FALSE(instant_service->IsInstantProcess( |
| 1805 ntp_contents->GetRenderProcessHost()->GetID())); | 1805 ntp_contents->GetRenderProcessHost()->GetID())); |
| 1806 // Make sure the URL remains the same. | 1806 // Make sure the URL remains the same. |
| 1807 EXPECT_EQ(ntp_url, ntp_contents->GetURL()); | 1807 EXPECT_EQ(ntp_url, ntp_contents->GetURL()); |
| 1808 | 1808 |
| 1809 // TODO(kmadhusu): In order to avoid the shutdown crashes, call SetupInstant() | 1809 // TODO(kmadhusu): In order to avoid the shutdown crashes, call SetupInstant() |
| 1810 // at the end of this test. Remove the folllowing code after committing | 1810 // at the end of this test. Remove the folllowing code after committing |
| 1811 // codereview.chromium.org/13873010. | 1811 // codereview.chromium.org/13873010. |
| 1812 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); | 1812 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| 1813 } | 1813 } |
| 1814 |
| 1815 // Test that if Instant alters the input from URL to search, it's respected. |
| 1816 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, InputChangedFromURLToSearch) { |
| 1817 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| 1818 FocusOmniboxAndWaitForInstantExtendedSupport(); |
| 1819 |
| 1820 content::WebContents* overlay = instant()->GetOverlayContents(); |
| 1821 EXPECT_TRUE(ExecuteScript("suggestions = ['mcqueen.com'];")); |
| 1822 |
| 1823 SetOmniboxTextAndWaitForOverlayToShow("lightning"); |
| 1824 EXPECT_EQ("lightning", GetOmniboxText()); |
| 1825 |
| 1826 SendDownArrow(); |
| 1827 EXPECT_EQ("mcqueen.com", GetOmniboxText()); |
| 1828 |
| 1829 // Press Enter. |
| 1830 browser()->window()->GetLocationBar()->AcceptInput(); |
| 1831 |
| 1832 // Confirm that the Instant overlay was committed. |
| 1833 EXPECT_EQ(overlay, browser()->tab_strip_model()->GetActiveWebContents()); |
| 1834 } |
| 1835 |
| 1836 // Test that if Instant alters the input from search to URL, it's respected. |
| 1837 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, InputChangedFromSearchToURL) { |
| 1838 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); |
| 1839 FocusOmniboxAndWaitForInstantExtendedSupport(); |
| 1840 |
| 1841 content::WebContents* overlay = instant()->GetOverlayContents(); |
| 1842 EXPECT_TRUE(ExecuteScript("suggestionType = 1;")); // INSTANT_SUGGESTION_URL |
| 1843 |
| 1844 SetOmniboxTextAndWaitForOverlayToShow("mack.com"); |
| 1845 EXPECT_EQ("mack.com", GetOmniboxText()); |
| 1846 |
| 1847 SendDownArrow(); |
| 1848 EXPECT_EQ("result 1", GetOmniboxText()); |
| 1849 |
| 1850 // Press Enter. |
| 1851 browser()->window()->GetLocationBar()->AcceptInput(); |
| 1852 |
| 1853 // Confirm that the Instant overlay was NOT committed. |
| 1854 EXPECT_NE(overlay, browser()->tab_strip_model()->GetActiveWebContents()); |
| 1855 } |
| OLD | NEW |