OLD | NEW |
(Empty) | |
| 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. |
| 4 |
| 5 #ifndef PPAPI_TESTS_TEST_IME_INPUT_EVENT_H_ |
| 6 #define PPAPI_TESTS_TEST_IME_INPUT_EVENT_H_ |
| 7 |
| 8 #include <string> |
| 9 #include <utility> |
| 10 #include <vector> |
| 11 |
| 12 #include "ppapi/c/dev/ppb_ime_input_event_dev.h" |
| 13 #include "ppapi/c/ppb_input_event.h" |
| 14 #include "ppapi/cpp/input_event.h" |
| 15 #include "ppapi/tests/test_case.h" |
| 16 |
| 17 class TestImeInputEvent : public TestCase { |
| 18 public: |
| 19 explicit TestImeInputEvent(TestingInstance* instance); |
| 20 ~TestImeInputEvent(); |
| 21 |
| 22 // TestCase implementation. |
| 23 virtual void RunTests(const std::string& test_filter); |
| 24 virtual bool Init(); |
| 25 virtual bool HandleInputEvent(const pp::InputEvent& input_event); |
| 26 virtual void HandleMessage(const pp::Var& message_data); |
| 27 virtual void DidChangeView(const pp::View& view); |
| 28 |
| 29 private: |
| 30 pp::InputEvent CreateImeCompositionStartEvent(); |
| 31 pp::InputEvent CreateImeCompositionUpdateEvent( |
| 32 const std::string& text, |
| 33 const std::vector<uint32_t>& segments, |
| 34 int32_t target_segment, |
| 35 const std::pair<uint32_t, uint32_t>& selection); |
| 36 pp::InputEvent CreateImeCompositionEndEvent(const std::string& text); |
| 37 pp::InputEvent CreateImeTextEvent(const std::string& text); |
| 38 pp::InputEvent CreateCharEvent(const std::string& text); |
| 39 |
| 40 void GetFocusBySimulatingMouseClick(); |
| 41 bool SimulateInputEvent(const pp::InputEvent& input_event); |
| 42 bool AreEquivalentEvents(PP_Resource first, PP_Resource second); |
| 43 |
| 44 // The test cases. |
| 45 std::string TestImeCommit(); |
| 46 std::string TestImeCancel(); |
| 47 std::string TestImeUnawareCommit(); |
| 48 std::string TestImeUnawareCancel(); |
| 49 |
| 50 const PPB_InputEvent* input_event_interface_; |
| 51 const PPB_KeyboardInputEvent* keyboard_input_event_interface_; |
| 52 const PPB_IMEInputEvent_Dev* ime_input_event_interface_; |
| 53 |
| 54 pp::Rect view_rect_; |
| 55 bool received_unexpected_event_; |
| 56 bool received_finish_message_; |
| 57 std::vector<pp::InputEvent> expected_events_; |
| 58 }; |
| 59 |
| 60 #endif // PPAPI_TESTS_TEST_IME_INPUT_EVENT_H_ |
OLD | NEW |