| OLD | NEW |
| 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/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 "ui/base/clipboard/clipboard.h" | 9 #include "ui/base/clipboard/clipboard.h" |
| 10 #include "ui/base/clipboard/scoped_clipboard_writer.h" | 10 #include "ui/base/clipboard/scoped_clipboard_writer.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 } | 109 } |
| 110 | 110 |
| 111 protected: | 111 protected: |
| 112 bool SendKeyEventToTextfieldViews(ui::KeyboardCode key_code, | 112 bool SendKeyEventToTextfieldViews(ui::KeyboardCode key_code, |
| 113 bool shift, | 113 bool shift, |
| 114 bool control, | 114 bool control, |
| 115 bool capslock) { | 115 bool capslock) { |
| 116 int flags = (shift ? ui::EF_SHIFT_DOWN : 0) | | 116 int flags = (shift ? ui::EF_SHIFT_DOWN : 0) | |
| 117 (control ? ui::EF_CONTROL_DOWN : 0) | | 117 (control ? ui::EF_CONTROL_DOWN : 0) | |
| 118 (capslock ? ui::EF_CAPS_LOCK_DOWN : 0); | 118 (capslock ? ui::EF_CAPS_LOCK_DOWN : 0); |
| 119 KeyEvent event(ui::ET_KEY_PRESSED, key_code, flags, 1, 0); | 119 KeyEvent event(ui::ET_KEY_PRESSED, key_code, flags); |
| 120 return textfield_->OnKeyPressed(event); | 120 return textfield_->OnKeyPressed(event); |
| 121 } | 121 } |
| 122 | 122 |
| 123 bool SendKeyEventToTextfieldViews(ui::KeyboardCode key_code, | 123 bool SendKeyEventToTextfieldViews(ui::KeyboardCode key_code, |
| 124 bool shift, | 124 bool shift, |
| 125 bool control) { | 125 bool control) { |
| 126 return SendKeyEventToTextfieldViews(key_code, shift, control, false); | 126 return SendKeyEventToTextfieldViews(key_code, shift, control, false); |
| 127 } | 127 } |
| 128 | 128 |
| 129 bool SendKeyEventToTextfieldViews(ui::KeyboardCode key_code) { | 129 bool SendKeyEventToTextfieldViews(ui::KeyboardCode key_code) { |
| (...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 512 // Text field is unmodifiable and selection shouldn't change. | 512 // Text field is unmodifiable and selection shouldn't change. |
| 513 SendKeyEventToTextfieldViews(ui::VKEY_DELETE); | 513 SendKeyEventToTextfieldViews(ui::VKEY_DELETE); |
| 514 EXPECT_STR_EQ(" four five six ", textfield_->GetSelectedText()); | 514 EXPECT_STR_EQ(" four five six ", textfield_->GetSelectedText()); |
| 515 SendKeyEventToTextfieldViews(ui::VKEY_BACK); | 515 SendKeyEventToTextfieldViews(ui::VKEY_BACK); |
| 516 EXPECT_STR_EQ(" four five six ", textfield_->GetSelectedText()); | 516 EXPECT_STR_EQ(" four five six ", textfield_->GetSelectedText()); |
| 517 SendKeyEventToTextfieldViews(ui::VKEY_T); | 517 SendKeyEventToTextfieldViews(ui::VKEY_T); |
| 518 EXPECT_STR_EQ(" four five six ", textfield_->GetSelectedText()); | 518 EXPECT_STR_EQ(" four five six ", textfield_->GetSelectedText()); |
| 519 } | 519 } |
| 520 | 520 |
| 521 } // namespace views | 521 } // namespace views |
| OLD | NEW |