| 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 1635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1646 event_down.domKey = static_cast<int>( | 1646 event_down.domKey = static_cast<int>( |
| 1647 ui::KeycodeConverter::KeyStringToDomKey(domKeyString)); | 1647 ui::KeycodeConverter::KeyStringToDomKey(domKeyString)); |
| 1648 event_down.domCode = static_cast<int>( | 1648 event_down.domCode = static_cast<int>( |
| 1649 ui::KeycodeConverter::CodeStringToDomCode(domCodeString)); | 1649 ui::KeycodeConverter::CodeStringToDomCode(domCodeString)); |
| 1650 | 1650 |
| 1651 if (generate_char) { | 1651 if (generate_char) { |
| 1652 event_down.text[0] = text; | 1652 event_down.text[0] = text; |
| 1653 event_down.unmodifiedText[0] = text; | 1653 event_down.unmodifiedText[0] = text; |
| 1654 } | 1654 } |
| 1655 | 1655 |
| 1656 event_down.setKeyIdentifierFromWindowsKeyCode(); | |
| 1657 | |
| 1658 if (event_down.modifiers != 0) | 1656 if (event_down.modifiers != 0) |
| 1659 event_down.isSystemKey = IsSystemKeyEvent(event_down); | 1657 event_down.isSystemKey = IsSystemKeyEvent(event_down); |
| 1660 | 1658 |
| 1661 if (needs_shift_key_modifier) | 1659 if (needs_shift_key_modifier) |
| 1662 event_down.modifiers |= WebInputEvent::ShiftKey; | 1660 event_down.modifiers |= WebInputEvent::ShiftKey; |
| 1663 | 1661 |
| 1664 // See if KeyLocation argument is given. | 1662 // See if KeyLocation argument is given. |
| 1665 switch (location) { | 1663 switch (location) { |
| 1666 case DOMKeyLocationStandard: | 1664 case DOMKeyLocationStandard: |
| 1667 break; | 1665 break; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1703 current_pointer_state_[kRawMousePointerId].last_pos_, | 1701 current_pointer_state_[kRawMousePointerId].last_pos_, |
| 1704 GetCurrentEventTimeSec(), click_count_, 0, &event); | 1702 GetCurrentEventTimeSec(), click_count_, 0, &event); |
| 1705 FinishDragAndDrop(event, blink::WebDragOperationNone); | 1703 FinishDragAndDrop(event, blink::WebDragOperationNone); |
| 1706 } | 1704 } |
| 1707 | 1705 |
| 1708 delegate()->ClearEditCommand(); | 1706 delegate()->ClearEditCommand(); |
| 1709 | 1707 |
| 1710 if (generate_char) { | 1708 if (generate_char) { |
| 1711 WebKeyboardEvent event_char = event_up; | 1709 WebKeyboardEvent event_char = event_up; |
| 1712 event_char.type = WebInputEvent::Char; | 1710 event_char.type = WebInputEvent::Char; |
| 1713 // keyIdentifier is an empty string, unless the Enter key was pressed. | |
| 1714 // This behavior is not standard (keyIdentifier itself is not even a | |
| 1715 // standard any more), but it matches the actual behavior in Blink. | |
| 1716 if (code != ui::VKEY_RETURN) | |
| 1717 event_char.keyIdentifier[0] = '\0'; | |
| 1718 HandleInputEventOnViewOrPopup(event_char); | 1711 HandleInputEventOnViewOrPopup(event_char); |
| 1719 } | 1712 } |
| 1720 | 1713 |
| 1721 HandleInputEventOnViewOrPopup(event_up); | 1714 HandleInputEventOnViewOrPopup(event_up); |
| 1722 } | 1715 } |
| 1723 | 1716 |
| 1724 void EventSender::EnableDOMUIEventLogging() {} | 1717 void EventSender::EnableDOMUIEventLogging() {} |
| 1725 | 1718 |
| 1726 void EventSender::FireKeyboardEventsToElement() {} | 1719 void EventSender::FireKeyboardEventsToElement() {} |
| 1727 | 1720 |
| (...skipping 1136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2864 } | 2857 } |
| 2865 | 2858 |
| 2866 std::unique_ptr<WebInputEvent> EventSender::ScaleEvent( | 2859 std::unique_ptr<WebInputEvent> EventSender::ScaleEvent( |
| 2867 const WebInputEvent& event) { | 2860 const WebInputEvent& event) { |
| 2868 // ui::ScaleWebInputEvent returns nullptr when the scale is 1.0f as the event | 2861 // ui::ScaleWebInputEvent returns nullptr when the scale is 1.0f as the event |
| 2869 // does not have to be converted. | 2862 // does not have to be converted. |
| 2870 return ui::ScaleWebInputEvent(event, delegate()->GetWindowToViewportScale()); | 2863 return ui::ScaleWebInputEvent(event, delegate()->GetWindowToViewportScale()); |
| 2871 } | 2864 } |
| 2872 | 2865 |
| 2873 } // namespace test_runner | 2866 } // namespace test_runner |
| OLD | NEW |