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

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

Issue 8823007: Don't merge replace edit if previous edit is delete edit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix comments Created 9 years 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 | « ui/views/controls/textfield/textfield_views_model.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/controls/textfield/textfield_views_model_unittest.cc
diff --git a/ui/views/controls/textfield/textfield_views_model_unittest.cc b/ui/views/controls/textfield/textfield_views_model_unittest.cc
index 585d8494b7ab479bd0d24281ccd3be076f27761c..31f6563b6035ece403de26e6a754ae879078d739 100644
--- a/ui/views/controls/textfield/textfield_views_model_unittest.cc
+++ b/ui/views/controls/textfield/textfield_views_model_unittest.cc
@@ -1179,14 +1179,31 @@ TEST_F(TextfieldViewsModelTest, UndoRedo_SetText) {
EXPECT_FALSE(model.Redo());
}
-#if defined(USE_AURA) && defined(OS_LINUX)
-// This can be re-enabled when aura on linux has clipboard support.
-// http://crbug.com/97845
-#define MAYBE_UndoRedo_CutCopyPasteTest DISABLED_UndoRedo_CutCopyPasteTest
-#else
-#define MAYBE_UndoRedo_CutCopyPasteTest UndoRedo_CutCopyPasteTest
-#endif
-TEST_F(TextfieldViewsModelTest, MAYBE_UndoRedo_CutCopyPasteTest) {
+TEST_F(TextfieldViewsModelTest, UndoRedo_BackspaceThenSetText) {
+ // This is to test the undo/redo behavior of omnibox.
+ TextfieldViewsModel model(NULL);
+ model.InsertChar('w');
+ EXPECT_STR_EQ("w", model.GetText());
+ EXPECT_EQ(1U, model.GetCursorPosition());
+ model.SetText(ASCIIToUTF16("www.google.com"));
+ EXPECT_EQ(1U, model.GetCursorPosition());
+ EXPECT_STR_EQ("www.google.com", model.GetText());
+ model.SetText(ASCIIToUTF16("www.google.com")); // Confirm the text.
+ model.MoveCursorRight(gfx::LINE_BREAK, false);
+ EXPECT_EQ(14U, model.GetCursorPosition());
+ EXPECT_TRUE(model.Backspace());
+ EXPECT_TRUE(model.Backspace());
+ EXPECT_STR_EQ("www.google.c", model.GetText());
+ // Autocomplete sets the text
+ model.SetText(ASCIIToUTF16("www.google.com/search=www.google.c"));
+ EXPECT_STR_EQ("www.google.com/search=www.google.c", model.GetText());
+ EXPECT_TRUE(model.Undo());
+ EXPECT_STR_EQ("www.google.c", model.GetText());
+ EXPECT_TRUE(model.Undo());
+ EXPECT_STR_EQ("www.google.com", model.GetText());
+}
+
+TEST_F(TextfieldViewsModelTest, UndoRedo_CutCopyPasteTest) {
TextfieldViewsModel model(NULL);
model.SetText(ASCIIToUTF16("ABCDE"));
EXPECT_FALSE(model.Redo()); // nothing to redo
« no previous file with comments | « ui/views/controls/textfield/textfield_views_model.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698