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/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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 class InputMethodBridgeChromeOSTest : public testing::Test { | 97 class InputMethodBridgeChromeOSTest : public testing::Test { |
98 public: | 98 public: |
99 InputMethodBridgeChromeOSTest() | 99 InputMethodBridgeChromeOSTest() |
100 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) {} | 100 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) {} |
101 ~InputMethodBridgeChromeOSTest() override {} | 101 ~InputMethodBridgeChromeOSTest() override {} |
102 | 102 |
103 void SetUp() override { | 103 void SetUp() override { |
104 ui::IMEBridge::Initialize(); | 104 ui::IMEBridge::Initialize(); |
105 | 105 |
106 ui::mojom::TextInputClientPtr client_ptr; | 106 ui::mojom::TextInputClientPtr client_ptr; |
107 client_ = base::MakeUnique<TestTextInputClient>(GetProxy(&client_ptr)); | 107 client_ = base::MakeUnique<TestTextInputClient>(MakeRequest(&client_ptr)); |
108 input_method_ = base::MakeUnique<InputMethodBridge>(std::move(client_ptr)); | 108 input_method_ = base::MakeUnique<InputMethodBridge>(std::move(client_ptr)); |
109 } | 109 } |
110 | 110 |
111 bool ProcessKeyEvent(std::unique_ptr<ui::Event> event) { | 111 bool ProcessKeyEvent(std::unique_ptr<ui::Event> event) { |
112 handled_.reset(); | 112 handled_.reset(); |
113 | 113 |
114 input_method_->ProcessKeyEvent( | 114 input_method_->ProcessKeyEvent( |
115 std::move(event), | 115 std::move(event), |
116 base::Bind(&InputMethodBridgeChromeOSTest::ProcessKeyEventCallback, | 116 base::Bind(&InputMethodBridgeChromeOSTest::ProcessKeyEventCallback, |
117 base::Unretained(this))); | 117 base::Unretained(this))); |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 191 |
192 // Test that Ctrl-C, Ctrl-X, and Ctrl-V are not handled. | 192 // Test that Ctrl-C, Ctrl-X, and Ctrl-V are not handled. |
193 TEST_F(InputMethodBridgeChromeOSTest, ClipboardAccelerators) { | 193 TEST_F(InputMethodBridgeChromeOSTest, ClipboardAccelerators) { |
194 EXPECT_FALSE(ProcessKeyEvent(UnicodeKeyPress(ui::VKEY_C, ui::DomCode::US_C, | 194 EXPECT_FALSE(ProcessKeyEvent(UnicodeKeyPress(ui::VKEY_C, ui::DomCode::US_C, |
195 ui::EF_CONTROL_DOWN, 'C'))); | 195 ui::EF_CONTROL_DOWN, 'C'))); |
196 EXPECT_FALSE(ProcessKeyEvent(UnicodeKeyPress(ui::VKEY_X, ui::DomCode::US_X, | 196 EXPECT_FALSE(ProcessKeyEvent(UnicodeKeyPress(ui::VKEY_X, ui::DomCode::US_X, |
197 ui::EF_CONTROL_DOWN, 'X'))); | 197 ui::EF_CONTROL_DOWN, 'X'))); |
198 EXPECT_FALSE(ProcessKeyEvent(UnicodeKeyPress(ui::VKEY_V, ui::DomCode::US_V, | 198 EXPECT_FALSE(ProcessKeyEvent(UnicodeKeyPress(ui::VKEY_V, ui::DomCode::US_V, |
199 ui::EF_CONTROL_DOWN, 'V'))); | 199 ui::EF_CONTROL_DOWN, 'V'))); |
200 } | 200 } |
OLD | NEW |