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

Side by Side Diff: ui/views/controls/textfield/textfield_unittest.cc

Issue 2399863002: views: call UpdateAfterChange() in Textfield::InsertOrReplaceText(). (Closed)
Patch Set: use TextfieldTestApi Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « ui/views/controls/textfield/textfield_test_api.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/controls/textfield/textfield.h" 5 #include "ui/views/controls/textfield/textfield.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <set> 10 #include <set>
(...skipping 2822 matching lines...) Expand 10 before | Expand all | Expand 10 after
2833 // The controller assumes ownership of the textfield. 2833 // The controller assumes ownership of the textfield.
2834 TextfieldDestroyerController controller(textfield_); 2834 TextfieldDestroyerController controller(textfield_);
2835 EXPECT_TRUE(controller.target()); 2835 EXPECT_TRUE(controller.target());
2836 2836
2837 // Send a key to trigger OnKeyEvent(). 2837 // Send a key to trigger OnKeyEvent().
2838 SendKeyEvent(ui::VKEY_RETURN); 2838 SendKeyEvent(ui::VKEY_RETURN);
2839 2839
2840 EXPECT_FALSE(controller.target()); 2840 EXPECT_FALSE(controller.target());
2841 } 2841 }
2842 2842
2843 TEST_F(TextfieldTest, CursorBlinkRestartsOnInsertOrReplace) {
2844 InitTextfield();
2845 textfield_->SetText(ASCIIToUTF16("abc"));
2846 EXPECT_TRUE(test_api_->IsCursorBlinkTimerRunning());
2847 textfield_->SelectRange(gfx::Range(1, 2));
2848 EXPECT_FALSE(test_api_->IsCursorBlinkTimerRunning());
2849 textfield_->InsertOrReplaceText(base::ASCIIToUTF16("foo"));
2850 EXPECT_TRUE(test_api_->IsCursorBlinkTimerRunning());
2851 }
2852
2843 class TextfieldTouchSelectionTest : public TextfieldTest { 2853 class TextfieldTouchSelectionTest : public TextfieldTest {
2844 protected: 2854 protected:
2845 // Simulates a complete tap. 2855 // Simulates a complete tap.
2846 void Tap(const gfx::Point& point) { 2856 void Tap(const gfx::Point& point) {
2847 GestureEventForTest begin( 2857 GestureEventForTest begin(
2848 point.x(), point.y(), ui::GestureEventDetails(ui::ET_GESTURE_BEGIN)); 2858 point.x(), point.y(), ui::GestureEventDetails(ui::ET_GESTURE_BEGIN));
2849 textfield_->OnGestureEvent(&begin); 2859 textfield_->OnGestureEvent(&begin);
2850 2860
2851 GestureEventForTest tap_down( 2861 GestureEventForTest tap_down(
2852 point.x(), point.y(), ui::GestureEventDetails(ui::ET_GESTURE_TAP_DOWN)); 2862 point.x(), point.y(), ui::GestureEventDetails(ui::ET_GESTURE_TAP_DOWN));
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
2995 3005
2996 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD); 3006 textfield_->SetTextInputType(ui::TEXT_INPUT_TYPE_PASSWORD);
2997 ui::AXViewState state_protected; 3007 ui::AXViewState state_protected;
2998 textfield_->GetAccessibleState(&state_protected); 3008 textfield_->GetAccessibleState(&state_protected);
2999 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role); 3009 EXPECT_EQ(ui::AX_ROLE_TEXT_FIELD, state_protected.role);
3000 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value); 3010 EXPECT_EQ(ASCIIToUTF16("********"), state_protected.value);
3001 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED)); 3011 EXPECT_TRUE(state_protected.HasStateFlag(ui::AX_STATE_PROTECTED));
3002 } 3012 }
3003 3013
3004 } // namespace views 3014 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/textfield/textfield_test_api.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698