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/ppb_input_event.h" | |
13 #include "ppapi/c/dev/ppb_ime_input_event_dev.h" | |
yzshen1
2012/05/15 18:03:48
sort, please.
kinaba
2012/05/16 10:13:57
Done.
| |
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 virtual bool HandleInputEvent(const pp::InputEvent& input_event); | |
23 virtual void HandleMessage(const pp::Var& message_data); | |
24 virtual void DidChangeView(const pp::View& view); | |
25 | |
26 // TestCase implementation. | |
yzshen1
2012/05/15 18:03:48
line 22-24 also TestCase implementation.
kinaba
2012/05/16 10:13:57
Done.
| |
27 virtual bool Init(); | |
28 virtual void RunTests(const std::string& test_filter); | |
29 | |
30 private: | |
31 pp::InputEvent CreateImeCompositionStartEvent(); | |
32 pp::InputEvent CreateImeCompositionUpdateEvent( | |
33 const std::string& text, | |
34 const std::vector<uint32_t>& segments, | |
35 int32_t target_segment, | |
36 const std::pair<uint32_t, uint32_t>& selection); | |
37 pp::InputEvent CreateImeCompositionEndEvent(const std::string& text); | |
38 pp::InputEvent CreateImeTextEvent(const std::string& text); | |
39 pp::InputEvent CreateCharEvent(const std::string& text); | |
40 | |
41 void GetFocusBySimulatingMouseClick(); | |
42 bool SimulateInputEvent(const pp::InputEvent& input_event); | |
43 bool AreEquivalentEvents(PP_Resource first, PP_Resource second); | |
44 | |
45 // The test cases. | |
46 std::string TestImeCommit(); | |
47 std::string TestImeCancel(); | |
48 std::string TestImeUnawareCommit(); | |
49 std::string TestImeUnawareCancel(); | |
50 | |
51 const PPB_InputEvent* input_event_interface_; | |
52 const PPB_KeyboardInputEvent* keyboard_input_event_interface_; | |
53 const PPB_IMEInputEvent_Dev* ime_input_event_interface_; | |
54 | |
55 pp::Rect view_rect_; | |
56 bool received_unexpected_event_; | |
57 bool received_finish_message_; | |
58 std::vector<pp::InputEvent> expected_events_; | |
59 }; | |
60 | |
61 #endif // PPAPI_TESTS_TEST_IME_INPUT_EVENT_H_ | |
OLD | NEW |