| 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/event_sender.h" | 5 #include "components/test_runner/event_sender.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 1607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1618 event_down.domKey = static_cast<int>( | 1618 event_down.domKey = static_cast<int>( |
| 1619 ui::KeycodeConverter::KeyStringToDomKey(domKeyString)); | 1619 ui::KeycodeConverter::KeyStringToDomKey(domKeyString)); |
| 1620 event_down.domCode = static_cast<int>( | 1620 event_down.domCode = static_cast<int>( |
| 1621 ui::KeycodeConverter::CodeStringToDomCode(domCodeString)); | 1621 ui::KeycodeConverter::CodeStringToDomCode(domCodeString)); |
| 1622 | 1622 |
| 1623 if (generate_char) { | 1623 if (generate_char) { |
| 1624 event_down.text[0] = text; | 1624 event_down.text[0] = text; |
| 1625 event_down.unmodifiedText[0] = text; | 1625 event_down.unmodifiedText[0] = text; |
| 1626 } | 1626 } |
| 1627 | 1627 |
| 1628 event_down.setKeyIdentifierFromWindowsKeyCode(); | |
| 1629 | |
| 1630 if (event_down.modifiers != 0) | 1628 if (event_down.modifiers != 0) |
| 1631 event_down.isSystemKey = IsSystemKeyEvent(event_down); | 1629 event_down.isSystemKey = IsSystemKeyEvent(event_down); |
| 1632 | 1630 |
| 1633 if (needs_shift_key_modifier) | 1631 if (needs_shift_key_modifier) |
| 1634 event_down.modifiers |= WebInputEvent::ShiftKey; | 1632 event_down.modifiers |= WebInputEvent::ShiftKey; |
| 1635 | 1633 |
| 1636 // See if KeyLocation argument is given. | 1634 // See if KeyLocation argument is given. |
| 1637 switch (location) { | 1635 switch (location) { |
| 1638 case DOMKeyLocationStandard: | 1636 case DOMKeyLocationStandard: |
| 1639 break; | 1637 break; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1675 current_pointer_state_[kRawMousePointerId].last_pos_, | 1673 current_pointer_state_[kRawMousePointerId].last_pos_, |
| 1676 GetCurrentEventTimeSec(), click_count_, 0, &event); | 1674 GetCurrentEventTimeSec(), click_count_, 0, &event); |
| 1677 FinishDragAndDrop(event, blink::WebDragOperationNone); | 1675 FinishDragAndDrop(event, blink::WebDragOperationNone); |
| 1678 } | 1676 } |
| 1679 | 1677 |
| 1680 delegate()->ClearEditCommand(); | 1678 delegate()->ClearEditCommand(); |
| 1681 | 1679 |
| 1682 if (generate_char) { | 1680 if (generate_char) { |
| 1683 WebKeyboardEvent event_char = event_up; | 1681 WebKeyboardEvent event_char = event_up; |
| 1684 event_char.type = WebInputEvent::Char; | 1682 event_char.type = WebInputEvent::Char; |
| 1685 // keyIdentifier is an empty string, unless the Enter key was pressed. | |
| 1686 // This behavior is not standard (keyIdentifier itself is not even a | |
| 1687 // standard any more), but it matches the actual behavior in Blink. | |
| 1688 if (code != ui::VKEY_RETURN) | |
| 1689 event_char.keyIdentifier[0] = '\0'; | |
| 1690 HandleInputEventOnViewOrPopup(event_char); | 1683 HandleInputEventOnViewOrPopup(event_char); |
| 1691 } | 1684 } |
| 1692 | 1685 |
| 1693 HandleInputEventOnViewOrPopup(event_up); | 1686 HandleInputEventOnViewOrPopup(event_up); |
| 1694 } | 1687 } |
| 1695 | 1688 |
| 1696 void EventSender::EnableDOMUIEventLogging() {} | 1689 void EventSender::EnableDOMUIEventLogging() {} |
| 1697 | 1690 |
| 1698 void EventSender::FireKeyboardEventsToElement() {} | 1691 void EventSender::FireKeyboardEventsToElement() {} |
| 1699 | 1692 |
| (...skipping 1129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2829 } | 2822 } |
| 2830 | 2823 |
| 2831 std::unique_ptr<WebInputEvent> EventSender::ScaleEvent( | 2824 std::unique_ptr<WebInputEvent> EventSender::ScaleEvent( |
| 2832 const WebInputEvent& event) { | 2825 const WebInputEvent& event) { |
| 2833 // ui::ScaleWebInputEvent returns nullptr when the scale is 1.0f as the event | 2826 // ui::ScaleWebInputEvent returns nullptr when the scale is 1.0f as the event |
| 2834 // does not have to be converted. | 2827 // does not have to be converted. |
| 2835 return ui::ScaleWebInputEvent(event, delegate()->GetWindowToViewportScale()); | 2828 return ui::ScaleWebInputEvent(event, delegate()->GetWindowToViewportScale()); |
| 2836 } | 2829 } |
| 2837 | 2830 |
| 2838 } // namespace test_runner | 2831 } // namespace test_runner |
| OLD | NEW |