| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "app/keyboard_codes.h" | 5 #include "app/keyboard_codes.h" |
| 6 #include "base/message_loop.h" | 6 #include "base/message_loop.h" |
| 7 #include "base/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "views/controls/textfield/native_textfield_views.h" | 9 #include "views/controls/textfield/native_textfield_views.h" |
| 10 #include "views/controls/textfield/textfield.h" | 10 #include "views/controls/textfield/textfield.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 if (widget_) | 41 if (widget_) |
| 42 widget_->Close(); | 42 widget_->Close(); |
| 43 } | 43 } |
| 44 | 44 |
| 45 // Textfield::Controller implementation: | 45 // Textfield::Controller implementation: |
| 46 virtual void ContentsChanged(Textfield* sender, | 46 virtual void ContentsChanged(Textfield* sender, |
| 47 const string16& new_contents){ | 47 const string16& new_contents){ |
| 48 last_contents_ = new_contents; | 48 last_contents_ = new_contents; |
| 49 } | 49 } |
| 50 | 50 |
| 51 virtual bool HandleKeystroke(Textfield* sender, | 51 virtual bool HandleKeyEvent(Textfield* sender, |
| 52 const Textfield::Keystroke& keystroke) { | 52 const KeyEvent& key_event) { |
| 53 |
| 53 // TODO(oshima): figure out how to test the keystroke. | 54 // TODO(oshima): figure out how to test the keystroke. |
| 54 return false; | 55 return false; |
| 55 } | 56 } |
| 56 | 57 |
| 57 void InitTextfield(Textfield::StyleFlags style) { | 58 void InitTextfield(Textfield::StyleFlags style) { |
| 58 ASSERT_FALSE(textfield_); | 59 ASSERT_FALSE(textfield_); |
| 59 textfield_ = new Textfield(style); | 60 textfield_ = new Textfield(style); |
| 60 textfield_->SetController(this); | 61 textfield_->SetController(this); |
| 61 widget_ = Widget::CreatePopupWidget( | 62 widget_ = Widget::CreatePopupWidget( |
| 62 Widget::NotTransparent, | 63 Widget::NotTransparent, |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 TEST_F(NativeTextfieldViewsTest, TestOnKeyPressReturnValue) { | 227 TEST_F(NativeTextfieldViewsTest, TestOnKeyPressReturnValue) { |
| 227 InitTextfield(Textfield::STYLE_DEFAULT); | 228 InitTextfield(Textfield::STYLE_DEFAULT); |
| 228 EXPECT_TRUE(SendKeyEventToTextfieldViews(app::VKEY_A)); | 229 EXPECT_TRUE(SendKeyEventToTextfieldViews(app::VKEY_A)); |
| 229 // F24, up/down key won't be handled. | 230 // F24, up/down key won't be handled. |
| 230 EXPECT_FALSE(SendKeyEventToTextfieldViews(app::VKEY_F24)); | 231 EXPECT_FALSE(SendKeyEventToTextfieldViews(app::VKEY_F24)); |
| 231 EXPECT_FALSE(SendKeyEventToTextfieldViews(app::VKEY_UP)); | 232 EXPECT_FALSE(SendKeyEventToTextfieldViews(app::VKEY_UP)); |
| 232 EXPECT_FALSE(SendKeyEventToTextfieldViews(app::VKEY_DOWN)); | 233 EXPECT_FALSE(SendKeyEventToTextfieldViews(app::VKEY_DOWN)); |
| 233 } | 234 } |
| 234 | 235 |
| 235 } // namespace views | 236 } // namespace views |
| OLD | NEW |