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

Side by Side Diff: chrome/browser/ui/search/instant_extended_interactive_uitest.cc

Issue 13141002: Use Instant suggested match type for Instant temporary text. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix test Created 7 years, 7 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 | « chrome/browser/ui/omnibox/omnibox_edit_model.cc ('k') | chrome/test/data/instant_extended.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 browser()->window()->GetLocationBar()->AcceptInput(); 479 browser()->window()->GetLocationBar()->AcceptInput();
480 observer.Wait(); 480 observer.Wait();
481 481
482 SetOmniboxText("http"); 482 SetOmniboxText("http");
483 EXPECT_EQ("http", GetOmniboxText()); 483 EXPECT_EQ("http", GetOmniboxText());
484 484
485 SendDownArrow(); 485 SendDownArrow();
486 EXPECT_EQ("result 1", GetOmniboxText()); 486 EXPECT_EQ("result 1", GetOmniboxText());
487 SendDownArrow(); 487 SendDownArrow();
488 EXPECT_EQ("result 2", GetOmniboxText()); 488 EXPECT_EQ("result 2", GetOmniboxText());
489
490 // Set the next suggestion to be of type INSTANT_SUGGESTION_URL.
491 EXPECT_TRUE(content::ExecuteScript(instant()->instant_tab()->contents(),
492 "suggestionType = 1;"));
489 SendDownArrow(); 493 SendDownArrow();
490 EXPECT_EQ("http://www.google.com", GetOmniboxText()); 494 EXPECT_EQ("http://www.google.com", GetOmniboxText());
491 495
492 EXPECT_TRUE(HasUserInputInProgress()); 496 EXPECT_TRUE(HasUserInputInProgress());
493 497
494 EXPECT_TRUE(UpdateSearchState(instant()->instant_tab()->contents())); 498 EXPECT_TRUE(UpdateSearchState(instant()->instant_tab()->contents()));
495 // Note the commit count is initially 1 due to the AcceptInput() call above. 499 // Note the commit count is initially 1 due to the AcceptInput() call above.
496 EXPECT_EQ(1, submit_count_); 500 EXPECT_EQ(1, submit_count_);
497 501
498 std::string old_query_value(query_value_); 502 std::string old_query_value(query_value_);
(...skipping 1305 matching lines...) Expand 10 before | Expand all | Expand 10 after
1804 EXPECT_FALSE(instant_service->IsInstantProcess( 1808 EXPECT_FALSE(instant_service->IsInstantProcess(
1805 ntp_contents->GetRenderProcessHost()->GetID())); 1809 ntp_contents->GetRenderProcessHost()->GetID()));
1806 // Make sure the URL remains the same. 1810 // Make sure the URL remains the same.
1807 EXPECT_EQ(ntp_url, ntp_contents->GetURL()); 1811 EXPECT_EQ(ntp_url, ntp_contents->GetURL());
1808 1812
1809 // TODO(kmadhusu): In order to avoid the shutdown crashes, call SetupInstant() 1813 // TODO(kmadhusu): In order to avoid the shutdown crashes, call SetupInstant()
1810 // at the end of this test. Remove the folllowing code after committing 1814 // at the end of this test. Remove the folllowing code after committing
1811 // codereview.chromium.org/13873010. 1815 // codereview.chromium.org/13873010.
1812 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser())); 1816 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser()));
1813 } 1817 }
1818
1819 // Test that if Instant alters the input from URL to search, it's respected.
1820 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, InputChangedFromURLToSearch) {
1821 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser()));
1822 FocusOmniboxAndWaitForInstantExtendedSupport();
1823
1824 content::WebContents* overlay = instant()->GetOverlayContents();
1825 EXPECT_TRUE(ExecuteScript("suggestions = ['mcqueen.com'];"));
1826
1827 SetOmniboxTextAndWaitForOverlayToShow("lightning");
1828 EXPECT_EQ("lightning", GetOmniboxText());
1829
1830 SendDownArrow();
1831 EXPECT_EQ("mcqueen.com", GetOmniboxText());
1832
1833 // Press Enter.
1834 browser()->window()->GetLocationBar()->AcceptInput();
1835
1836 // Confirm that the Instant overlay was committed.
1837 EXPECT_EQ(overlay, browser()->tab_strip_model()->GetActiveWebContents());
1838 }
1839
1840 // Test that if Instant alters the input from search to URL, it's respected.
1841 IN_PROC_BROWSER_TEST_F(InstantExtendedTest, InputChangedFromSearchToURL) {
1842 ASSERT_NO_FATAL_FAILURE(SetupInstant(browser()));
1843 FocusOmniboxAndWaitForInstantExtendedSupport();
1844
1845 content::WebContents* overlay = instant()->GetOverlayContents();
1846 EXPECT_TRUE(ExecuteScript("suggestionType = 1;")); // INSTANT_SUGGESTION_URL
1847
1848 SetOmniboxTextAndWaitForOverlayToShow("mack.com");
1849 EXPECT_EQ("mack.com", GetOmniboxText());
1850
1851 SendDownArrow();
1852 EXPECT_EQ("result 1", GetOmniboxText());
1853
1854 // Press Enter.
1855 browser()->window()->GetLocationBar()->AcceptInput();
1856
1857 // Confirm that the Instant overlay was NOT committed.
1858 EXPECT_NE(overlay, browser()->tab_strip_model()->GetActiveWebContents());
1859 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/omnibox/omnibox_edit_model.cc ('k') | chrome/test/data/instant_extended.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698