1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #ifndef CONTENT_COMMON_INPUT_SYNTHETIC_WEB_INPUT_EVENT_BUILDERS_H_
6 #define CONTENT_COMMON_INPUT_SYNTHETIC_WEB_INPUT_EVENT_BUILDERS_H_
8 #include "base/time/time.h"
9 #include "content/common/content_export.h"
10 #include "third_party/WebKit/public/web/WebInputEvent.h"
12 // Provides sensible creation of default WebInputEvents for testing purposes.
16 class CONTENT_EXPORT SyntheticWebMouseEventBuilder
{
18 static blink::WebMouseEvent
Build(blink::WebInputEvent::Type type
);
19 static blink::WebMouseEvent
Build(blink::WebInputEvent::Type type
,
25 class CONTENT_EXPORT SyntheticWebMouseWheelEventBuilder
{
27 static blink::WebMouseWheelEvent
Build(
28 blink::WebMouseWheelEvent::Phase phase
);
29 static blink::WebMouseWheelEvent
Build(float dx
,
35 class CONTENT_EXPORT SyntheticWebKeyboardEventBuilder
{
37 static blink::WebKeyboardEvent
Build(blink::WebInputEvent::Type type
);
40 class CONTENT_EXPORT SyntheticWebGestureEventBuilder
{
42 static blink::WebGestureEvent
Build(blink::WebInputEvent::Type type
,
43 blink::WebGestureDevice source_device
);
44 static blink::WebGestureEvent
BuildScrollBegin(float dx_hint
,
46 static blink::WebGestureEvent
BuildScrollUpdate(
50 blink::WebGestureDevice source_device
);
51 static blink::WebGestureEvent
BuildPinchUpdate(
56 blink::WebGestureDevice source_device
);
57 static blink::WebGestureEvent
BuildFling(
60 blink::WebGestureDevice source_device
);
63 class CONTENT_EXPORT SyntheticWebTouchEvent
64 : public NON_EXPORTED_BASE(blink::WebTouchEvent
) {
66 SyntheticWebTouchEvent();
68 // Mark all the points as stationary, and remove any released points.
71 // Adds an additional point to the touch list, returning the point's index.
72 int PressPoint(float x
, float y
);
73 void MovePoint(int index
, float x
, float y
);
74 void ReleasePoint(int index
);
75 void CancelPoint(int index
);
77 void SetTimestamp(base::TimeDelta timestamp
);
80 } // namespace content
82 #endif // CONTENT_COMMON_INPUT_SYNTHETIC_WEB_INPUT_EVENT_BUILDERS_H_