OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/test_runner/text_input_controller.h" | 5 #include "components/test_runner/text_input_controller.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "components/test_runner/web_test_proxy.h" | 8 #include "components/test_runner/web_test_proxy.h" |
9 #include "gin/arguments.h" | 9 #include "gin/arguments.h" |
10 #include "gin/handle.h" | 10 #include "gin/handle.h" |
(...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 return int_array; | 247 return int_array; |
248 } | 248 } |
249 | 249 |
250 void TextInputController::SetComposition(const std::string& text) { | 250 void TextInputController::SetComposition(const std::string& text) { |
251 // Sends a keydown event with key code = 0xE5 to emulate input method | 251 // Sends a keydown event with key code = 0xE5 to emulate input method |
252 // behavior. | 252 // behavior. |
253 blink::WebKeyboardEvent key_down; | 253 blink::WebKeyboardEvent key_down; |
254 key_down.type = blink::WebInputEvent::RawKeyDown; | 254 key_down.type = blink::WebInputEvent::RawKeyDown; |
255 key_down.modifiers = 0; | 255 key_down.modifiers = 0; |
256 key_down.windowsKeyCode = 0xE5; // VKEY_PROCESSKEY | 256 key_down.windowsKeyCode = 0xE5; // VKEY_PROCESSKEY |
257 key_down.setKeyIdentifierFromWindowsKeyCode(); | |
258 view()->handleInputEvent(key_down); | 257 view()->handleInputEvent(key_down); |
259 | 258 |
260 std::vector<blink::WebCompositionUnderline> underlines; | 259 std::vector<blink::WebCompositionUnderline> underlines; |
261 underlines.push_back(blink::WebCompositionUnderline(0, text.length(), | 260 underlines.push_back(blink::WebCompositionUnderline(0, text.length(), |
262 SK_ColorBLACK, false, | 261 SK_ColorBLACK, false, |
263 SK_ColorTRANSPARENT)); | 262 SK_ColorTRANSPARENT)); |
264 view()->setComposition( | 263 view()->setComposition( |
265 blink::WebString::fromUTF8(text), | 264 blink::WebString::fromUTF8(text), |
266 blink::WebVector<blink::WebCompositionUnderline>(underlines), | 265 blink::WebVector<blink::WebCompositionUnderline>(underlines), |
267 text.length(), text.length()); | 266 text.length(), text.length()); |
268 } | 267 } |
269 | 268 |
270 blink::WebView* TextInputController::view() { | 269 blink::WebView* TextInputController::view() { |
271 return web_test_proxy_base_->web_view(); | 270 return web_test_proxy_base_->web_view(); |
272 } | 271 } |
273 | 272 |
274 } // namespace test_runner | 273 } // namespace test_runner |
OLD | NEW |