OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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 PPAPI_TESTS_TEST_INPUT_EVENT_H_ |
| 6 #define PPAPI_TESTS_TEST_INPUT_EVENT_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <vector> |
| 10 |
| 11 #include "ppapi/cpp/input_event.h" |
| 12 #include "ppapi/cpp/point.h" |
| 13 #include "ppapi/cpp/rect.h" |
| 14 #include "ppapi/tests/test_case.h" |
| 15 |
| 16 struct PPB_InputEvent; |
| 17 struct PPB_MouseInputEvent; |
| 18 struct PPB_WheelInputEvent; |
| 19 struct PPB_KeyboardInputEvent; |
| 20 struct PPB_Testing_Dev; |
| 21 |
| 22 class TestInputEvent : public TestCase { |
| 23 public: |
| 24 explicit TestInputEvent(TestingInstance* instance); |
| 25 |
| 26 bool HandleInputEvent(const pp::InputEvent& input_event); |
| 27 void DidChangeView(const pp::Rect& position, const pp::Rect& clip); |
| 28 |
| 29 // TestCase implementation. |
| 30 virtual bool Init(); |
| 31 virtual void RunTests(const std::string& test_filter); |
| 32 |
| 33 private: |
| 34 pp::InputEvent CreateMouseEvent(); |
| 35 pp::InputEvent CreateMouseEvent(PP_InputEvent_Type type, |
| 36 PP_InputEvent_MouseButton buttons); |
| 37 |
| 38 pp::InputEvent CreateWheelEvent(); |
| 39 |
| 40 pp::InputEvent CreateKeyEvent(); |
| 41 pp::InputEvent CreateKeyEvent(PP_InputEvent_Type type, |
| 42 uint32_t key_code); |
| 43 |
| 44 pp::InputEvent CreateCharEvent(); |
| 45 pp::InputEvent CreateCharEvent(const std::string& text); |
| 46 |
| 47 bool TestRequestedInputEvent(const pp::InputEvent& input_event); |
| 48 bool TestUnrequestedInputEvent( |
| 49 const pp::InputEvent& unrequested_input_event, |
| 50 const pp::InputEvent& registered_input_event); |
| 51 bool AreEquivalentEvents(PP_Resource first, PP_Resource second); |
| 52 |
| 53 std::string TestEvents(); |
| 54 |
| 55 const struct PPB_InputEvent* input_event_interface_; |
| 56 const struct PPB_MouseInputEvent* mouse_input_event_interface_; |
| 57 const struct PPB_WheelInputEvent* wheel_input_event_interface_; |
| 58 const struct PPB_KeyboardInputEvent* keyboard_input_event_interface_; |
| 59 const struct PPB_Testing_Dev* testing_interface_; |
| 60 |
| 61 pp::Rect view_rect_; |
| 62 pp::InputEvent expected_input_event_; |
| 63 pp::InputEvent unexpected_input_event_; |
| 64 bool received_expected_event_; |
| 65 bool received_unexpected_event_; |
| 66 bool running_message_loop_; |
| 67 }; |
| 68 |
| 69 #endif // PPAPI_TESTS_TEST_INPUT_EVENT_H_ |
| 70 |
OLD | NEW |