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

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: Really removed call to UpdatePopup Created 4 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 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..179332ea2a59e215889f014446763c6828b10c8b 100644
--- a/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc
+++ b/chrome/browser/ui/omnibox/omnibox_view_browsertest.cc
@@ -869,6 +869,29 @@ 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. If they press backspace,
+ // they should be left with '?' in the omnibox.
Peter Kasting 2016/06/01 01:07:27 Nit: The second sentence here really belongs as pa
Tom (Use chromium acct) 2016/06/02 19:24:40 Done.
+ 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());
+
+ // The user presses backspace.
+ 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));

Powered by Google App Engine
This is Rietveld 408576698