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

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

Issue 1855423003: Interpret '?' and Ctrl-K or Ctrl-E as putting omnibox in keyword search mode for Default Search Pro… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add includes for mac tests Created 4 years, 6 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
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 a466fb03a677f145e02af40c60337c6472a36bee..60e5b315cb92a5bf39b57045a3ea64f700561713 100644
--- a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc
+++ b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc
@@ -869,6 +869,28 @@ IN_PROC_BROWSER_TEST_F(OmniboxViewTest, BasicTextOperations) {
EXPECT_EQ(old_text.size(), end);
}
+IN_PROC_BROWSER_TEST_F(OmniboxViewTest, AcceptKeywordByTypingQuestionMark) {
+ OmniboxView* omnibox_view = NULL;
+ ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view));
+
+ base::string16 search_keyword(ASCIIToUTF16(kSearchKeyword));
+
+ // If the user gets into keyword mode by typing '?', they should be put into
+ // keyword mode for their default search provider.
+ ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_OEM_2, ui::EF_SHIFT_DOWN));
+ ASSERT_FALSE(omnibox_view->model()->is_keyword_hint());
+ ASSERT_TRUE(omnibox_view->model()->is_keyword_selected());
+ ASSERT_EQ(search_keyword, omnibox_view->model()->keyword());
+ ASSERT_EQ(base::string16(), omnibox_view->GetText());
+
+ // If the user press backspace, they should be left with '?' in the omnibox.
+ ASSERT_NO_FATAL_FAILURE(SendKey(ui::VKEY_BACK, 0));
+ EXPECT_EQ(base::ASCIIToUTF16("?"), omnibox_view->GetText());
+ EXPECT_EQ(base::string16(), omnibox_view->model()->keyword());
+ EXPECT_FALSE(omnibox_view->model()->is_keyword_hint());
+ EXPECT_FALSE(omnibox_view->model()->is_keyword_selected());
+}
+
IN_PROC_BROWSER_TEST_F(OmniboxViewTest, AcceptKeywordBySpace) {
OmniboxView* omnibox_view = NULL;
ASSERT_NO_FATAL_FAILURE(GetOmniboxView(&omnibox_view));
« no previous file with comments | « chrome/browser/ui/location_bar/location_bar.h ('k') | chrome/browser/ui/search/instant_extended_interactive_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698