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 = base::SplitString( | 90 std::vector<base::string16> parts; |
91 action, base::string16(1, ':'), base::TRIM_WHITESPACE, | 91 base::SplitString(action, L':', &parts); |
92 base::SPLIT_WANT_ALL); | |
93 base::char16 id = parts[0][0]; | 92 base::char16 id = parts[0][0]; |
94 base::string16 param; | 93 base::string16 param; |
95 if (parts.size() > 1) | 94 if (parts.size() > 1) |
96 param = parts[1]; | 95 param = parts[1]; |
97 if (id == kActionCommit) { | 96 if (id == kActionCommit) { |
98 delegate_->OnCommit(param); | 97 delegate_->OnCommit(param); |
99 } else if (id == kActionCompositionStart) { | 98 } else if (id == kActionCompositionStart) { |
100 delegate_->OnPreeditStart(); | 99 delegate_->OnPreeditStart(); |
101 } else if (id == kActionCompositionUpdate) { | 100 } else if (id == kActionCompositionUpdate) { |
102 CompositionText comp; | 101 CompositionText comp; |
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
752 input_method_auralinux_->DispatchKeyEvent(&key); | 751 input_method_auralinux_->DispatchKeyEvent(&key); |
753 | 752 |
754 test_result_->ExpectAction("textinput:c"); | 753 test_result_->ExpectAction("textinput:c"); |
755 test_result_->ExpectAction("keydown:65"); | 754 test_result_->ExpectAction("keydown:65"); |
756 test_result_->ExpectAction("keypress:65"); | 755 test_result_->ExpectAction("keypress:65"); |
757 test_result_->Verify(); | 756 test_result_->Verify(); |
758 } | 757 } |
759 | 758 |
760 } // namespace | 759 } // namespace |
761 } // namespace ui | 760 } // namespace ui |
OLD | NEW |