OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 14 matching lines...) Expand all Loading... |
25 return pp::Point( | 25 return pp::Point( |
26 rect.x() + rect.width() / 2, | 26 rect.x() + rect.width() / 2, |
27 rect.y() + rect.height() / 2); | 27 rect.y() + rect.height() / 2); |
28 } | 28 } |
29 | 29 |
30 } // namespace | 30 } // namespace |
31 | 31 |
32 void TestInputEvent::RunTests(const std::string& filter) { | 32 void TestInputEvent::RunTests(const std::string& filter) { |
33 RUN_TEST(Events, filter); | 33 RUN_TEST(Events, filter); |
34 | 34 |
35 // Like RUN_TEST, but does an exact match with the filter (which means it does | 35 // The AcceptTouchEvent_N tests should not be run when the filter is empty; |
36 // not run the test if filter is empty). | 36 // they can only be run one at a time. |
37 #define RUN_TEST_EXACT_MATCH(name, test_filter) \ | 37 // TODO(dmichael): Figure out a way to make these run in the same test fixture |
38 if (test_filter == #name) { \ | 38 // instance. |
39 set_callback_type(PP_OPTIONAL); \ | 39 if (!ShouldRunAllTests(filter)) { |
40 instance_->LogTest(#name, CheckResourcesAndVars(Test##name())); \ | 40 RUN_TEST(AcceptTouchEvent_1, filter); |
| 41 RUN_TEST(AcceptTouchEvent_2, filter); |
| 42 RUN_TEST(AcceptTouchEvent_3, filter); |
| 43 RUN_TEST(AcceptTouchEvent_4, filter); |
41 } | 44 } |
42 | |
43 RUN_TEST_EXACT_MATCH(AcceptTouchEvent_1, filter); | |
44 RUN_TEST_EXACT_MATCH(AcceptTouchEvent_2, filter); | |
45 RUN_TEST_EXACT_MATCH(AcceptTouchEvent_3, filter); | |
46 RUN_TEST_EXACT_MATCH(AcceptTouchEvent_4, filter); | |
47 | |
48 #undef RUN_TEST_EXACT_MATCH | |
49 } | 45 } |
50 | 46 |
51 TestInputEvent::TestInputEvent(TestingInstance* instance) | 47 TestInputEvent::TestInputEvent(TestingInstance* instance) |
52 : TestCase(instance), | 48 : TestCase(instance), |
53 input_event_interface_(NULL), | 49 input_event_interface_(NULL), |
54 mouse_input_event_interface_(NULL), | 50 mouse_input_event_interface_(NULL), |
55 wheel_input_event_interface_(NULL), | 51 wheel_input_event_interface_(NULL), |
56 keyboard_input_event_interface_(NULL), | 52 keyboard_input_event_interface_(NULL), |
57 touch_input_event_interface_(NULL), | 53 touch_input_event_interface_(NULL), |
58 view_rect_(), | 54 view_rect_(), |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 instance_->set_remove_plugin(false); | 401 instance_->set_remove_plugin(false); |
406 input_event_interface_->RequestInputEvents(instance_->pp_instance(), | 402 input_event_interface_->RequestInputEvents(instance_->pp_instance(), |
407 PP_INPUTEVENT_CLASS_MOUSE | | 403 PP_INPUTEVENT_CLASS_MOUSE | |
408 PP_INPUTEVENT_CLASS_WHEEL | | 404 PP_INPUTEVENT_CLASS_WHEEL | |
409 PP_INPUTEVENT_CLASS_KEYBOARD); | 405 PP_INPUTEVENT_CLASS_KEYBOARD); |
410 input_event_interface_->RequestInputEvents(instance_->pp_instance(), | 406 input_event_interface_->RequestInputEvents(instance_->pp_instance(), |
411 PP_INPUTEVENT_CLASS_TOUCH); | 407 PP_INPUTEVENT_CLASS_TOUCH); |
412 PASS(); | 408 PASS(); |
413 } | 409 } |
414 | 410 |
OLD | NEW |