| OLD | NEW | 
| (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_ack_handler.h" | 
 |  11 #include "content/browser/renderer_host/input/mock_input_router_client.h" | 
 |  12 #include "content/public/test/mock_render_process_host.h" | 
 |  13 #include "content/public/test/test_browser_context.h" | 
 |  14 #include "testing/gtest/include/gtest/gtest.h" | 
 |  15 #include "third_party/WebKit/public/web/WebInputEvent.h" | 
 |  16  | 
 |  17 namespace content { | 
 |  18  | 
 |  19 class InputRouter; | 
 |  20 class MockInputRouterClient; | 
 |  21  | 
 |  22 class InputRouterTest : public testing::Test { | 
 |  23  public: | 
 |  24   InputRouterTest(); | 
 |  25   virtual ~InputRouterTest(); | 
 |  26  | 
 |  27  protected: | 
 |  28   // Called on SetUp. | 
 |  29   virtual scoped_ptr<InputRouter> CreateInputRouter(RenderProcessHost* process, | 
 |  30                                                     InputRouterClient* client, | 
 |  31                                                     InputAckHandler* handler, | 
 |  32                                                     int routing_id) = 0; | 
 |  33  | 
 |  34   // testing::Test | 
 |  35   virtual void SetUp() OVERRIDE; | 
 |  36   virtual void TearDown() OVERRIDE; | 
 |  37  | 
 |  38   void SendInputEventACK(WebKit::WebInputEvent::Type type, | 
 |  39                          InputEventAckState ack_result); | 
 |  40   void SimulateKeyboardEvent(WebKit::WebInputEvent::Type type); | 
 |  41   void SimulateWheelEvent(float dX, float dY, int modifiers, bool precise); | 
 |  42   void SimulateMouseMove(int x, int y, int modifiers); | 
 |  43   void SimulateWheelEventWithPhase(WebKit::WebMouseWheelEvent::Phase phase); | 
 |  44   void SimulateGestureEventCore(WebKit::WebInputEvent::Type type, | 
 |  45                             WebKit::WebGestureEvent::SourceDevice sourceDevice, | 
 |  46                             WebKit::WebGestureEvent* gesture_event); | 
 |  47   void SimulateGestureEvent(WebKit::WebInputEvent::Type type, | 
 |  48                             WebKit::WebGestureEvent::SourceDevice sourceDevice); | 
 |  49   void SimulateGestureScrollUpdateEvent(float dX, float dY, int modifiers); | 
 |  50   void SimulateGesturePinchUpdateEvent(float scale, | 
 |  51                                        float anchorX, | 
 |  52                                        float anchorY, | 
 |  53                                        int modifiers); | 
 |  54   void SimulateGestureFlingStartEvent( | 
 |  55       float velocityX, | 
 |  56       float velocityY, | 
 |  57       WebKit::WebGestureEvent::SourceDevice sourceDevice); | 
 |  58   void SimulateTouchEvent(int x, int y); | 
 |  59   void SetTouchTimestamp(base::TimeDelta timestamp); | 
 |  60  | 
 |  61   // Sends a touch event (irrespective of whether the page has a touch-event | 
 |  62   // handler or not). | 
 |  63   void SendTouchEvent(); | 
 |  64  | 
 |  65   int PressTouchPoint(int x, int y); | 
 |  66   void MoveTouchPoint(int index, int x, int y); | 
 |  67   void ReleaseTouchPoint(int index); | 
 |  68  | 
 |  69   scoped_ptr<MockRenderProcessHost> process_; | 
 |  70   scoped_ptr<MockInputRouterClient> client_; | 
 |  71   scoped_ptr<MockInputAckHandler> ack_handler_; | 
 |  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_ | 
| OLD | NEW |