Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(246)

Side by Side Diff: chrome/browser/ui/views/ime_driver/input_method_bridge_chromeos_unittest.cc

Issue 2626983003: IME for Mus: Send TextInputClient information to IMEDriver. (Closed)
Patch Set: . Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 class InputMethodBridgeChromeOSTest : public testing::Test { 98 class InputMethodBridgeChromeOSTest : public testing::Test {
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::TextInputClientInformationPtr client_info =
108 ui::mojom::TextInputClientInformation::New();
109 client_info->text_input_type = ui::TEXT_INPUT_TYPE_TEXT;
110 client_info->text_input_mode = ui::TEXT_INPUT_MODE_DEFAULT;
111 client_info->text_direction = base::i18n::LEFT_TO_RIGHT;
112 client_info->text_input_flags = 0;
113 client_info->caret_bounds = gfx::Rect();
114
107 ui::mojom::TextInputClientPtr client_ptr; 115 ui::mojom::TextInputClientPtr client_ptr;
108 client_ = base::MakeUnique<TestTextInputClient>(MakeRequest(&client_ptr)); 116 client_ = base::MakeUnique<TestTextInputClient>(MakeRequest(&client_ptr));
109 input_method_ = base::MakeUnique<InputMethodBridge>(std::move(client_ptr)); 117 input_method_ = base::MakeUnique<InputMethodBridge>(std::move(client_info),
118 std::move(client_ptr));
110 } 119 }
111 120
112 bool ProcessKeyEvent(std::unique_ptr<ui::Event> event) { 121 bool ProcessKeyEvent(std::unique_ptr<ui::Event> event) {
113 handled_.reset(); 122 handled_.reset();
114 123
115 input_method_->ProcessKeyEvent( 124 input_method_->ProcessKeyEvent(
116 std::move(event), 125 std::move(event),
117 base::Bind(&InputMethodBridgeChromeOSTest::ProcessKeyEventCallback, 126 base::Bind(&InputMethodBridgeChromeOSTest::ProcessKeyEventCallback,
118 base::Unretained(this))); 127 base::Unretained(this)));
119 128
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 201
193 // Test that Ctrl-C, Ctrl-X, and Ctrl-V are not handled. 202 // Test that Ctrl-C, Ctrl-X, and Ctrl-V are not handled.
194 TEST_F(InputMethodBridgeChromeOSTest, ClipboardAccelerators) { 203 TEST_F(InputMethodBridgeChromeOSTest, ClipboardAccelerators) {
195 EXPECT_FALSE(ProcessKeyEvent(UnicodeKeyPress(ui::VKEY_C, ui::DomCode::US_C, 204 EXPECT_FALSE(ProcessKeyEvent(UnicodeKeyPress(ui::VKEY_C, ui::DomCode::US_C,
196 ui::EF_CONTROL_DOWN, 'C'))); 205 ui::EF_CONTROL_DOWN, 'C')));
197 EXPECT_FALSE(ProcessKeyEvent(UnicodeKeyPress(ui::VKEY_X, ui::DomCode::US_X, 206 EXPECT_FALSE(ProcessKeyEvent(UnicodeKeyPress(ui::VKEY_X, ui::DomCode::US_X,
198 ui::EF_CONTROL_DOWN, 'X'))); 207 ui::EF_CONTROL_DOWN, 'X')));
199 EXPECT_FALSE(ProcessKeyEvent(UnicodeKeyPress(ui::VKEY_V, ui::DomCode::US_V, 208 EXPECT_FALSE(ProcessKeyEvent(UnicodeKeyPress(ui::VKEY_V, ui::DomCode::US_V,
200 ui::EF_CONTROL_DOWN, 'V'))); 209 ui::EF_CONTROL_DOWN, 'V')));
201 } 210 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698