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

Side by Side Diff: views/controls/textfield/native_textfield_views_unittest.cc

Issue 7067015: An edit for SetText needs to be merged with previous edit for omnibox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: " Created 9 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/auto_reset.h" 5 #include "base/auto_reset.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/pickle.h" 10 #include "base/pickle.h"
(...skipping 1003 matching lines...) Expand 10 before | Expand all | Expand 10 after
1014 textfield_->SetText(ASCIIToUTF16("123")); 1014 textfield_->SetText(ASCIIToUTF16("123"));
1015 textfield_->SetText(ASCIIToUTF16("123")); 1015 textfield_->SetText(ASCIIToUTF16("123"));
1016 EXPECT_STR_EQ("123", textfield_->text()); 1016 EXPECT_STR_EQ("123", textfield_->text());
1017 SendKeyEvent(ui::VKEY_END, false, false); 1017 SendKeyEvent(ui::VKEY_END, false, false);
1018 SendKeyEvent(ui::VKEY_4, false, false); 1018 SendKeyEvent(ui::VKEY_4, false, false);
1019 EXPECT_STR_EQ("1234", textfield_->text()); 1019 EXPECT_STR_EQ("1234", textfield_->text());
1020 last_contents_.clear(); 1020 last_contents_.clear();
1021 SendKeyEvent(ui::VKEY_Z, false, true); 1021 SendKeyEvent(ui::VKEY_Z, false, true);
1022 EXPECT_STR_EQ("123", textfield_->text()); 1022 EXPECT_STR_EQ("123", textfield_->text());
1023 SendKeyEvent(ui::VKEY_Z, false, true); 1023 SendKeyEvent(ui::VKEY_Z, false, true);
1024 EXPECT_STR_EQ("abc", textfield_->text()); 1024 EXPECT_STR_EQ("ab", textfield_->text());
msw 2011/06/02 10:16:42 sorry, why did this change?
oshima 2011/06/02 19:11:42 edit for "c" is merged with "123", so undoing that
1025 SendKeyEvent(ui::VKEY_Z, false, true); 1025 SendKeyEvent(ui::VKEY_Z, false, true);
1026 EXPECT_STR_EQ("a", textfield_->text());
1027 SendKeyEvent(ui::VKEY_Y, false, true);
1026 EXPECT_STR_EQ("ab", textfield_->text()); 1028 EXPECT_STR_EQ("ab", textfield_->text());
1027 SendKeyEvent(ui::VKEY_Y, false, true); 1029 SendKeyEvent(ui::VKEY_Y, false, true);
1028 EXPECT_STR_EQ("abc", textfield_->text());
1029 SendKeyEvent(ui::VKEY_Y, false, true);
1030 EXPECT_STR_EQ("123", textfield_->text()); 1030 EXPECT_STR_EQ("123", textfield_->text());
1031 SendKeyEvent(ui::VKEY_Y, false, true); 1031 SendKeyEvent(ui::VKEY_Y, false, true);
1032 EXPECT_STR_EQ("1234", textfield_->text()); 1032 EXPECT_STR_EQ("1234", textfield_->text());
1033 1033
1034 // Undoing to the same text shouldn't call ContentsChanged. 1034 // Undoing to the same text shouldn't call ContentsChanged.
1035 SendKeyEvent(ui::VKEY_A, false, true); // select all 1035 SendKeyEvent(ui::VKEY_A, false, true); // select all
1036 SendKeyEvent(ui::VKEY_A); 1036 SendKeyEvent(ui::VKEY_A);
1037 EXPECT_STR_EQ("a", textfield_->text()); 1037 EXPECT_STR_EQ("a", textfield_->text());
1038 SendKeyEvent(ui::VKEY_B); 1038 SendKeyEvent(ui::VKEY_B);
1039 SendKeyEvent(ui::VKEY_C); 1039 SendKeyEvent(ui::VKEY_C);
(...skipping 22 matching lines...) Expand all
1062 EXPECT_STR_EQ("ab", textfield_->text()); 1062 EXPECT_STR_EQ("ab", textfield_->text());
1063 SendKeyEvent(ui::VKEY_Y, false, true); 1063 SendKeyEvent(ui::VKEY_Y, false, true);
1064 EXPECT_STR_EQ("b", textfield_->text()); 1064 EXPECT_STR_EQ("b", textfield_->text());
1065 SendKeyEvent(ui::VKEY_Y, false, true); 1065 SendKeyEvent(ui::VKEY_Y, false, true);
1066 EXPECT_STR_EQ("", textfield_->text()); 1066 EXPECT_STR_EQ("", textfield_->text());
1067 SendKeyEvent(ui::VKEY_Y, false, true); 1067 SendKeyEvent(ui::VKEY_Y, false, true);
1068 EXPECT_STR_EQ("", textfield_->text()); 1068 EXPECT_STR_EQ("", textfield_->text());
1069 1069
1070 // Insert 1070 // Insert
1071 textfield_->SetText(ASCIIToUTF16("123")); 1071 textfield_->SetText(ASCIIToUTF16("123"));
1072 SendKeyEvent(ui::VKEY_HOME);
1072 SendKeyEvent(ui::VKEY_INSERT); 1073 SendKeyEvent(ui::VKEY_INSERT);
1073 SendKeyEvent(ui::VKEY_A); 1074 SendKeyEvent(ui::VKEY_A);
1074 EXPECT_STR_EQ("a23", textfield_->text()); 1075 EXPECT_STR_EQ("a23", textfield_->text());
1075 SendKeyEvent(ui::VKEY_B); 1076 SendKeyEvent(ui::VKEY_B);
1076 EXPECT_STR_EQ("ab3", textfield_->text()); 1077 EXPECT_STR_EQ("ab3", textfield_->text());
1077 SendKeyEvent(ui::VKEY_Z, false, true); 1078 SendKeyEvent(ui::VKEY_Z, false, true);
1078 EXPECT_STR_EQ("123", textfield_->text()); 1079 EXPECT_STR_EQ("123", textfield_->text());
1079 SendKeyEvent(ui::VKEY_Y, false, true); 1080 SendKeyEvent(ui::VKEY_Y, false, true);
1080 EXPECT_STR_EQ("ab3", textfield_->text()); 1081 EXPECT_STR_EQ("ab3", textfield_->text());
1081 } 1082 }
1082 1083
1083 } // namespace views 1084 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698