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

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

Issue 6982055: Draw a NativeTextfieldViews drop location cursor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Combine cursor bounds data members, revise UpdateCursorBoundsAndTextOffset. 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 widget_ = new Widget; 160 widget_ = new Widget;
161 Widget::InitParams params(Widget::InitParams::TYPE_POPUP); 161 Widget::InitParams params(Widget::InitParams::TYPE_POPUP);
162 params.bounds = gfx::Rect(100, 100, 100, 100); 162 params.bounds = gfx::Rect(100, 100, 100, 100);
163 widget_->Init(params); 163 widget_->Init(params);
164 View* container = new View(); 164 View* container = new View();
165 widget_->SetContentsView(container); 165 widget_->SetContentsView(container);
166 container->AddChildView(textfield_); 166 container->AddChildView(textfield_);
167 167
168 textfield_view_ 168 textfield_view_
169 = static_cast<NativeTextfieldViews*>(textfield_->native_wrapper()); 169 = static_cast<NativeTextfieldViews*>(textfield_->native_wrapper());
170 textfield_view_->SetBoundsRect(params.bounds);
170 textfield_->set_id(1); 171 textfield_->set_id(1);
171 172
172 for (int i = 1; i < count; i++) { 173 for (int i = 1; i < count; i++) {
173 Textfield* textfield = new Textfield(style); 174 Textfield* textfield = new Textfield(style);
174 container->AddChildView(textfield); 175 container->AddChildView(textfield);
175 textfield->set_id(i + 1); 176 textfield->set_id(i + 1);
176 } 177 }
177 178
178 DCHECK(textfield_view_); 179 DCHECK(textfield_view_);
179 model_ = textfield_view_->model_.get(); 180 model_ = textfield_view_->model_.get();
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after
1077 EXPECT_STR_EQ("a23", textfield_->text()); 1078 EXPECT_STR_EQ("a23", textfield_->text());
1078 SendKeyEvent(ui::VKEY_B); 1079 SendKeyEvent(ui::VKEY_B);
1079 EXPECT_STR_EQ("ab3", textfield_->text()); 1080 EXPECT_STR_EQ("ab3", textfield_->text());
1080 SendKeyEvent(ui::VKEY_Z, false, true); 1081 SendKeyEvent(ui::VKEY_Z, false, true);
1081 EXPECT_STR_EQ("123", textfield_->text()); 1082 EXPECT_STR_EQ("123", textfield_->text());
1082 SendKeyEvent(ui::VKEY_Y, false, true); 1083 SendKeyEvent(ui::VKEY_Y, false, true);
1083 EXPECT_STR_EQ("ab3", textfield_->text()); 1084 EXPECT_STR_EQ("ab3", textfield_->text());
1084 } 1085 }
1085 1086
1086 } // namespace views 1087 } // namespace views
OLDNEW
« no previous file with comments | « views/controls/textfield/native_textfield_views.cc ('k') | views/controls/textfield/textfield_views_model.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698