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

Unified Diff: ui/views/controls/textfield/textfield_unittest.cc

Issue 2729133005: Fix: Cursor missing in omnibox after entering a alphabet in NTP 'Search box' (Closed)
Patch Set: Created 3 years, 10 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: ui/views/controls/textfield/textfield_unittest.cc
diff --git a/ui/views/controls/textfield/textfield_unittest.cc b/ui/views/controls/textfield/textfield_unittest.cc
index 45abeecdbe3bf527902236758f8841cefb57b56f..29f81c1713c5883369ef193a75f2d1c2a9e27871 100644
--- a/ui/views/controls/textfield/textfield_unittest.cc
+++ b/ui/views/controls/textfield/textfield_unittest.cc
@@ -396,6 +396,7 @@ class TextfieldTest : public ViewsTestBase, public TextfieldController {
}
void OnAfterUserAction(Textfield* sender) override {
+ textfield_->SetCursorEnabled(true);
++on_after_user_action_;
}
@@ -3112,7 +3113,7 @@ TEST_F(TextfieldTest, AccessiblePasswordTest) {
EXPECT_TRUE(node_data_protected.HasStateFlag(ui::AX_STATE_PROTECTED));
}
-// Test if the cursor visibility is controlled by |cursor_enabled_| in
+// Verifies if the cursor visibility is controlled by |cursor_enabled_| in
// RenderText.
TEST_F(TextfieldTest, CursorVisibility) {
InitTextfield();
@@ -3129,4 +3130,17 @@ TEST_F(TextfieldTest, CursorVisibility) {
EXPECT_TRUE(test_api_->IsCursorVisible());
}
+// Verifies if the cursor visibility is changed to true from false after insert
+// charactor in textfield.
+TEST_F(TextfieldTest, CursorVisibilityChangeAfterInserting) {
+ InitTextfield();
+
+ test_api_->GetRenderText()->SetCursorEnabled(false);
+ textfield_->OnBlur();
+ textfield_->OnFocus();
+ EXPECT_FALSE(test_api_->IsCursorVisible());
+ SendKeyEvent('a');
+ EXPECT_TRUE(test_api_->IsCursorVisible());
+}
+
} // namespace views
« ui/views/controls/textfield/textfield.cc ('K') | « ui/views/controls/textfield/textfield.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698