1 // Copyright (c) 2012 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 PPAPI_TESTS_TEST_INPUT_EVENT_H_
6 #define PPAPI_TESTS_TEST_INPUT_EVENT_H_
11 #include "ppapi/c/ppb_input_event.h"
12 #include "ppapi/c/dev/ppb_testing_dev.h"
13 #include "ppapi/cpp/input_event.h"
14 #include "ppapi/cpp/point.h"
15 #include "ppapi/cpp/rect.h"
16 #include "ppapi/tests/test_case.h"
18 class TestInputEvent
: public TestCase
{
20 explicit TestInputEvent(TestingInstance
* instance
);
23 virtual bool HandleInputEvent(const pp::InputEvent
& input_event
);
24 virtual void HandleMessage(const pp::Var
& message_data
);
25 virtual void DidChangeView(const pp::View
& view
);
27 // TestCase implementation.
29 virtual void RunTests(const std::string
& test_filter
);
32 pp::InputEvent
CreateMouseEvent(PP_InputEvent_Type type
,
33 PP_InputEvent_MouseButton buttons
);
34 pp::InputEvent
CreateWheelEvent();
35 pp::InputEvent
CreateKeyEvent(PP_InputEvent_Type type
,
37 pp::InputEvent
CreateCharEvent(const std::string
& text
);
38 pp::InputEvent
CreateTouchEvent(PP_InputEvent_Type type
,
39 const pp::FloatPoint
& location
);
41 bool SimulateInputEvent(const pp::InputEvent
& input_event
);
42 bool AreEquivalentEvents(PP_Resource first
, PP_Resource second
);
44 std::string
TestEvents();
45 std::string
TestAcceptTouchEvent_1();
46 std::string
TestAcceptTouchEvent_2();
47 std::string
TestAcceptTouchEvent_3();
48 std::string
TestAcceptTouchEvent_4();
50 const PPB_InputEvent
* input_event_interface_
;
51 const PPB_MouseInputEvent
* mouse_input_event_interface_
;
52 const PPB_WheelInputEvent
* wheel_input_event_interface_
;
53 const PPB_KeyboardInputEvent
* keyboard_input_event_interface_
;
54 const PPB_TouchInputEvent
* touch_input_event_interface_
;
57 pp::InputEvent expected_input_event_
;
58 bool received_expected_event_
;
59 bool received_finish_message_
;
62 #endif // PPAPI_TESTS_TEST_INPUT_EVENT_H_