| OLD | NEW | 
|---|
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be | 
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. | 
| 4 | 4 | 
| 5 #ifndef PPAPI_TESTS_TEST_INPUT_EVENT_H_ | 5 #ifndef PPAPI_TESTS_TEST_INPUT_EVENT_H_ | 
| 6 #define PPAPI_TESTS_TEST_INPUT_EVENT_H_ | 6 #define PPAPI_TESTS_TEST_INPUT_EVENT_H_ | 
| 7 | 7 | 
| 8 #include <string> | 8 #include <string> | 
| 9 #include <vector> | 9 #include <vector> | 
| 10 | 10 | 
|  | 11 #include "ppapi/c/ppb_input_event.h" | 
|  | 12 #include "ppapi/c/dev/ppb_testing_dev.h" | 
| 11 #include "ppapi/cpp/input_event.h" | 13 #include "ppapi/cpp/input_event.h" | 
| 12 #include "ppapi/cpp/point.h" | 14 #include "ppapi/cpp/point.h" | 
| 13 #include "ppapi/cpp/rect.h" | 15 #include "ppapi/cpp/rect.h" | 
| 14 #include "ppapi/tests/test_case.h" | 16 #include "ppapi/tests/test_case.h" | 
| 15 | 17 | 
| 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 { | 18 class TestInputEvent : public TestCase { | 
| 23  public: | 19  public: | 
| 24   explicit TestInputEvent(TestingInstance* instance); | 20   explicit TestInputEvent(TestingInstance* instance); | 
| 25   ~TestInputEvent(); | 21   ~TestInputEvent(); | 
| 26 | 22 | 
| 27   bool HandleInputEvent(const pp::InputEvent& input_event); | 23   bool HandleInputEvent(const pp::InputEvent& input_event); | 
| 28   void HandleMessage(const pp::Var& message_data); | 24   void HandleMessage(const pp::Var& message_data); | 
| 29   void DidChangeView(const pp::Rect& position, const pp::Rect& clip); | 25   void DidChangeView(const pp::Rect& position, const pp::Rect& clip); | 
| 30 | 26 | 
| 31   // TestCase implementation. | 27   // TestCase implementation. | 
| 32   virtual bool Init(); | 28   virtual bool Init(); | 
| 33   virtual void RunTests(const std::string& test_filter); | 29   virtual void RunTests(const std::string& test_filter); | 
| 34 | 30 | 
| 35  private: | 31  private: | 
| 36   pp::InputEvent CreateMouseEvent(PP_InputEvent_Type type, | 32   pp::InputEvent CreateMouseEvent(PP_InputEvent_Type type, | 
| 37                                   PP_InputEvent_MouseButton buttons); | 33                                   PP_InputEvent_MouseButton buttons); | 
| 38   pp::InputEvent CreateWheelEvent(); | 34   pp::InputEvent CreateWheelEvent(); | 
| 39   pp::InputEvent CreateKeyEvent(PP_InputEvent_Type type, | 35   pp::InputEvent CreateKeyEvent(PP_InputEvent_Type type, | 
| 40                                 uint32_t key_code); | 36                                 uint32_t key_code); | 
| 41   pp::InputEvent CreateCharEvent(const std::string& text); | 37   pp::InputEvent CreateCharEvent(const std::string& text); | 
| 42 | 38 | 
| 43   bool SimulateInputEvent(const pp::InputEvent& input_event); | 39   bool SimulateInputEvent(const pp::InputEvent& input_event); | 
| 44   bool AreEquivalentEvents(PP_Resource first, PP_Resource second); | 40   bool AreEquivalentEvents(PP_Resource first, PP_Resource second); | 
| 45 | 41 | 
| 46   std::string TestEvents(); | 42   std::string TestEvents(); | 
| 47 | 43 | 
| 48   const struct PPB_InputEvent* input_event_interface_; | 44   const PPB_InputEvent* input_event_interface_; | 
| 49   const struct PPB_MouseInputEvent* mouse_input_event_interface_; | 45   const PPB_MouseInputEvent* mouse_input_event_interface_; | 
| 50   const struct PPB_WheelInputEvent* wheel_input_event_interface_; | 46   const PPB_WheelInputEvent* wheel_input_event_interface_; | 
| 51   const struct PPB_KeyboardInputEvent* keyboard_input_event_interface_; | 47   const PPB_KeyboardInputEvent* keyboard_input_event_interface_; | 
| 52 | 48 | 
| 53   pp::Rect view_rect_; | 49   pp::Rect view_rect_; | 
| 54   pp::InputEvent expected_input_event_; | 50   pp::InputEvent expected_input_event_; | 
| 55   bool received_expected_event_; | 51   bool received_expected_event_; | 
| 56   bool received_finish_message_; | 52   bool received_finish_message_; | 
| 57 }; | 53 }; | 
| 58 | 54 | 
| 59 #endif  // PPAPI_TESTS_TEST_INPUT_EVENT_H_ | 55 #endif  // PPAPI_TESTS_TEST_INPUT_EVENT_H_ | 
| 60 |  | 
| OLD | NEW | 
|---|