diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-08 01:41:15 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-12-08 01:41:15 +0000 |
commit | 021b078a5f0c1592d26811f31cba302cc51ea930 (patch) | |
tree | 9e146982a42e6b0d2aff135d9cd15234cf1b29e8 /ui/views/controls/textfield/textfield_views_model_unittest.cc | |
parent | 91ebba302ee61d609df3ea775f3d02ad6dc4825a (diff) | |
download | chromium_src-021b078a5f0c1592d26811f31cba302cc51ea930.zip chromium_src-021b078a5f0c1592d26811f31cba302cc51ea930.tar.gz chromium_src-021b078a5f0c1592d26811f31cba302cc51ea930.tar.bz2 |
Don't merge replace edit if previous edit is delete edit.
Enable UndoRedo_CutCopyPasteTest
BUG=103988,97845
TEST=added new UndoRedo_BackspaceThenSetText, enabled CutCopyPasteTest
Review URL: http://codereview.chromium.org/8823007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113525 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/views/controls/textfield/textfield_views_model_unittest.cc')
-rw-r--r-- | ui/views/controls/textfield/textfield_views_model_unittest.cc | 33 |
1 files changed, 25 insertions, 8 deletions
diff --git a/ui/views/controls/textfield/textfield_views_model_unittest.cc b/ui/views/controls/textfield/textfield_views_model_unittest.cc index 585d849..31f6563 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 |