| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ui/base/ime/input_method_auralinux.h" | 5 #include "ui/base/ime/input_method_auralinux.h" |
| 6 | 6 |
| 7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
| 8 #include "base/strings/string_split.h" | 8 #include "base/strings/string_split.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 } | 80 } |
| 81 | 81 |
| 82 protected: | 82 protected: |
| 83 bool DispatchKeyEvent(const ui::KeyEvent& key_event) override { | 83 bool DispatchKeyEvent(const ui::KeyEvent& key_event) override { |
| 84 if (!is_sync_mode_) { | 84 if (!is_sync_mode_) { |
| 85 actions_.clear(); | 85 actions_.clear(); |
| 86 return eat_key_; | 86 return eat_key_; |
| 87 } | 87 } |
| 88 | 88 |
| 89 for (const auto& action : actions_) { | 89 for (const auto& action : actions_) { |
| 90 std::vector<base::string16> parts; | 90 std::vector<base::string16> parts = base::SplitString( |
| 91 base::SplitString(action, L':', &parts); | 91 action, base::string16(1, ':'), base::TRIM_WHITESPACE, |
| 92 base::SPLIT_WANT_ALL); |
| 92 base::char16 id = parts[0][0]; | 93 base::char16 id = parts[0][0]; |
| 93 base::string16 param; | 94 base::string16 param; |
| 94 if (parts.size() > 1) | 95 if (parts.size() > 1) |
| 95 param = parts[1]; | 96 param = parts[1]; |
| 96 if (id == kActionCommit) { | 97 if (id == kActionCommit) { |
| 97 delegate_->OnCommit(param); | 98 delegate_->OnCommit(param); |
| 98 } else if (id == kActionCompositionStart) { | 99 } else if (id == kActionCompositionStart) { |
| 99 delegate_->OnPreeditStart(); | 100 delegate_->OnPreeditStart(); |
| 100 } else if (id == kActionCompositionUpdate) { | 101 } else if (id == kActionCompositionUpdate) { |
| 101 CompositionText comp; | 102 CompositionText comp; |
| (...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 751 input_method_auralinux_->DispatchKeyEvent(&key); | 752 input_method_auralinux_->DispatchKeyEvent(&key); |
| 752 | 753 |
| 753 test_result_->ExpectAction("textinput:c"); | 754 test_result_->ExpectAction("textinput:c"); |
| 754 test_result_->ExpectAction("keydown:65"); | 755 test_result_->ExpectAction("keydown:65"); |
| 755 test_result_->ExpectAction("keypress:65"); | 756 test_result_->ExpectAction("keypress:65"); |
| 756 test_result_->Verify(); | 757 test_result_->Verify(); |
| 757 } | 758 } |
| 758 | 759 |
| 759 } // namespace | 760 } // namespace |
| 760 } // namespace ui | 761 } // namespace ui |
| OLD | NEW |