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

Unified Diff: chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc

Issue 2729133005: Fix: Cursor missing in omnibox after entering a alphabet in NTP 'Search box' (Closed)
Patch Set: address comments Created 3 years, 9 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 | « no previous file | ui/views/controls/textfield/textfield.h » ('j') | ui/views/controls/textfield/textfield.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc
diff --git a/chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc b/chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc
index ecddfc92950f01ecc82a65d1f4e173ea3834664b..aa8d1be71dad3cc92374509d3808be77b8a1d482 100644
--- a/chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc
+++ b/chrome/browser/ui/views/omnibox/omnibox_view_views_unittest.cc
@@ -183,6 +183,10 @@ class OmniboxViewViewsTest : public testing::Test {
// (i.e. it's been navigated to).
void SetAndEmphasizeText(const std::string& new_text, bool accept_input);
+ bool IsCursorEnabled() const {
+ return test_api_->GetRenderText()->cursor_enabled();
+ }
+
private:
// testing::Test:
void SetUp() override;
@@ -266,6 +270,17 @@ TEST_F(OmniboxViewViewsTest, UpdatePopupCall) {
Range(1));
}
+// Checks that if the text cursor is set to enabled after inserting a single
msw 2017/03/10 21:04:30 nit: no 'if'; cite the bug (and relation to the fa
yiyix 2017/03/13 04:02:16 Done.
+// char to the omnibox.
+TEST_F(OmniboxViewViewsTest, EditTextfield) {
+ omnibox_textfield()->SetCursorEnabled(false);
+ ui::KeyEvent char_event(ui::ET_KEY_PRESSED, ui::VKEY_A, ui::DomCode::US_A, 0,
+ ui::DomKey::FromCharacter('a'),
+ ui::EventTimeForNow());
+ omnibox_textfield()->InsertChar(char_event);
msw 2017/03/10 21:04:30 Should this also have a test for pasting, like the
yiyix 2017/03/13 04:02:16 With the old approach, paste and insert char uses
+ EXPECT_TRUE(IsCursorEnabled());
+}
+
// Test that the scheduled text edit command is cleared when Textfield receives
// a key press event. This ensures that the scheduled text edit command property
// is always in the correct state. Test for http://crbug.com/613948.
« no previous file with comments | « no previous file | ui/views/controls/textfield/textfield.h » ('j') | ui/views/controls/textfield/textfield.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698