OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <X11/Xlib.h> | 5 #include <X11/Xlib.h> |
6 #undef Bool | 6 #undef Bool |
7 #undef FocusIn | 7 #undef FocusIn |
8 #undef FocusOut | 8 #undef FocusOut |
9 #undef None | 9 #undef None |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "chromeos/ime/mock_ime_candidate_window_handler.h" | 21 #include "chromeos/ime/mock_ime_candidate_window_handler.h" |
22 #include "chromeos/ime/mock_ime_engine_handler.h" | 22 #include "chromeos/ime/mock_ime_engine_handler.h" |
23 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
24 #include "ui/base/ime/input_method_delegate.h" | 24 #include "ui/base/ime/input_method_delegate.h" |
25 #include "ui/base/ime/input_method_ibus.h" | 25 #include "ui/base/ime/input_method_ibus.h" |
26 #include "ui/base/ime/text_input_client.h" | 26 #include "ui/base/ime/text_input_client.h" |
27 #include "ui/gfx/rect.h" | 27 #include "ui/gfx/rect.h" |
28 | 28 |
29 namespace ui { | 29 namespace ui { |
30 namespace { | 30 namespace { |
31 const int kCreateInputContextMaxTrialCount = 10; | |
32 const uint32 kTestIBusKeyVal1 = 97; | 31 const uint32 kTestIBusKeyVal1 = 97; |
33 const uint32 kTestIBusKeyVal2 = 30; | 32 const uint32 kTestIBusKeyVal2 = 30; |
34 const uint32 kTestIBusKeyVal3 = 0; | |
35 const uint32 kTestIBusKeyCode1 = 98; | 33 const uint32 kTestIBusKeyCode1 = 98; |
36 const uint32 kTestIBusKeyCode2 = 48; | 34 const uint32 kTestIBusKeyCode2 = 48; |
37 const uint32 kTestIBusKeyCode3 = 1; | |
38 const uint32 kTestIBusState1 = 99; | 35 const uint32 kTestIBusState1 = 99; |
39 const uint32 kTestIBusState2 = 46; | 36 const uint32 kTestIBusState2 = 46; |
40 const uint32 kTestIBusState3 = 8; | |
41 | 37 |
42 typedef chromeos::IBusEngineHandlerInterface::KeyEventDoneCallback | 38 typedef chromeos::IBusEngineHandlerInterface::KeyEventDoneCallback |
43 KeyEventCallback; | 39 KeyEventCallback; |
44 | 40 |
45 uint32 GetOffsetInUTF16(const std::string& utf8_string, uint32 utf8_offset) { | 41 uint32 GetOffsetInUTF16(const std::string& utf8_string, uint32 utf8_offset) { |
46 string16 utf16_string = UTF8ToUTF16(utf8_string); | 42 string16 utf16_string = UTF8ToUTF16(utf8_string); |
47 DCHECK_LT(utf8_offset, utf16_string.size()); | 43 DCHECK_LT(utf8_offset, utf16_string.size()); |
48 base::i18n::UTF16CharIterator char_iterator(&utf16_string); | 44 base::i18n::UTF16CharIterator char_iterator(&utf16_string); |
49 for (size_t i = 0; i < utf8_offset; ++i) | 45 for (size_t i = 0; i < utf8_offset; ++i) |
50 char_iterator.Advance(); | 46 char_iterator.Advance(); |
(...skipping 1051 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1102 | 1098 |
1103 // Do callback. | 1099 // Do callback. |
1104 mock_ime_engine_handler_->last_passed_callback().Run(true); | 1100 mock_ime_engine_handler_->last_passed_callback().Run(true); |
1105 | 1101 |
1106 EXPECT_EQ(0, ime_->process_key_event_post_ime_call_count()); | 1102 EXPECT_EQ(0, ime_->process_key_event_post_ime_call_count()); |
1107 } | 1103 } |
1108 | 1104 |
1109 // TODO(nona): Introduce ProcessKeyEventPostIME tests(crbug.com/156593). | 1105 // TODO(nona): Introduce ProcessKeyEventPostIME tests(crbug.com/156593). |
1110 | 1106 |
1111 } // namespace ui | 1107 } // namespace ui |
OLD | NEW |