| 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/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| 11 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 13 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 14 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
| 16 #include "components/test_runner/mock_spell_check.h" | 16 #include "components/test_runner/mock_spell_check.h" |
| 17 #include "components/test_runner/test_interfaces.h" | 17 #include "components/test_runner/test_interfaces.h" |
| 18 #include "components/test_runner/web_test_delegate.h" | 18 #include "components/test_runner/web_test_delegate.h" |
| 19 #include "components/test_runner/web_test_proxy.h" | 19 #include "components/test_runner/web_test_proxy.h" |
| 20 #include "gin/handle.h" | 20 #include "gin/handle.h" |
| 21 #include "gin/object_template_builder.h" | 21 #include "gin/object_template_builder.h" |
| 22 #include "gin/wrappable.h" | 22 #include "gin/wrappable.h" |
| 23 #include "third_party/WebKit/public/platform/WebPointerProperties.h" |
| 23 #include "third_party/WebKit/public/platform/WebString.h" | 24 #include "third_party/WebKit/public/platform/WebString.h" |
| 24 #include "third_party/WebKit/public/platform/WebVector.h" | 25 #include "third_party/WebKit/public/platform/WebVector.h" |
| 25 #include "third_party/WebKit/public/web/WebContextMenuData.h" | 26 #include "third_party/WebKit/public/web/WebContextMenuData.h" |
| 26 #include "third_party/WebKit/public/web/WebFrame.h" | 27 #include "third_party/WebKit/public/web/WebFrame.h" |
| 27 #include "third_party/WebKit/public/web/WebKit.h" | 28 #include "third_party/WebKit/public/web/WebKit.h" |
| 28 #include "third_party/WebKit/public/web/WebPagePopup.h" | 29 #include "third_party/WebKit/public/web/WebPagePopup.h" |
| 29 #include "third_party/WebKit/public/web/WebView.h" | 30 #include "third_party/WebKit/public/web/WebView.h" |
| 30 #include "ui/events/keycodes/dom/keycode_converter.h" | 31 #include "ui/events/keycodes/dom/keycode_converter.h" |
| 31 #include "ui/events/keycodes/keyboard_codes.h" | 32 #include "ui/events/keycodes/keyboard_codes.h" |
| 32 #include "v8/include/v8.h" | 33 #include "v8/include/v8.h" |
| 33 | 34 |
| 34 using blink::WebContextMenuData; | 35 using blink::WebContextMenuData; |
| 35 using blink::WebDragData; | 36 using blink::WebDragData; |
| 36 using blink::WebDragOperationsMask; | 37 using blink::WebDragOperationsMask; |
| 37 using blink::WebFloatPoint; | 38 using blink::WebFloatPoint; |
| 38 using blink::WebFrame; | 39 using blink::WebFrame; |
| 39 using blink::WebGestureEvent; | 40 using blink::WebGestureEvent; |
| 40 using blink::WebInputEvent; | 41 using blink::WebInputEvent; |
| 41 using blink::WebInputEventResult; | 42 using blink::WebInputEventResult; |
| 42 using blink::WebKeyboardEvent; | 43 using blink::WebKeyboardEvent; |
| 43 using blink::WebMenuItemInfo; | 44 using blink::WebMenuItemInfo; |
| 44 using blink::WebMouseEvent; | 45 using blink::WebMouseEvent; |
| 45 using blink::WebMouseWheelEvent; | 46 using blink::WebMouseWheelEvent; |
| 46 using blink::WebPagePopup; | 47 using blink::WebPagePopup; |
| 47 using blink::WebPoint; | 48 using blink::WebPoint; |
| 49 using blink::WebPointerProperties; |
| 48 using blink::WebString; | 50 using blink::WebString; |
| 49 using blink::WebTouchEvent; | 51 using blink::WebTouchEvent; |
| 50 using blink::WebTouchPoint; | 52 using blink::WebTouchPoint; |
| 51 using blink::WebVector; | 53 using blink::WebVector; |
| 52 using blink::WebView; | 54 using blink::WebView; |
| 53 | 55 |
| 54 namespace test_runner { | 56 namespace test_runner { |
| 55 | 57 |
| 56 namespace { | 58 namespace { |
| 57 | 59 |
| (...skipping 1832 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1890 // need/want that. | 1892 // need/want that. |
| 1891 is_drag_mode_ = false; | 1893 is_drag_mode_ = false; |
| 1892 | 1894 |
| 1893 // Make the rest of eventSender think a drag is in progress. | 1895 // Make the rest of eventSender think a drag is in progress. |
| 1894 pressed_button_ = WebMouseEvent::ButtonLeft; | 1896 pressed_button_ = WebMouseEvent::ButtonLeft; |
| 1895 current_buttons_ |= GetWebMouseEventModifierForButton(pressed_button_); | 1897 current_buttons_ |= GetWebMouseEventModifierForButton(pressed_button_); |
| 1896 } | 1898 } |
| 1897 | 1899 |
| 1898 void EventSender::AddTouchPoint(float x, float y, gin::Arguments* args) { | 1900 void EventSender::AddTouchPoint(float x, float y, gin::Arguments* args) { |
| 1899 WebTouchPoint touch_point; | 1901 WebTouchPoint touch_point; |
| 1902 touch_point.pointerType = WebPointerProperties::PointerType::Touch; |
| 1900 touch_point.state = WebTouchPoint::StatePressed; | 1903 touch_point.state = WebTouchPoint::StatePressed; |
| 1901 touch_point.position = WebFloatPoint(x, y); | 1904 touch_point.position = WebFloatPoint(x, y); |
| 1902 touch_point.screenPosition = touch_point.position; | 1905 touch_point.screenPosition = touch_point.position; |
| 1903 | 1906 |
| 1904 int highest_id = -1; | 1907 int highest_id = -1; |
| 1905 for (size_t i = 0; i < touch_points_.size(); i++) { | 1908 for (size_t i = 0; i < touch_points_.size(); i++) { |
| 1906 if (touch_points_[i].id > highest_id) | 1909 if (touch_points_[i].id > highest_id) |
| 1907 highest_id = touch_points_[i].id; | 1910 highest_id = touch_points_[i].id; |
| 1908 } | 1911 } |
| 1909 touch_point.id = highest_id + 1; | 1912 touch_point.id = highest_id + 1; |
| (...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2675 last_event_timestamp_ = event.timeStampSeconds; | 2678 last_event_timestamp_ = event.timeStampSeconds; |
| 2676 | 2679 |
| 2677 if (WebPagePopup* popup = view_->pagePopup()) { | 2680 if (WebPagePopup* popup = view_->pagePopup()) { |
| 2678 if (!WebInputEvent::isKeyboardEventType(event.type)) | 2681 if (!WebInputEvent::isKeyboardEventType(event.type)) |
| 2679 return popup->handleInputEvent(event); | 2682 return popup->handleInputEvent(event); |
| 2680 } | 2683 } |
| 2681 return view_->handleInputEvent(event); | 2684 return view_->handleInputEvent(event); |
| 2682 } | 2685 } |
| 2683 | 2686 |
| 2684 } // namespace test_runner | 2687 } // namespace test_runner |
| OLD | NEW |