| 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/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 public: | 99 public: |
| 100 InputMethodBridgeChromeOSTest() | 100 InputMethodBridgeChromeOSTest() |
| 101 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) {} | 101 : thread_bundle_(content::TestBrowserThreadBundle::IO_MAINLOOP) {} |
| 102 ~InputMethodBridgeChromeOSTest() override {} | 102 ~InputMethodBridgeChromeOSTest() override {} |
| 103 | 103 |
| 104 void SetUp() override { | 104 void SetUp() override { |
| 105 ui::IMEBridge::Initialize(); | 105 ui::IMEBridge::Initialize(); |
| 106 | 106 |
| 107 ui::mojom::TextInputClientPtr client_ptr; | 107 ui::mojom::TextInputClientPtr client_ptr; |
| 108 client_ = base::MakeUnique<TestTextInputClient>(MakeRequest(&client_ptr)); | 108 client_ = base::MakeUnique<TestTextInputClient>(MakeRequest(&client_ptr)); |
| 109 input_method_ = base::MakeUnique<InputMethodBridge>(std::move(client_ptr)); | 109 input_method_ = base::MakeUnique<InputMethodBridge>( |
| 110 base::MakeUnique<RemoteTextInputClient>( |
| 111 std::move(client_ptr), ui::TEXT_INPUT_TYPE_TEXT, |
| 112 ui::TEXT_INPUT_MODE_DEFAULT, base::i18n::LEFT_TO_RIGHT, 0, |
| 113 gfx::Rect())); |
| 110 } | 114 } |
| 111 | 115 |
| 112 bool ProcessKeyEvent(std::unique_ptr<ui::Event> event) { | 116 bool ProcessKeyEvent(std::unique_ptr<ui::Event> event) { |
| 113 handled_.reset(); | 117 handled_.reset(); |
| 114 | 118 |
| 115 input_method_->ProcessKeyEvent( | 119 input_method_->ProcessKeyEvent( |
| 116 std::move(event), | 120 std::move(event), |
| 117 base::Bind(&InputMethodBridgeChromeOSTest::ProcessKeyEventCallback, | 121 base::Bind(&InputMethodBridgeChromeOSTest::ProcessKeyEventCallback, |
| 118 base::Unretained(this))); | 122 base::Unretained(this))); |
| 119 | 123 |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 | 196 |
| 193 // Test that Ctrl-C, Ctrl-X, and Ctrl-V are not handled. | 197 // Test that Ctrl-C, Ctrl-X, and Ctrl-V are not handled. |
| 194 TEST_F(InputMethodBridgeChromeOSTest, ClipboardAccelerators) { | 198 TEST_F(InputMethodBridgeChromeOSTest, ClipboardAccelerators) { |
| 195 EXPECT_FALSE(ProcessKeyEvent(UnicodeKeyPress(ui::VKEY_C, ui::DomCode::US_C, | 199 EXPECT_FALSE(ProcessKeyEvent(UnicodeKeyPress(ui::VKEY_C, ui::DomCode::US_C, |
| 196 ui::EF_CONTROL_DOWN, 'C'))); | 200 ui::EF_CONTROL_DOWN, 'C'))); |
| 197 EXPECT_FALSE(ProcessKeyEvent(UnicodeKeyPress(ui::VKEY_X, ui::DomCode::US_X, | 201 EXPECT_FALSE(ProcessKeyEvent(UnicodeKeyPress(ui::VKEY_X, ui::DomCode::US_X, |
| 198 ui::EF_CONTROL_DOWN, 'X'))); | 202 ui::EF_CONTROL_DOWN, 'X'))); |
| 199 EXPECT_FALSE(ProcessKeyEvent(UnicodeKeyPress(ui::VKEY_V, ui::DomCode::US_V, | 203 EXPECT_FALSE(ProcessKeyEvent(UnicodeKeyPress(ui::VKEY_V, ui::DomCode::US_V, |
| 200 ui::EF_CONTROL_DOWN, 'V'))); | 204 ui::EF_CONTROL_DOWN, 'V'))); |
| 201 } | 205 } |
| OLD | NEW |