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

Side by Side Diff: ui/aura/gestures/gesture_recognizer_unittest.cc

Issue 1372253002: gfx: Make conversions from gfx::Point to PointF explicit. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: pointfconvert-event: mandol_line Created 5 years, 1 month 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
« no previous file with comments | « ui/app_list/folder_image.cc ('k') | ui/aura/test/ui_controls_factory_ozone.cc » ('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) 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 <list> 5 #include <list>
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/timer/timer.h" 10 #include "base/timer/timer.h"
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 base::TimeDelta LeapForward(int time_in_millis) { 495 base::TimeDelta LeapForward(int time_in_millis) {
496 simulated_now_ += time_in_millis; 496 simulated_now_ += time_in_millis;
497 return base::TimeDelta::FromMilliseconds(simulated_now_); 497 return base::TimeDelta::FromMilliseconds(simulated_now_);
498 } 498 }
499 499
500 base::TimeDelta InFuture(int time_in_millis) { 500 base::TimeDelta InFuture(int time_in_millis) {
501 return base::TimeDelta::FromMilliseconds(simulated_now_ + time_in_millis); 501 return base::TimeDelta::FromMilliseconds(simulated_now_ + time_in_millis);
502 } 502 }
503 503
504 void SendScrollEvents(ui::EventProcessor* dispatcher, 504 void SendScrollEvents(ui::EventProcessor* dispatcher,
505 float x_start, 505 int x_start,
506 float y_start, 506 int y_start,
507 int dx, 507 int dx,
508 int dy, 508 int dy,
509 int touch_id, 509 int touch_id,
510 int time_step, 510 int time_step,
511 int num_steps, 511 int num_steps,
512 GestureEventConsumeDelegate* delegate) { 512 GestureEventConsumeDelegate* delegate) {
513 float x = x_start; 513 float x = x_start;
514 float y = y_start; 514 float y = y_start;
515 515
516 for (int i = 0; i < num_steps; i++) { 516 for (int i = 0; i < num_steps; i++) {
517 x += dx; 517 x += dx;
518 y += dy; 518 y += dy;
519 ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::PointF(x, y), 519 ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(x, y), touch_id,
520 touch_id,
521 base::TimeDelta::FromMilliseconds(simulated_now_)); 520 base::TimeDelta::FromMilliseconds(simulated_now_));
522 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&move); 521 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&move);
523 ASSERT_FALSE(details.dispatcher_destroyed); 522 ASSERT_FALSE(details.dispatcher_destroyed);
524 simulated_now_ += time_step; 523 simulated_now_ += time_step;
525 } 524 }
526 } 525 }
527 526
528 void SendScrollEvent(ui::EventProcessor* dispatcher, 527 void SendScrollEvent(ui::EventProcessor* dispatcher,
529 float x, 528 float x,
530 float y, 529 float y,
531 int touch_id, 530 int touch_id,
532 GestureEventConsumeDelegate* delegate) { 531 GestureEventConsumeDelegate* delegate) {
533 delegate->Reset(); 532 delegate->Reset();
534 ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::PointF(x, y), 533 ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(), touch_id,
535 touch_id,
536 base::TimeDelta::FromMilliseconds(simulated_now_)); 534 base::TimeDelta::FromMilliseconds(simulated_now_));
535 move.set_location_f(gfx::PointF(x, y));
536 move.set_root_location_f(gfx::PointF(x, y));
537 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&move); 537 ui::EventDispatchDetails details = dispatcher->OnEventFromSource(&move);
538 ASSERT_FALSE(details.dispatcher_destroyed); 538 ASSERT_FALSE(details.dispatcher_destroyed);
539 simulated_now_++; 539 simulated_now_++;
540 } 540 }
541 }; 541 };
542 542
543 // An event handler to keep track of events. 543 // An event handler to keep track of events.
544 class TestEventHandler : public ui::EventHandler { 544 class TestEventHandler : public ui::EventHandler {
545 public: 545 public:
546 TestEventHandler() 546 TestEventHandler()
547 : touch_released_count_(0), 547 : touch_released_count_(0),
548 touch_pressed_count_(0), 548 touch_pressed_count_(0),
549 touch_moved_count_(0) {} 549 touch_moved_count_(0) {}
550 550
551 ~TestEventHandler() override {} 551 ~TestEventHandler() override {}
552 552
553 void OnTouchEvent(ui::TouchEvent* event) override { 553 void OnTouchEvent(ui::TouchEvent* event) override {
554 switch (event->type()) { 554 switch (event->type()) {
555 case ui::ET_TOUCH_RELEASED: 555 case ui::ET_TOUCH_RELEASED:
556 touch_released_count_++; 556 touch_released_count_++;
557 break; 557 break;
558 case ui::ET_TOUCH_PRESSED: 558 case ui::ET_TOUCH_PRESSED:
559 touch_pressed_count_++; 559 touch_pressed_count_++;
560 break; 560 break;
561 case ui::ET_TOUCH_MOVED: 561 case ui::ET_TOUCH_MOVED:
562 touch_moved_count_++; 562 touch_moved_count_++;
563 break; 563 break;
564 case ui::ET_TOUCH_CANCELLED: 564 case ui::ET_TOUCH_CANCELLED:
565 cancelled_touch_points_.push_back(event->location()); 565 cancelled_touch_points_.push_back(event->location_f());
566 break; 566 break;
567 default: 567 default:
568 break; 568 break;
569 } 569 }
570 } 570 }
571 571
572 void Reset() { 572 void Reset() {
573 touch_released_count_ = 0; 573 touch_released_count_ = 0;
574 touch_pressed_count_ = 0; 574 touch_pressed_count_ = 0;
575 touch_moved_count_ = 0; 575 touch_moved_count_ = 0;
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
1109 ui::GestureConfiguration::GetInstance()->set_default_radius(radius); 1109 ui::GestureConfiguration::GetInstance()->set_default_radius(radius);
1110 scoped_ptr<GestureEventConsumeDelegate> delegate( 1110 scoped_ptr<GestureEventConsumeDelegate> delegate(
1111 new GestureEventConsumeDelegate()); 1111 new GestureEventConsumeDelegate());
1112 const int kWindowWidth = 123; 1112 const int kWindowWidth = 123;
1113 const int kWindowHeight = 45; 1113 const int kWindowHeight = 45;
1114 const int kTouchId = 5; 1114 const int kTouchId = 5;
1115 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight); 1115 gfx::Rect bounds(100, 200, kWindowWidth, kWindowHeight);
1116 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate( 1116 scoped_ptr<aura::Window> window(CreateTestWindowWithDelegate(
1117 delegate.get(), -1234, bounds, root_window())); 1117 delegate.get(), -1234, bounds, root_window()));
1118 1118
1119 const float kPositionX = 101; 1119 const int kPositionX = 101;
1120 const float kPositionY = 201; 1120 const int kPositionY = 201;
1121 delegate->Reset(); 1121 delegate->Reset();
1122 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, 1122 ui::TouchEvent press(ui::ET_TOUCH_PRESSED,
1123 gfx::PointF(kPositionX, kPositionY), 1123 gfx::Point(kPositionX, kPositionY), kTouchId,
1124 kTouchId,
1125 tes.Now()); 1124 tes.Now());
1126 DispatchEventUsingWindowDispatcher(&press); 1125 DispatchEventUsingWindowDispatcher(&press);
1127 EXPECT_EQ(gfx::Rect(kPositionX - radius, kPositionY - radius, radius * 2, 1126 EXPECT_EQ(gfx::Rect(kPositionX - radius, kPositionY - radius, radius * 2,
1128 radius * 2), 1127 radius * 2),
1129 delegate->bounding_box()); 1128 delegate->bounding_box());
1130 1129
1131 const int kScrollAmount = 50; 1130 const int kScrollAmount = 50;
1132 tes.SendScrollEvents(event_processor(), kPositionX, kPositionY, 1131 tes.SendScrollEvents(event_processor(), kPositionX, kPositionY,
1133 1, 1, kTouchId, 1, kScrollAmount, delegate.get()); 1132 1, 1, kTouchId, 1, kScrollAmount, delegate.get());
1134 EXPECT_EQ(gfx::Point(1, 1).ToString(), 1133 EXPECT_EQ(gfx::Point(1, 1).ToString(),
1135 delegate->scroll_begin_position().ToString()); 1134 delegate->scroll_begin_position().ToString());
1136 EXPECT_EQ( 1135 EXPECT_EQ(
1137 gfx::Rect(kPositionX + kScrollAmount - radius, 1136 gfx::Rect(kPositionX + kScrollAmount - radius,
1138 kPositionY + kScrollAmount - radius, radius * 2, radius * 2), 1137 kPositionY + kScrollAmount - radius, radius * 2, radius * 2),
1139 delegate->bounding_box()); 1138 delegate->bounding_box());
1140 1139
1141 // Release the touch. This should end the scroll. 1140 // Release the touch. This should end the scroll.
1142 delegate->Reset(); 1141 delegate->Reset();
1143 ui::TouchEvent release(ui::ET_TOUCH_RELEASED, 1142 ui::TouchEvent release(
1144 gfx::PointF(kPositionX + kScrollAmount, 1143 ui::ET_TOUCH_RELEASED,
1145 kPositionY + kScrollAmount), 1144 gfx::Point(kPositionX + kScrollAmount, kPositionY + kScrollAmount),
1146 kTouchId, press.time_stamp() + 1145 kTouchId, press.time_stamp() + base::TimeDelta::FromMilliseconds(50));
1147 base::TimeDelta::FromMilliseconds(50));
1148 DispatchEventUsingWindowDispatcher(&release); 1146 DispatchEventUsingWindowDispatcher(&release);
1149 EXPECT_EQ( 1147 EXPECT_EQ(
1150 gfx::Rect(kPositionX + kScrollAmount - radius, 1148 gfx::Rect(kPositionX + kScrollAmount - radius,
1151 kPositionY + kScrollAmount - radius, radius * 2, radius * 2), 1149 kPositionY + kScrollAmount - radius, radius * 2, radius * 2),
1152 delegate->bounding_box()); 1150 delegate->bounding_box());
1153 } 1151 }
1154 ui::GestureConfiguration::GetInstance()->set_default_radius(0); 1152 ui::GestureConfiguration::GetInstance()->set_default_radius(0);
1155 } 1153 }
1156 1154
1157 // Check Scroll End Events report correct velocities 1155 // Check Scroll End Events report correct velocities
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after
1846 EXPECT_FALSE(queued_delegate->begin()); 1844 EXPECT_FALSE(queued_delegate->begin());
1847 EXPECT_FALSE(queued_delegate->end()); 1845 EXPECT_FALSE(queued_delegate->end());
1848 EXPECT_FALSE(queued_delegate->scroll_begin()); 1846 EXPECT_FALSE(queued_delegate->scroll_begin());
1849 EXPECT_FALSE(queued_delegate->scroll_update()); 1847 EXPECT_FALSE(queued_delegate->scroll_update());
1850 EXPECT_FALSE(queued_delegate->scroll_end()); 1848 EXPECT_FALSE(queued_delegate->scroll_end());
1851 1849
1852 // Move the second touch-point enough so that it is considered a pinch. This 1850 // Move the second touch-point enough so that it is considered a pinch. This
1853 // should generate both SCROLL_BEGIN and PINCH_BEGIN gestures. 1851 // should generate both SCROLL_BEGIN and PINCH_BEGIN gestures.
1854 queued_delegate->Reset(); 1852 queued_delegate->Reset();
1855 delegate->Reset(); 1853 delegate->Reset();
1856 ui::TouchEvent move( 1854 ui::TouchEvent move(ui::ET_TOUCH_MOVED,
1857 ui::ET_TOUCH_MOVED, 1855 gfx::Point(203 +
1858 gfx::PointF(203 + 1856 ui::GestureConfiguration::GetInstance()
1859 ui::GestureConfiguration::GetInstance() 1857 ->max_touch_move_in_pixels_for_click(),
1860 ->max_touch_move_in_pixels_for_click(), 1858 303),
1861 303), 1859 kTouchId2, tes.Now());
1862 kTouchId2,
1863 tes.Now());
1864 DispatchEventUsingWindowDispatcher(&move); 1860 DispatchEventUsingWindowDispatcher(&move);
1865 EXPECT_FALSE(delegate->tap()); 1861 EXPECT_FALSE(delegate->tap());
1866 EXPECT_FALSE(delegate->tap_down()); 1862 EXPECT_FALSE(delegate->tap_down());
1867 EXPECT_FALSE(delegate->tap_cancel()); 1863 EXPECT_FALSE(delegate->tap_cancel());
1868 EXPECT_FALSE(delegate->begin()); 1864 EXPECT_FALSE(delegate->begin());
1869 EXPECT_FALSE(delegate->scroll_begin()); 1865 EXPECT_FALSE(delegate->scroll_begin());
1870 EXPECT_FALSE(delegate->scroll_update()); 1866 EXPECT_FALSE(delegate->scroll_update());
1871 EXPECT_FALSE(delegate->scroll_end()); 1867 EXPECT_FALSE(delegate->scroll_end());
1872 EXPECT_FALSE(queued_delegate->tap()); 1868 EXPECT_FALSE(queued_delegate->tap());
1873 EXPECT_FALSE(queued_delegate->tap_down()); 1869 EXPECT_FALSE(queued_delegate->tap_down());
(...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after
2177 windows[i] = CreateTestWindowWithDelegate( 2173 windows[i] = CreateTestWindowWithDelegate(
2178 delegates[i], i, window_bounds[i], root_window()); 2174 delegates[i], i, window_bounds[i], root_window());
2179 windows[i]->set_id(i); 2175 windows[i]->set_id(i);
2180 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, window_bounds[i].origin(), 2176 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, window_bounds[i].origin(),
2181 i, tes.Now()); 2177 i, tes.Now());
2182 DispatchEventUsingWindowDispatcher(&press); 2178 DispatchEventUsingWindowDispatcher(&press);
2183 } 2179 }
2184 2180
2185 // Touches should now be associated with the closest touch within 2181 // Touches should now be associated with the closest touch within
2186 // ui::GestureConfiguration::max_separation_for_gesture_touches_in_pixels 2182 // ui::GestureConfiguration::max_separation_for_gesture_touches_in_pixels
2187 target = gesture_recognizer->GetTargetForLocation(gfx::Point(11, 11), -1); 2183 target =
2184 gesture_recognizer->GetTargetForLocation(gfx::PointF(11.f, 11.f), -1);
2188 EXPECT_EQ("0", WindowIDAsString(target)); 2185 EXPECT_EQ("0", WindowIDAsString(target));
2189 target = gesture_recognizer->GetTargetForLocation(gfx::Point(511, 11), -1); 2186 target =
2187 gesture_recognizer->GetTargetForLocation(gfx::PointF(511.f, 11.f), -1);
2190 EXPECT_EQ("1", WindowIDAsString(target)); 2188 EXPECT_EQ("1", WindowIDAsString(target));
2191 target = gesture_recognizer->GetTargetForLocation(gfx::Point(11, 511), -1); 2189 target =
2190 gesture_recognizer->GetTargetForLocation(gfx::PointF(11.f, 511.f), -1);
2192 EXPECT_EQ("2", WindowIDAsString(target)); 2191 EXPECT_EQ("2", WindowIDAsString(target));
2193 target = gesture_recognizer->GetTargetForLocation(gfx::Point(511, 511), -1); 2192 target =
2193 gesture_recognizer->GetTargetForLocation(gfx::PointF(511.f, 511.f), -1);
2194 EXPECT_EQ("3", WindowIDAsString(target)); 2194 EXPECT_EQ("3", WindowIDAsString(target));
2195 2195
2196 // Add a touch in the middle associated with windows[2] 2196 // Add a touch in the middle associated with windows[2]
2197 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 500), 2197 ui::TouchEvent press(ui::ET_TOUCH_PRESSED, gfx::Point(0, 500),
2198 kNumWindows, tes.Now()); 2198 kNumWindows, tes.Now());
2199 DispatchEventUsingWindowDispatcher(&press); 2199 DispatchEventUsingWindowDispatcher(&press);
2200 ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(250, 250), 2200 ui::TouchEvent move(ui::ET_TOUCH_MOVED, gfx::Point(250, 250),
2201 kNumWindows, tes.Now()); 2201 kNumWindows, tes.Now());
2202 DispatchEventUsingWindowDispatcher(&move); 2202 DispatchEventUsingWindowDispatcher(&move);
2203 2203
2204 target = gesture_recognizer->GetTargetForLocation(gfx::Point(250, 250), -1); 2204 target =
2205 gesture_recognizer->GetTargetForLocation(gfx::PointF(250.f, 250.f), -1);
2205 EXPECT_EQ("2", WindowIDAsString(target)); 2206 EXPECT_EQ("2", WindowIDAsString(target));
2206 2207
2207 // Make sure that ties are broken by distance to a current touch 2208 // Make sure that ties are broken by distance to a current touch
2208 // Closer to the point in the bottom right. 2209 // Closer to the point in the bottom right.
2209 target = gesture_recognizer->GetTargetForLocation(gfx::Point(380, 380), -1); 2210 target =
2211 gesture_recognizer->GetTargetForLocation(gfx::PointF(380.f, 380.f), -1);
2210 EXPECT_EQ("3", WindowIDAsString(target)); 2212 EXPECT_EQ("3", WindowIDAsString(target));
2211 2213
2212 // This touch is closer to the point in the middle 2214 // This touch is closer to the point in the middle
2213 target = gesture_recognizer->GetTargetForLocation(gfx::Point(300, 300), -1); 2215 target =
2216 gesture_recognizer->GetTargetForLocation(gfx::PointF(300.f, 300.f), -1);
2214 EXPECT_EQ("2", WindowIDAsString(target)); 2217 EXPECT_EQ("2", WindowIDAsString(target));
2215 2218
2216 // A touch too far from other touches won't be locked to anything 2219 // A touch too far from other touches won't be locked to anything
2217 target = gesture_recognizer->GetTargetForLocation(gfx::Point(1000, 1000), -1); 2220 target =
2221 gesture_recognizer->GetTargetForLocation(gfx::PointF(1000.f, 1000.f), -1);
2218 EXPECT_TRUE(target == NULL); 2222 EXPECT_TRUE(target == NULL);
2219 2223
2220 // Move a touch associated with windows[2] to 1000, 1000 2224 // Move a touch associated with windows[2] to 1000, 1000
2221 ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(1000, 1000), 2225 ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(1000, 1000),
2222 kNumWindows, tes.Now()); 2226 kNumWindows, tes.Now());
2223 DispatchEventUsingWindowDispatcher(&move2); 2227 DispatchEventUsingWindowDispatcher(&move2);
2224 2228
2225 target = gesture_recognizer->GetTargetForLocation(gfx::Point(1000, 1000), -1); 2229 target =
2230 gesture_recognizer->GetTargetForLocation(gfx::PointF(1000.f, 1000.f), -1);
2226 EXPECT_EQ("2", WindowIDAsString(target)); 2231 EXPECT_EQ("2", WindowIDAsString(target));
2227 2232
2228 for (int i = 0; i < kNumWindows; ++i) { 2233 for (int i = 0; i < kNumWindows; ++i) {
2229 // Delete windows before deleting delegates. 2234 // Delete windows before deleting delegates.
2230 delete windows[i]; 2235 delete windows[i];
2231 delete delegates[i]; 2236 delete delegates[i];
2232 } 2237 }
2233 } 2238 }
2234 2239
2235 // Check that a touch's target will not be effected by a touch on a different 2240 // Check that a touch's target will not be effected by a touch on a different
(...skipping 1387 matching lines...) Expand 10 before | Expand all | Expand 10 after
3623 ui::GestureRecognizer::Get()->CancelActiveTouchesExcept(nullptr); 3628 ui::GestureRecognizer::Get()->CancelActiveTouchesExcept(nullptr);
3624 3629
3625 EXPECT_EQ(NULL, gesture_recognizer->GetTouchLockedTarget(press)); 3630 EXPECT_EQ(NULL, gesture_recognizer->GetTouchLockedTarget(press));
3626 EXPECT_4_EVENTS(delegate->events(), 3631 EXPECT_4_EVENTS(delegate->events(),
3627 ui::ET_GESTURE_PINCH_END, 3632 ui::ET_GESTURE_PINCH_END,
3628 ui::ET_GESTURE_SCROLL_END, 3633 ui::ET_GESTURE_SCROLL_END,
3629 ui::ET_GESTURE_END, 3634 ui::ET_GESTURE_END,
3630 ui::ET_GESTURE_END); 3635 ui::ET_GESTURE_END);
3631 const std::vector<gfx::PointF>& points = handler->cancelled_touch_points(); 3636 const std::vector<gfx::PointF>& points = handler->cancelled_touch_points();
3632 EXPECT_EQ(2U, points.size()); 3637 EXPECT_EQ(2U, points.size());
3633 EXPECT_EQ(gfx::Point(101, 201), points[0]); 3638 EXPECT_EQ(gfx::PointF(101.f, 201.f), points[0]);
3634 EXPECT_EQ(gfx::Point(350, 300), points[1]); 3639 EXPECT_EQ(gfx::PointF(350.f, 300.f), points[1]);
3635 } 3640 }
3636 3641
3637 // Check that appropriate touch events generate show press events 3642 // Check that appropriate touch events generate show press events
3638 TEST_F(GestureRecognizerTest, GestureEventShowPress) { 3643 TEST_F(GestureRecognizerTest, GestureEventShowPress) {
3639 scoped_ptr<GestureEventConsumeDelegate> delegate( 3644 scoped_ptr<GestureEventConsumeDelegate> delegate(
3640 new GestureEventConsumeDelegate()); 3645 new GestureEventConsumeDelegate());
3641 TimedEvents tes; 3646 TimedEvents tes;
3642 const int kWindowWidth = 123; 3647 const int kWindowWidth = 123;
3643 const int kWindowHeight = 45; 3648 const int kWindowHeight = 45;
3644 const int kTouchId = 2; 3649 const int kTouchId = 2;
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
3870 3875
3871 ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(12, 10), kTouchId, 3876 ui::TouchEvent move2(ui::ET_TOUCH_MOVED, gfx::Point(12, 10), kTouchId,
3872 tes.LeapForward(40)); 3877 tes.LeapForward(40));
3873 DispatchEventUsingWindowDispatcher(&move2); 3878 DispatchEventUsingWindowDispatcher(&move2);
3874 EXPECT_FALSE(delegate->scroll_begin()); 3879 EXPECT_FALSE(delegate->scroll_begin());
3875 EXPECT_FALSE(delegate->scroll_update()); 3880 EXPECT_FALSE(delegate->scroll_update());
3876 EXPECT_EQ(0, delegate->scroll_x()); 3881 EXPECT_EQ(0, delegate->scroll_x());
3877 EXPECT_EQ(0, delegate->scroll_x_hint()); 3882 EXPECT_EQ(0, delegate->scroll_x_hint());
3878 delegate->Reset(); 3883 delegate->Reset();
3879 3884
3880 3885 ui::TouchEvent move3(ui::ET_TOUCH_MOVED, gfx::Point(), kTouchId,
3881 ui::TouchEvent move3(ui::ET_TOUCH_MOVED, gfx::PointF(13.1f, 10.f), kTouchId,
3882 tes.LeapForward(40)); 3886 tes.LeapForward(40));
3887 move3.set_location_f(gfx::PointF(13.1f, 10.f));
3888 move3.set_root_location_f(gfx::PointF(13.1f, 10.f));
3883 DispatchEventUsingWindowDispatcher(&move3); 3889 DispatchEventUsingWindowDispatcher(&move3);
3884 EXPECT_TRUE(delegate->scroll_begin()); 3890 EXPECT_TRUE(delegate->scroll_begin());
3885 EXPECT_TRUE(delegate->scroll_update()); 3891 EXPECT_TRUE(delegate->scroll_update());
3886 EXPECT_NEAR(0.1, delegate->scroll_x(), 0.0001); 3892 EXPECT_NEAR(0.1, delegate->scroll_x(), 0.0001);
3887 EXPECT_FLOAT_EQ(3.1f, delegate->scroll_x_hint()); 3893 EXPECT_FLOAT_EQ(3.1f, delegate->scroll_x_hint());
3888 delegate->Reset(); 3894 delegate->Reset();
3889 3895
3890 ui::TouchEvent move4(ui::ET_TOUCH_MOVED, gfx::Point(14, 10), kTouchId, 3896 ui::TouchEvent move4(ui::ET_TOUCH_MOVED, gfx::Point(14, 10), kTouchId,
3891 tes.LeapForward(40)); 3897 tes.LeapForward(40));
3892 DispatchEventUsingWindowDispatcher(&move4); 3898 DispatchEventUsingWindowDispatcher(&move4);
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after
4355 // The synchronous ack is stuck behind the pending touch move. 4361 // The synchronous ack is stuck behind the pending touch move.
4356 EXPECT_0_EVENTS(delegate->events()); 4362 EXPECT_0_EVENTS(delegate->events());
4357 4363
4358 delegate->ReceivedAck(); 4364 delegate->ReceivedAck();
4359 EXPECT_2_EVENTS(delegate->events(), ui::ET_GESTURE_SCROLL_UPDATE, 4365 EXPECT_2_EVENTS(delegate->events(), ui::ET_GESTURE_SCROLL_UPDATE,
4360 ui::ET_GESTURE_SCROLL_UPDATE); 4366 ui::ET_GESTURE_SCROLL_UPDATE);
4361 } 4367 }
4362 4368
4363 } // namespace test 4369 } // namespace test
4364 } // namespace aura 4370 } // namespace aura
OLDNEW
« no previous file with comments | « ui/app_list/folder_image.cc ('k') | ui/aura/test/ui_controls_factory_ozone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698