Chromium Code Reviews| Index: ui/base/ime/input_method_base.cc |
| diff --git a/ui/base/ime/input_method_base.cc b/ui/base/ime/input_method_base.cc |
| index 282b6c4f9ad5434ab6eef5d541eea02a8245d12b..ec9ce81e171b2ab96a8717aa7c7ea5fb5c64784f 100644 |
| --- a/ui/base/ime/input_method_base.cc |
| +++ b/ui/base/ime/input_method_base.cc |
| @@ -28,6 +28,12 @@ InputMethodBase::~InputMethodBase() { |
| if (ui::IMEBridge::Get() && |
| ui::IMEBridge::Get()->GetInputContextHandler() == this) |
| ui::IMEBridge::Get()->SetInputContextHandler(nullptr); |
| + |
| + if (!key_events_for_testing_.empty()) { |
|
Devlin
2016/06/23 18:43:22
Why not just std::vector<std::unique_ptr<KeyEvent>
Azure Wei
2016/06/24 06:38:19
Done. Updated with ScopedVector.
|
| + for (auto key : key_events_for_testing_) |
| + delete key; |
| + key_events_for_testing_.clear(); |
| + } |
| } |
| void InputMethodBase::SetDelegate(internal::InputMethodDelegate* delegate) { |
| @@ -199,8 +205,19 @@ void InputMethodBase::DeleteSurroundingText(int32_t offset, uint32_t length) {} |
| void InputMethodBase::SendKeyEvent(KeyEvent* event) { |
| sending_key_event_ = true; |
| + if (track_key_events_for_testing_) { |
| + key_events_for_testing_.push_back(new KeyEvent(*event)); |
| + } |
| DispatchKeyEvent(event); |
| sending_key_event_ = false; |
| } |
| +InputMethod* InputMethodBase::GetInputMethod() { |
| + return this; |
| +} |
| + |
| +std::vector<ui::KeyEvent*> InputMethodBase::GetKeyEventsForTesting() { |
| + return key_events_for_testing_; |
| +} |
| + |
| } // namespace ui |