OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_chromeos.h" | 5 #include "ui/base/ime/input_method_chromeos.h" |
6 | 6 |
| 7 #include <X11/Xlib.h> |
7 #include <stddef.h> | 8 #include <stddef.h> |
8 #include <stdint.h> | 9 #include <stdint.h> |
9 #include <X11/Xlib.h> | 10 |
| 11 #include <memory> |
10 #undef Bool | 12 #undef Bool |
11 #undef FocusIn | 13 #undef FocusIn |
12 #undef FocusOut | 14 #undef FocusOut |
13 #undef None | 15 #undef None |
14 | 16 |
15 #include <cstring> | 17 #include <cstring> |
16 | 18 |
17 #include "base/i18n/char_iterator.h" | 19 #include "base/i18n/char_iterator.h" |
18 #include "base/macros.h" | 20 #include "base/macros.h" |
19 #include "base/memory/scoped_ptr.h" | |
20 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
21 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
22 #include "ui/base/ime/chromeos/mock_ime_candidate_window_handler.h" | 23 #include "ui/base/ime/chromeos/mock_ime_candidate_window_handler.h" |
23 #include "ui/base/ime/chromeos/mock_ime_engine_handler.h" | 24 #include "ui/base/ime/chromeos/mock_ime_engine_handler.h" |
24 #include "ui/base/ime/composition_text.h" | 25 #include "ui/base/ime/composition_text.h" |
25 #include "ui/base/ime/dummy_text_input_client.h" | 26 #include "ui/base/ime/dummy_text_input_client.h" |
26 #include "ui/base/ime/ime_bridge.h" | 27 #include "ui/base/ime/ime_bridge.h" |
27 #include "ui/base/ime/ime_engine_handler_interface.h" | 28 #include "ui/base/ime/ime_engine_handler_interface.h" |
28 #include "ui/base/ime/input_method_delegate.h" | 29 #include "ui/base/ime/input_method_delegate.h" |
29 #include "ui/base/ime/text_input_client.h" | 30 #include "ui/base/ime/text_input_client.h" |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 inserted_char_ = 0; | 303 inserted_char_ = 0; |
303 inserted_char_flags_ = 0; | 304 inserted_char_flags_ = 0; |
304 on_input_method_changed_call_count_ = 0; | 305 on_input_method_changed_call_count_ = 0; |
305 | 306 |
306 input_type_ = TEXT_INPUT_TYPE_NONE; | 307 input_type_ = TEXT_INPUT_TYPE_NONE; |
307 input_mode_ = TEXT_INPUT_MODE_DEFAULT; | 308 input_mode_ = TEXT_INPUT_MODE_DEFAULT; |
308 can_compose_inline_ = true; | 309 can_compose_inline_ = true; |
309 caret_bounds_ = gfx::Rect(); | 310 caret_bounds_ = gfx::Rect(); |
310 } | 311 } |
311 | 312 |
312 scoped_ptr<TestableInputMethodChromeOS> ime_; | 313 std::unique_ptr<TestableInputMethodChromeOS> ime_; |
313 | 314 |
314 // Copy of the dispatched key event. | 315 // Copy of the dispatched key event. |
315 ui::KeyEvent dispatched_key_event_; | 316 ui::KeyEvent dispatched_key_event_; |
316 | 317 |
317 // Variables for remembering the parameters that are passed to | 318 // Variables for remembering the parameters that are passed to |
318 // ui::TextInputClient functions. | 319 // ui::TextInputClient functions. |
319 CompositionText composition_text_; | 320 CompositionText composition_text_; |
320 CompositionText confirmed_text_; | 321 CompositionText confirmed_text_; |
321 base::string16 inserted_text_; | 322 base::string16 inserted_text_; |
322 base::char16 inserted_char_; | 323 base::char16 inserted_char_; |
323 unsigned int on_input_method_changed_call_count_; | 324 unsigned int on_input_method_changed_call_count_; |
324 int inserted_char_flags_; | 325 int inserted_char_flags_; |
325 | 326 |
326 // Variables that will be returned from the ui::TextInputClient functions. | 327 // Variables that will be returned from the ui::TextInputClient functions. |
327 TextInputType input_type_; | 328 TextInputType input_type_; |
328 TextInputMode input_mode_; | 329 TextInputMode input_mode_; |
329 bool can_compose_inline_; | 330 bool can_compose_inline_; |
330 gfx::Rect caret_bounds_; | 331 gfx::Rect caret_bounds_; |
331 gfx::Range text_range_; | 332 gfx::Range text_range_; |
332 gfx::Range selection_range_; | 333 gfx::Range selection_range_; |
333 base::string16 surrounding_text_; | 334 base::string16 surrounding_text_; |
334 | 335 |
335 scoped_ptr<chromeos::MockIMEEngineHandler> mock_ime_engine_handler_; | 336 std::unique_ptr<chromeos::MockIMEEngineHandler> mock_ime_engine_handler_; |
336 scoped_ptr<chromeos::MockIMECandidateWindowHandler> | 337 std::unique_ptr<chromeos::MockIMECandidateWindowHandler> |
337 mock_ime_candidate_window_handler_; | 338 mock_ime_candidate_window_handler_; |
338 | 339 |
339 bool stop_propagation_post_ime_; | 340 bool stop_propagation_post_ime_; |
340 | 341 |
341 DISALLOW_COPY_AND_ASSIGN(InputMethodChromeOSTest); | 342 DISALLOW_COPY_AND_ASSIGN(InputMethodChromeOSTest); |
342 }; | 343 }; |
343 | 344 |
344 // Tests public APIs in ui::InputMethod first. | 345 // Tests public APIs in ui::InputMethod first. |
345 | 346 |
346 TEST_F(InputMethodChromeOSTest, GetInputLocale) { | 347 TEST_F(InputMethodChromeOSTest, GetInputLocale) { |
(...skipping 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
968 | 969 |
969 EXPECT_EQ(ET_KEY_PRESSED, key_event.type()); | 970 EXPECT_EQ(ET_KEY_PRESSED, key_event.type()); |
970 EXPECT_EQ(VKEY_PROCESSKEY, key_event.key_code()); | 971 EXPECT_EQ(VKEY_PROCESSKEY, key_event.key_code()); |
971 EXPECT_EQ(eventA.code(), key_event.code()); | 972 EXPECT_EQ(eventA.code(), key_event.code()); |
972 EXPECT_EQ(eventA.flags(), key_event.flags()); | 973 EXPECT_EQ(eventA.flags(), key_event.flags()); |
973 EXPECT_EQ(eventA.GetDomKey(), key_event.GetDomKey()); | 974 EXPECT_EQ(eventA.GetDomKey(), key_event.GetDomKey()); |
974 EXPECT_EQ(eventA.time_stamp(), key_event.time_stamp()); | 975 EXPECT_EQ(eventA.time_stamp(), key_event.time_stamp()); |
975 } | 976 } |
976 | 977 |
977 } // namespace ui | 978 } // namespace ui |
OLD | NEW |