| 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/memory/scoped_vector.h" | 6 #include "base/memory/scoped_vector.h" |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/timer/timer.h" | 9 #include "base/timer/timer.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 run_loop_.reset(new base::RunLoop()); | 193 run_loop_.reset(new base::RunLoop()); |
| 194 run_loop_->Run(); | 194 run_loop_->Run(); |
| 195 } | 195 } |
| 196 | 196 |
| 197 virtual void OnGestureEvent(ui::GestureEvent* gesture) OVERRIDE { | 197 virtual void OnGestureEvent(ui::GestureEvent* gesture) OVERRIDE { |
| 198 events_.push_back(gesture->type()); | 198 events_.push_back(gesture->type()); |
| 199 bounding_box_ = gesture->details().bounding_box(); | 199 bounding_box_ = gesture->details().bounding_box(); |
| 200 flags_ = gesture->flags(); | 200 flags_ = gesture->flags(); |
| 201 switch (gesture->type()) { | 201 switch (gesture->type()) { |
| 202 case ui::ET_GESTURE_TAP: | 202 case ui::ET_GESTURE_TAP: |
| 203 tap_location_ = gesture->location(); | 203 tap_location_ = gfx::ToFlooredPoint(gesture->location()); |
| 204 tap_count_ = gesture->details().tap_count(); | 204 tap_count_ = gesture->details().tap_count(); |
| 205 tap_ = true; | 205 tap_ = true; |
| 206 break; | 206 break; |
| 207 case ui::ET_GESTURE_TAP_DOWN: | 207 case ui::ET_GESTURE_TAP_DOWN: |
| 208 tap_down_ = true; | 208 tap_down_ = true; |
| 209 break; | 209 break; |
| 210 case ui::ET_GESTURE_TAP_CANCEL: | 210 case ui::ET_GESTURE_TAP_CANCEL: |
| 211 tap_cancel_ = true; | 211 tap_cancel_ = true; |
| 212 break; | 212 break; |
| 213 case ui::ET_GESTURE_BEGIN: | 213 case ui::ET_GESTURE_BEGIN: |
| 214 begin_ = true; | 214 begin_ = true; |
| 215 break; | 215 break; |
| 216 case ui::ET_GESTURE_END: | 216 case ui::ET_GESTURE_END: |
| 217 end_ = true; | 217 end_ = true; |
| 218 gesture_end_location_ = gesture->location(); | 218 gesture_end_location_ = gfx::ToFlooredPoint(gesture->location()); |
| 219 break; | 219 break; |
| 220 case ui::ET_GESTURE_SCROLL_BEGIN: | 220 case ui::ET_GESTURE_SCROLL_BEGIN: |
| 221 scroll_begin_ = true; | 221 scroll_begin_ = true; |
| 222 scroll_begin_position_ = gesture->location(); | 222 scroll_begin_position_ = gfx::ToFlooredPoint(gesture->location()); |
| 223 scroll_x_hint_ = gesture->details().scroll_x_hint(); | 223 scroll_x_hint_ = gesture->details().scroll_x_hint(); |
| 224 scroll_y_hint_ = gesture->details().scroll_y_hint(); | 224 scroll_y_hint_ = gesture->details().scroll_y_hint(); |
| 225 break; | 225 break; |
| 226 case ui::ET_GESTURE_SCROLL_UPDATE: | 226 case ui::ET_GESTURE_SCROLL_UPDATE: |
| 227 scroll_update_ = true; | 227 scroll_update_ = true; |
| 228 scroll_x_ += gesture->details().scroll_x(); | 228 scroll_x_ += gesture->details().scroll_x(); |
| 229 scroll_y_ += gesture->details().scroll_y(); | 229 scroll_y_ += gesture->details().scroll_y(); |
| 230 break; | 230 break; |
| 231 case ui::ET_GESTURE_SCROLL_END: | 231 case ui::ET_GESTURE_SCROLL_END: |
| 232 EXPECT_TRUE(velocity_x_ == 0 && velocity_y_ == 0); | 232 EXPECT_TRUE(velocity_x_ == 0 && velocity_y_ == 0); |
| (...skipping 4037 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4270 DispatchEventUsingWindowDispatcher(&move1); | 4270 DispatchEventUsingWindowDispatcher(&move1); |
| 4271 EXPECT_NE(default_flags, delegate->flags()); | 4271 EXPECT_NE(default_flags, delegate->flags()); |
| 4272 } | 4272 } |
| 4273 | 4273 |
| 4274 INSTANTIATE_TEST_CASE_P(GestureRecognizer, | 4274 INSTANTIATE_TEST_CASE_P(GestureRecognizer, |
| 4275 GestureRecognizerTest, | 4275 GestureRecognizerTest, |
| 4276 ::testing::Bool()); | 4276 ::testing::Bool()); |
| 4277 | 4277 |
| 4278 } // namespace test | 4278 } // namespace test |
| 4279 } // namespace aura | 4279 } // namespace aura |
| OLD | NEW |