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 "ash/wm/system_gesture_event_filter.h" | 5 #include "ash/wm/system_gesture_event_filter.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "ash/accelerators/accelerator_controller.h" | 9 #include "ash/accelerators/accelerator_controller.h" |
10 #include "ash/aura/wm_window_aura.h" | 10 #include "ash/aura/wm_window_aura.h" |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 }; | 137 }; |
138 | 138 |
139 ui::GestureEvent* CreateGesture(ui::EventType type, | 139 ui::GestureEvent* CreateGesture(ui::EventType type, |
140 int x, | 140 int x, |
141 int y, | 141 int y, |
142 float delta_x, | 142 float delta_x, |
143 float delta_y, | 143 float delta_y, |
144 int touch_id) { | 144 int touch_id) { |
145 ui::GestureEventDetails details = | 145 ui::GestureEventDetails details = |
146 ui::GestureEventDetails(type, delta_x, delta_y); | 146 ui::GestureEventDetails(type, delta_x, delta_y); |
147 return new ui::GestureEvent(x, y, 0, | 147 return new ui::GestureEvent(x, y, 0, base::TimeTicks::Now(), |
148 base::TimeDelta::FromMilliseconds(base::Time::Now().ToDoubleT() * 1000), | 148 ui::GestureEventDetails(type, delta_x, delta_y)); |
149 ui::GestureEventDetails(type, delta_x, delta_y)); | |
150 } | 149 } |
151 | 150 |
152 TEST_F(SystemGestureEventFilterTest, TwoFingerDrag) { | 151 TEST_F(SystemGestureEventFilterTest, TwoFingerDrag) { |
153 gfx::Rect bounds(0, 0, 600, 600); | 152 gfx::Rect bounds(0, 0, 600, 600); |
154 aura::Window* root_window = Shell::GetPrimaryRootWindow(); | 153 aura::Window* root_window = Shell::GetPrimaryRootWindow(); |
155 views::Widget* toplevel = views::Widget::CreateWindowWithContextAndBounds( | 154 views::Widget* toplevel = views::Widget::CreateWindowWithContextAndBounds( |
156 new ResizableWidgetDelegate, root_window, bounds); | 155 new ResizableWidgetDelegate, root_window, bounds); |
157 toplevel->Show(); | 156 toplevel->Show(); |
158 | 157 |
159 const int kSteps = 15; | 158 const int kSteps = 15; |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 for (int i = 1; i <= 3; ++i) | 477 for (int i = 1; i <= 3; ++i) |
479 GetEventGenerator().ReleaseTouchId(i); | 478 GetEventGenerator().ReleaseTouchId(i); |
480 EXPECT_EQ(event_handler.num_gesture_events(), | 479 EXPECT_EQ(event_handler.num_gesture_events(), |
481 delegate.GetGestureCountAndReset()); | 480 delegate.GetGestureCountAndReset()); |
482 | 481 |
483 aura::Env::GetInstance()->RemovePreTargetHandler(&event_handler); | 482 aura::Env::GetInstance()->RemovePreTargetHandler(&event_handler); |
484 } | 483 } |
485 | 484 |
486 } // namespace test | 485 } // namespace test |
487 } // namespace ash | 486 } // namespace ash |
OLD | NEW |