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 #include "ppapi/tests/test_input_event.h" | 5 #include "ppapi/tests/test_input_event.h" |
6 | 6 |
7 #include "ppapi/c/dev/ppb_testing_dev.h" | 7 #include "ppapi/c/dev/ppb_testing_dev.h" |
8 #include "ppapi/c/pp_errors.h" | 8 #include "ppapi/c/pp_errors.h" |
9 #include "ppapi/c/ppb_input_event.h" | 9 #include "ppapi/c/ppb_input_event.h" |
10 #include "ppapi/cpp/input_event.h" | 10 #include "ppapi/cpp/input_event.h" |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 std::string js_code; | 50 std::string js_code; |
51 js_code += "var plugin = document.getElementById('plugin');" | 51 js_code += "var plugin = document.getElementById('plugin');" |
52 "plugin.removeEventListener('message'," | 52 "plugin.removeEventListener('message'," |
53 " plugin.wait_for_messages_handler);" | 53 " plugin.wait_for_messages_handler);" |
54 "delete plugin.wait_for_messages_handler;"; | 54 "delete plugin.wait_for_messages_handler;"; |
55 pp::Var exception; | 55 pp::Var exception; |
56 instance_->ExecuteScript(js_code, &exception); | 56 instance_->ExecuteScript(js_code, &exception); |
57 } | 57 } |
58 | 58 |
59 bool TestInputEvent::Init() { | 59 bool TestInputEvent::Init() { |
60 input_event_interface_ = static_cast<PPB_InputEvent const*>( | 60 input_event_interface_ = static_cast<const PPB_InputEvent*>( |
61 pp::Module::Get()->GetBrowserInterface(PPB_INPUT_EVENT_INTERFACE)); | 61 pp::Module::Get()->GetBrowserInterface(PPB_INPUT_EVENT_INTERFACE)); |
62 mouse_input_event_interface_ = static_cast<PPB_MouseInputEvent const*>( | 62 mouse_input_event_interface_ = static_cast<const PPB_MouseInputEvent*>( |
63 pp::Module::Get()->GetBrowserInterface( | 63 pp::Module::Get()->GetBrowserInterface( |
64 PPB_MOUSE_INPUT_EVENT_INTERFACE)); | 64 PPB_MOUSE_INPUT_EVENT_INTERFACE)); |
65 wheel_input_event_interface_ = static_cast<PPB_WheelInputEvent const*>( | 65 wheel_input_event_interface_ = static_cast<const PPB_WheelInputEvent*>( |
66 pp::Module::Get()->GetBrowserInterface( | 66 pp::Module::Get()->GetBrowserInterface( |
67 PPB_WHEEL_INPUT_EVENT_INTERFACE)); | 67 PPB_WHEEL_INPUT_EVENT_INTERFACE)); |
68 keyboard_input_event_interface_ = static_cast<PPB_KeyboardInputEvent const*>( | 68 keyboard_input_event_interface_ = static_cast<const PPB_KeyboardInputEvent*>( |
69 pp::Module::Get()->GetBrowserInterface( | 69 pp::Module::Get()->GetBrowserInterface( |
70 PPB_KEYBOARD_INPUT_EVENT_INTERFACE)); | 70 PPB_KEYBOARD_INPUT_EVENT_INTERFACE)); |
71 | 71 |
72 bool success = | 72 bool success = |
73 input_event_interface_ && | 73 input_event_interface_ && |
74 mouse_input_event_interface_ && | 74 mouse_input_event_interface_ && |
75 wheel_input_event_interface_ && | 75 wheel_input_event_interface_ && |
76 keyboard_input_event_interface_ && | 76 keyboard_input_event_interface_ && |
77 InitTestingInterface(); | 77 InitTestingInterface(); |
78 | 78 |
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 SimulateInputEvent(CreateWheelEvent())); | 281 SimulateInputEvent(CreateWheelEvent())); |
282 ASSERT_FALSE( | 282 ASSERT_FALSE( |
283 SimulateInputEvent(CreateKeyEvent(PP_INPUTEVENT_TYPE_KEYDOWN, | 283 SimulateInputEvent(CreateKeyEvent(PP_INPUTEVENT_TYPE_KEYDOWN, |
284 kSpaceChar))); | 284 kSpaceChar))); |
285 ASSERT_FALSE( | 285 ASSERT_FALSE( |
286 SimulateInputEvent(CreateCharEvent(kSpaceString))); | 286 SimulateInputEvent(CreateCharEvent(kSpaceString))); |
287 | 287 |
288 PASS(); | 288 PASS(); |
289 } | 289 } |
290 | 290 |
OLD | NEW |