| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/views/mus/input_method_mus.h" | 5 #include "ui/views/mus/input_method_mus.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 private: | 73 private: |
| 74 base::MessageLoop message_loop_; | 74 base::MessageLoop message_loop_; |
| 75 ScopedViewsTestHelper helper_; | 75 ScopedViewsTestHelper helper_; |
| 76 | 76 |
| 77 DISALLOW_COPY_AND_ASSIGN(InputMethodMusTest); | 77 DISALLOW_COPY_AND_ASSIGN(InputMethodMusTest); |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 TEST_F(InputMethodMusTest, DispatchKeyEvent) { | 80 TEST_F(InputMethodMusTest, DispatchKeyEvent) { |
| 81 // test_ime_driver will register itself as the current IMEDriver. It echoes | 81 // test_ime_driver will register itself as the current IMEDriver. It echoes |
| 82 // back the character key events it receives. | 82 // back the character key events it receives. |
| 83 EXPECT_TRUE(connector()->Connect("mojo:test_ime_driver")); | 83 EXPECT_TRUE(connector()->Connect("service:test_ime_driver")); |
| 84 | 84 |
| 85 TestInputMethodDelegate input_method_delegate; | 85 TestInputMethodDelegate input_method_delegate; |
| 86 InputMethodMus input_method(&input_method_delegate, nullptr); | 86 InputMethodMus input_method(&input_method_delegate, nullptr); |
| 87 input_method.Init(connector()); | 87 input_method.Init(connector()); |
| 88 | 88 |
| 89 TestTextInputClient text_input_client; | 89 TestTextInputClient text_input_client; |
| 90 input_method.SetFocusedTextInputClient(&text_input_client); | 90 input_method.SetFocusedTextInputClient(&text_input_client); |
| 91 | 91 |
| 92 ui::KeyEvent key_event('A', ui::VKEY_A, 0); | 92 ui::KeyEvent key_event('A', ui::VKEY_A, 0); |
| 93 input_method.DispatchKeyEvent(&key_event); | 93 input_method.DispatchKeyEvent(&key_event); |
| 94 | 94 |
| 95 ui::KeyEvent* received_event = text_input_client.WaitUntilInputReceieved(); | 95 ui::KeyEvent* received_event = text_input_client.WaitUntilInputReceieved(); |
| 96 EXPECT_EQ(ui::ET_KEY_PRESSED, received_event->type()); | 96 EXPECT_EQ(ui::ET_KEY_PRESSED, received_event->type()); |
| 97 EXPECT_TRUE(received_event->is_char()); | 97 EXPECT_TRUE(received_event->is_char()); |
| 98 EXPECT_EQ(key_event.GetCharacter(), received_event->GetCharacter()); | 98 EXPECT_EQ(key_event.GetCharacter(), received_event->GetCharacter()); |
| 99 } | 99 } |
| 100 | 100 |
| 101 } // namespace views | 101 } // namespace views |
| OLD | NEW |