| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 return WindowManagerConnection::Get()->connector(); | 70 return WindowManagerConnection::Get()->connector(); |
| 71 } | 71 } |
| 72 | 72 |
| 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 // Disabled as deadlocks. See http://crbug.com/668181. |
| 81 TEST_F(InputMethodMusTest, DISABLED_DispatchKeyEvent) { |
| 81 // test_ime_driver will register itself as the current IMEDriver. It echoes | 82 // test_ime_driver will register itself as the current IMEDriver. It echoes |
| 82 // back the character key events it receives. | 83 // back the character key events it receives. |
| 83 EXPECT_TRUE(connector()->Connect("test_ime_driver")); | 84 EXPECT_TRUE(connector()->Connect("test_ime_driver")); |
| 84 | 85 |
| 85 TestInputMethodDelegate input_method_delegate; | 86 TestInputMethodDelegate input_method_delegate; |
| 86 InputMethodMus input_method(&input_method_delegate, nullptr); | 87 InputMethodMus input_method(&input_method_delegate, nullptr); |
| 87 input_method.Init(connector()); | 88 input_method.Init(connector()); |
| 88 | 89 |
| 89 TestTextInputClient text_input_client; | 90 TestTextInputClient text_input_client; |
| 90 input_method.SetFocusedTextInputClient(&text_input_client); | 91 input_method.SetFocusedTextInputClient(&text_input_client); |
| 91 | 92 |
| 92 ui::KeyEvent key_event('A', ui::VKEY_A, 0); | 93 ui::KeyEvent key_event('A', ui::VKEY_A, 0); |
| 93 input_method.DispatchKeyEvent(&key_event); | 94 input_method.DispatchKeyEvent(&key_event); |
| 94 | 95 |
| 95 ui::KeyEvent* received_event = text_input_client.WaitUntilInputReceieved(); | 96 ui::KeyEvent* received_event = text_input_client.WaitUntilInputReceieved(); |
| 96 EXPECT_EQ(ui::ET_KEY_PRESSED, received_event->type()); | 97 EXPECT_EQ(ui::ET_KEY_PRESSED, received_event->type()); |
| 97 EXPECT_TRUE(received_event->is_char()); | 98 EXPECT_TRUE(received_event->is_char()); |
| 98 EXPECT_EQ(key_event.GetCharacter(), received_event->GetCharacter()); | 99 EXPECT_EQ(key_event.GetCharacter(), received_event->GetCharacter()); |
| 99 } | 100 } |
| 100 | 101 |
| 101 } // namespace views | 102 } // namespace views |
| OLD | NEW |