OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/chromeos/touch_exploration_controller.h" | 5 #include "ui/chromeos/touch_exploration_controller.h" |
6 | 6 |
7 #include <math.h> | 7 #include <math.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 | 425 |
426 // Executes a number of assertions to confirm that |e1| and |e2| are touch | 426 // Executes a number of assertions to confirm that |e1| and |e2| are touch |
427 // events and are equal to each other. | 427 // events and are equal to each other. |
428 void ConfirmEventsAreTouchAndEqual(ui::Event* e1, ui::Event* e2) { | 428 void ConfirmEventsAreTouchAndEqual(ui::Event* e1, ui::Event* e2) { |
429 ASSERT_TRUE(e1->IsTouchEvent()); | 429 ASSERT_TRUE(e1->IsTouchEvent()); |
430 ASSERT_TRUE(e2->IsTouchEvent()); | 430 ASSERT_TRUE(e2->IsTouchEvent()); |
431 ui::TouchEvent* touch_event1 = e1->AsTouchEvent(); | 431 ui::TouchEvent* touch_event1 = e1->AsTouchEvent(); |
432 ui::TouchEvent* touch_event2 = e2->AsTouchEvent(); | 432 ui::TouchEvent* touch_event2 = e2->AsTouchEvent(); |
433 EXPECT_EQ(touch_event1->type(), touch_event2->type()); | 433 EXPECT_EQ(touch_event1->type(), touch_event2->type()); |
434 EXPECT_EQ(touch_event1->location(), touch_event2->location()); | 434 EXPECT_EQ(touch_event1->location(), touch_event2->location()); |
435 EXPECT_EQ(touch_event1->touch_id(), touch_event2->touch_id()); | 435 EXPECT_EQ(touch_event1->pointer_details().id, |
| 436 touch_event2->pointer_details().id); |
436 EXPECT_EQ(touch_event1->flags(), touch_event2->flags()); | 437 EXPECT_EQ(touch_event1->flags(), touch_event2->flags()); |
437 EXPECT_EQ(touch_event1->time_stamp(), touch_event2->time_stamp()); | 438 EXPECT_EQ(touch_event1->time_stamp(), touch_event2->time_stamp()); |
438 } | 439 } |
439 | 440 |
440 // Executes a number of assertions to confirm that |e1| and |e2| are mouse | 441 // Executes a number of assertions to confirm that |e1| and |e2| are mouse |
441 // events and are equal to each other. | 442 // events and are equal to each other. |
442 void ConfirmEventsAreMouseAndEqual(ui::Event* e1, ui::Event* e2) { | 443 void ConfirmEventsAreMouseAndEqual(ui::Event* e1, ui::Event* e2) { |
443 ASSERT_TRUE(e1->IsMouseEvent()); | 444 ASSERT_TRUE(e1->IsMouseEvent()); |
444 ASSERT_TRUE(e2->IsMouseEvent()); | 445 ASSERT_TRUE(e2->IsMouseEvent()); |
445 ui::MouseEvent* mouse_event1 = e1->AsMouseEvent(); | 446 ui::MouseEvent* mouse_event1 = e1->AsMouseEvent(); |
(...skipping 934 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1380 // dispatched.. | 1381 // dispatched.. |
1381 EventTestApi test_dispatch(next_dispatch); | 1382 EventTestApi test_dispatch(next_dispatch); |
1382 test_dispatch.set_time_stamp(Now()); | 1383 test_dispatch.set_time_stamp(Now()); |
1383 generator_->Dispatch(next_dispatch); | 1384 generator_->Dispatch(next_dispatch); |
1384 queued_events.erase(queued_events.begin() + index); | 1385 queued_events.erase(queued_events.begin() + index); |
1385 | 1386 |
1386 // Keep track of what fingers have been pressed, to release | 1387 // Keep track of what fingers have been pressed, to release |
1387 // only those fingers at the end, so the check for being in | 1388 // only those fingers at the end, so the check for being in |
1388 // no fingers down can be accurate. | 1389 // no fingers down can be accurate. |
1389 if (next_dispatch->type() == ET_TOUCH_PRESSED) { | 1390 if (next_dispatch->type() == ET_TOUCH_PRESSED) { |
1390 fingers_pressed[next_dispatch->touch_id()] = true; | 1391 fingers_pressed[next_dispatch->pointer_details().id] = true; |
1391 } else if (next_dispatch->type() == ET_TOUCH_RELEASED) { | 1392 } else if (next_dispatch->type() == ET_TOUCH_RELEASED) { |
1392 fingers_pressed[next_dispatch->touch_id()] = false; | 1393 fingers_pressed[next_dispatch->pointer_details().id] = false; |
1393 } | 1394 } |
1394 } | 1395 } |
1395 ASSERT_EQ(queued_events.size(), 0u); | 1396 ASSERT_EQ(queued_events.size(), 0u); |
1396 | 1397 |
1397 // Release fingers recorded as pressed. | 1398 // Release fingers recorded as pressed. |
1398 for(int j = 0; j < int(fingers_pressed.size()); j++){ | 1399 for(int j = 0; j < int(fingers_pressed.size()); j++){ |
1399 if (fingers_pressed[j] == true) { | 1400 if (fingers_pressed[j] == true) { |
1400 generator_->ReleaseTouchId(j); | 1401 generator_->ReleaseTouchId(j); |
1401 fingers_pressed[j] = false; | 1402 fingers_pressed[j] = false; |
1402 } | 1403 } |
(...skipping 532 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1935 AdvanceSimulatedTimePastTapDelay(); | 1936 AdvanceSimulatedTimePastTapDelay(); |
1936 EXPECT_TRUE(IsInNoFingersDownState()); | 1937 EXPECT_TRUE(IsInNoFingersDownState()); |
1937 | 1938 |
1938 ASSERT_EQ(1U, GetCapturedEvents().size()); | 1939 ASSERT_EQ(1U, GetCapturedEvents().size()); |
1939 EXPECT_EQ(ui::ET_MOUSE_MOVED, GetCapturedEvents()[0]->type()); | 1940 EXPECT_EQ(ui::ET_MOUSE_MOVED, GetCapturedEvents()[0]->type()); |
1940 ClearCapturedEvents(); | 1941 ClearCapturedEvents(); |
1941 } | 1942 } |
1942 } | 1943 } |
1943 | 1944 |
1944 } // namespace ui | 1945 } // namespace ui |
OLD | NEW |