Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(158)

Side by Side Diff: content/browser/renderer_host/input/input_router_unittest.h

Issue 20356003: Provided batched input delivery with a BufferedInputRouter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: BufferedInputRouter unit tests Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
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.
4
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_UNITTEST_H_
6 #define CONTENT_BROWSER_RENDERER_HOST_INPUT_INPUT_ROUTER_UNITTEST_H_
7
8 #include "base/memory/scoped_ptr.h"
9 #include "content/browser/renderer_host/input/input_router_client.h"
10 #include "content/browser/renderer_host/input/mock_input_router_client.h"
11 #include "content/public/test/mock_render_process_host.h"
12 #include "content/public/test/test_browser_context.h"
13 #include "testing/gtest/include/gtest/gtest.h"
14 #include "third_party/WebKit/public/web/WebInputEvent.h"
15
16 namespace content {
17
18 class InputRouter;
19 class MockInputRouterClient;
20
21 class InputRouterTest : public testing::Test, public IPC::Listener {
22 public:
23 InputRouterTest();
24 virtual ~InputRouterTest();
25
26 protected:
27 // Concrete |InputRouter| test implementations should override appropriately.
28 virtual scoped_ptr<InputRouter> CreateInputRouter(RenderProcessHost* process,
29 InputRouterClient* client,
30 int routing_id) = 0;
31
32 // testing::Test
33 virtual void SetUp() OVERRIDE;
34 virtual void TearDown() OVERRIDE;
35
36 // IPC::Listener
37 virtual bool OnMessageReceived(const IPC::Message& listener) OVERRIDE;
38
39 void SendInputEventACK(WebKit::WebInputEvent::Type type,
40 InputEventAckState ack_result);
41 void SimulateKeyboardEvent(WebKit::WebInputEvent::Type type);
42 void SimulateWheelEvent(float dX, float dY, int modifiers, bool precise);
43 void SimulateMouseMove(int x, int y, int modifiers);
44 void SimulateWheelEventWithPhase(WebKit::WebMouseWheelEvent::Phase phase);
45 void SimulateGestureEventCore(WebKit::WebInputEvent::Type type,
46 WebKit::WebGestureEvent::SourceDevice sourceDevice,
47 WebKit::WebGestureEvent* gesture_event);
48 void SimulateGestureEvent(WebKit::WebInputEvent::Type type,
49 WebKit::WebGestureEvent::SourceDevice sourceDevice);
50 void SimulateGestureScrollUpdateEvent(float dX, float dY, int modifiers);
51 void SimulateGesturePinchUpdateEvent(float scale,
52 float anchorX,
53 float anchorY,
54 int modifiers);
55 void SimulateGestureFlingStartEvent(
56 float velocityX,
57 float velocityY,
58 WebKit::WebGestureEvent::SourceDevice sourceDevice);
59 void SimulateTouchEvent(int x, int y);
60 void SetTouchTimestamp(base::TimeDelta timestamp);
61
62 // Sends a touch event (irrespective of whether the page has a touch-event
63 // handler or not).
64 void SendTouchEvent();
65
66 int PressTouchPoint(int x, int y);
67 void MoveTouchPoint(int index, int x, int y);
68 void ReleaseTouchPoint(int index);
69
70 scoped_ptr<MockRenderProcessHost> process_;
71 scoped_ptr<MockInputRouterClient> client_;
72 scoped_ptr<InputRouter> input_router_;
73
74 private:
75 base::MessageLoopForUI message_loop_;
76 WebKit::WebTouchEvent touch_event_;
77
78 scoped_ptr<TestBrowserContext> browser_context_;
79 };
80
81 } // namespace content
82
83 #endif // CONTENT_BROWSER_RENDERER_HOST_INPUT_MOCK_INPUT_ROUTER_UNITTEST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698