Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(673)

Side by Side Diff: ppapi/tests/test_input_event.cc

Issue 10665007: ppapi: Add test for touch-event support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: self-nits Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/tests/test_input_event.h ('k') | ppapi/tests/testing_instance.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 13 matching lines...) Expand all
24 pp::Point GetCenter(const pp::Rect& rect) { 24 pp::Point GetCenter(const pp::Rect& rect) {
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 RUN_TEST(AcceptTouchEvent_1, filter);
35 RUN_TEST(AcceptTouchEvent_2, filter);
36 RUN_TEST(AcceptTouchEvent_3, filter);
37 RUN_TEST(AcceptTouchEvent_4, filter);
34 } 38 }
35 39
36 TestInputEvent::TestInputEvent(TestingInstance* instance) 40 TestInputEvent::TestInputEvent(TestingInstance* instance)
37 : TestCase(instance), 41 : TestCase(instance),
38 input_event_interface_(NULL), 42 input_event_interface_(NULL),
39 mouse_input_event_interface_(NULL), 43 mouse_input_event_interface_(NULL),
40 wheel_input_event_interface_(NULL), 44 wheel_input_event_interface_(NULL),
41 keyboard_input_event_interface_(NULL), 45 keyboard_input_event_interface_(NULL),
42 view_rect_(), 46 view_rect_(),
43 expected_input_event_(0), 47 expected_input_event_(0),
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 SimulateInputEvent(CreateWheelEvent())); 282 SimulateInputEvent(CreateWheelEvent()));
279 ASSERT_FALSE( 283 ASSERT_FALSE(
280 SimulateInputEvent(CreateKeyEvent(PP_INPUTEVENT_TYPE_KEYDOWN, 284 SimulateInputEvent(CreateKeyEvent(PP_INPUTEVENT_TYPE_KEYDOWN,
281 kSpaceChar))); 285 kSpaceChar)));
282 ASSERT_FALSE( 286 ASSERT_FALSE(
283 SimulateInputEvent(CreateCharEvent(kSpaceString))); 287 SimulateInputEvent(CreateCharEvent(kSpaceString)));
284 288
285 PASS(); 289 PASS();
286 } 290 }
287 291
292 std::string TestInputEvent::TestAcceptTouchEvent_1() {
brettw 2012/06/25 23:30:51 Can you add a comment above here explaining how th
sadrul 2012/06/28 16:38:04 Done.
293 instance_->set_remove_plugin(false);
294 input_event_interface_->RequestInputEvents(instance_->pp_instance(),
295 PP_INPUTEVENT_CLASS_MOUSE |
296 PP_INPUTEVENT_CLASS_WHEEL |
297 PP_INPUTEVENT_CLASS_KEYBOARD |
298 PP_INPUTEVENT_CLASS_TOUCH);
299 PASS();
300 }
301
302 std::string TestInputEvent::TestAcceptTouchEvent_2() {
303 instance_->set_remove_plugin(false);
304 input_event_interface_->RequestInputEvents(instance_->pp_instance(),
305 PP_INPUTEVENT_CLASS_MOUSE |
306 PP_INPUTEVENT_CLASS_WHEEL |
307 PP_INPUTEVENT_CLASS_KEYBOARD |
308 PP_INPUTEVENT_CLASS_TOUCH);
309 input_event_interface_->ClearInputEventRequest(instance_->pp_instance(),
310 PP_INPUTEVENT_CLASS_TOUCH);
311 PASS();
312 }
313
314 std::string TestInputEvent::TestAcceptTouchEvent_3() {
315 instance_->set_remove_plugin(false);
316 input_event_interface_->RequestInputEvents(instance_->pp_instance(),
317 PP_INPUTEVENT_CLASS_MOUSE |
318 PP_INPUTEVENT_CLASS_WHEEL |
319 PP_INPUTEVENT_CLASS_KEYBOARD);
320 input_event_interface_->RequestFilteringInputEvents(instance_->pp_instance(),
321 PP_INPUTEVENT_CLASS_TOUCH);
322 PASS();
323 }
324
325 std::string TestInputEvent::TestAcceptTouchEvent_4() {
326 instance_->set_remove_plugin(false);
327 input_event_interface_->RequestInputEvents(instance_->pp_instance(),
328 PP_INPUTEVENT_CLASS_MOUSE |
329 PP_INPUTEVENT_CLASS_WHEEL |
330 PP_INPUTEVENT_CLASS_KEYBOARD);
331 input_event_interface_->RequestInputEvents(instance_->pp_instance(),
332 PP_INPUTEVENT_CLASS_TOUCH);
333 PASS();
334 }
335
OLDNEW
« no previous file with comments | « ppapi/tests/test_input_event.h ('k') | ppapi/tests/testing_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698