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

Unified Diff: chrome/browser/ui/omnibox/omnibox_view_browsertest.cc

Issue 440753003: Omnibox: Make Exact Match Tab-to-Search Work (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix test Created 6 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_provider_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/omnibox/omnibox_view_browsertest.cc
diff --git a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc
index 4ffb3341d2068cd6bb2412f7fd91b5e3791deae5..fea26e0069ed952a26c896567ccba21a998940c8 100644
--- a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc
+++ b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc
@@ -57,6 +57,8 @@ namespace {
const char kSearchKeyword[] = "foo";
const char kSearchKeyword2[] = "footest.com";
const wchar_t kSearchKeywordKeys[] = { ui::VKEY_F, ui::VKEY_O, ui::VKEY_O, 0 };
+const wchar_t kSearchKeywordPrefixKeys[] = { ui::VKEY_F, ui::VKEY_O, 0 };
+const wchar_t kSearchKeywordCompletionKeys[] = { ui::VKEY_O, 0 };
Peter Kasting 2014/08/05 21:03:47 Nit: Since these are only used by SendKeySequence(
Mark P 2014/08/05 22:20:06 Done.
const char kSearchURL[] = "http://www.foo.com/search?q={searchTerms}";
const char kSearchShortName[] = "foo";
const char kSearchText[] = "abc";
@@ -929,8 +931,8 @@ IN_PROC_BROWSER_TEST_F(OmniboxViewTest, MAYBE_AcceptKeywordBySpace) {
ASSERT_NO_FATAL_FAILURE(
AddHistoryEntry(kHistoryFoobar, Time::Now() - TimeDelta::FromHours(1)));
- // Type "foo" to trigger inline autocomplete.
- ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchKeywordKeys));
+ // Type "fo" to trigger inline autocomplete.
+ ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchKeywordPrefixKeys));
ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone());
ASSERT_TRUE(omnibox_view->model()->popup_model()->IsOpen());
ASSERT_NE(search_keyword, omnibox_view->GetText());
@@ -939,6 +941,15 @@ IN_PROC_BROWSER_TEST_F(OmniboxViewTest, MAYBE_AcceptKeywordBySpace) {
ASSERT_FALSE(omnibox_view->model()->is_keyword_hint());
ASSERT_TRUE(omnibox_view->model()->keyword().empty());
+ // Add the "o". Inline autocompletion should still happen, but now we
+ // should also get a keyword hint because we've typed a keyword exactly.
+ ASSERT_NO_FATAL_FAILURE(SendKeySequence(kSearchKeywordCompletionKeys));
+ ASSERT_NO_FATAL_FAILURE(WaitForAutocompleteControllerDone());
+ ASSERT_TRUE(omnibox_view->model()->popup_model()->IsOpen());
+ ASSERT_NE(search_keyword, omnibox_view->GetText());
+ ASSERT_TRUE(omnibox_view->model()->is_keyword_hint());
+ ASSERT_FALSE(omnibox_view->model()->keyword().empty());
+
// Trigger keyword mode by space.
ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_SPACE, 0));
ASSERT_FALSE(omnibox_view->model()->is_keyword_hint());
« no previous file with comments | « chrome/browser/autocomplete/autocomplete_provider_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698