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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
10 #include "mojo/public/cpp/bindings/interface_request.h" | 10 #include "mojo/public/cpp/bindings/interface_request.h" |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 | 86 |
87 DISALLOW_COPY_AND_ASSIGN(IMEAppTest); | 87 DISALLOW_COPY_AND_ASSIGN(IMEAppTest); |
88 }; | 88 }; |
89 | 89 |
90 // Tests sending a KeyEvent to the IMEDriver through the Mus IMEServer. | 90 // Tests sending a KeyEvent to the IMEDriver through the Mus IMEServer. |
91 TEST_F(IMEAppTest, ProcessKeyEvent) { | 91 TEST_F(IMEAppTest, ProcessKeyEvent) { |
92 ui::mojom::TextInputClientPtr client_ptr; | 92 ui::mojom::TextInputClientPtr client_ptr; |
93 TestTextInputClient client(MakeRequest(&client_ptr)); | 93 TestTextInputClient client(MakeRequest(&client_ptr)); |
94 | 94 |
95 ui::mojom::InputMethodPtr input_method; | 95 ui::mojom::InputMethodPtr input_method; |
96 ime_server_->StartSession(std::move(client_ptr), MakeRequest(&input_method)); | 96 ime_server_->StartSession(ui::mojom::TextInputClientInformation::New(), |
| 97 std::move(client_ptr), MakeRequest(&input_method)); |
97 | 98 |
98 // Send character key event. | 99 // Send character key event. |
99 ui::KeyEvent char_event('A', ui::VKEY_A, 0); | 100 ui::KeyEvent char_event('A', ui::VKEY_A, 0); |
100 EXPECT_TRUE(ProcessKeyEvent(&input_method, ui::Event::Clone(char_event))); | 101 EXPECT_TRUE(ProcessKeyEvent(&input_method, ui::Event::Clone(char_event))); |
101 | 102 |
102 std::unique_ptr<ui::Event> received_event = client.WaitUntilInsertChar(); | 103 std::unique_ptr<ui::Event> received_event = client.WaitUntilInsertChar(); |
103 ASSERT_TRUE(received_event && received_event->IsKeyEvent()); | 104 ASSERT_TRUE(received_event && received_event->IsKeyEvent()); |
104 | 105 |
105 ui::KeyEvent* received_key_event = received_event->AsKeyEvent(); | 106 ui::KeyEvent* received_key_event = received_event->AsKeyEvent(); |
106 EXPECT_EQ(ui::ET_KEY_PRESSED, received_key_event->type()); | 107 EXPECT_EQ(ui::ET_KEY_PRESSED, received_key_event->type()); |
107 EXPECT_TRUE(received_key_event->is_char()); | 108 EXPECT_TRUE(received_key_event->is_char()); |
108 EXPECT_EQ(char_event.GetCharacter(), received_key_event->GetCharacter()); | 109 EXPECT_EQ(char_event.GetCharacter(), received_key_event->GetCharacter()); |
109 | 110 |
110 // Send non-character key event. | 111 // Send non-character key event. |
111 ui::KeyEvent nonchar_event(ui::ET_KEY_PRESSED, ui::VKEY_LEFT, 0); | 112 ui::KeyEvent nonchar_event(ui::ET_KEY_PRESSED, ui::VKEY_LEFT, 0); |
112 EXPECT_FALSE(ProcessKeyEvent(&input_method, ui::Event::Clone(nonchar_event))); | 113 EXPECT_FALSE(ProcessKeyEvent(&input_method, ui::Event::Clone(nonchar_event))); |
113 } | 114 } |
OLD | NEW |