| 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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
| 6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
| 7 #include "testing/gtest/include/gtest/gtest.h" | 7 #include "testing/gtest/include/gtest/gtest.h" |
| 8 #include "ui/events/event_utils.h" | 8 #include "ui/events/event_utils.h" |
| 9 #include "ui/events/gestures/gesture_provider_impl.h" | 9 #include "ui/events/gestures/gesture_provider_impl.h" |
| 10 | 10 |
| 11 namespace ui { | 11 namespace ui { |
| 12 | 12 |
| 13 class GestureProviderImplTest : public testing::Test, | 13 class GestureProviderImplTest : public testing::Test, |
| 14 public GestureProviderImplClient { | 14 public GestureProviderImplClient { |
| 15 public: | 15 public: |
| 16 GestureProviderImplTest() {} | 16 GestureProviderImplTest() {} |
| 17 | 17 |
| 18 virtual ~GestureProviderImplTest() {} | 18 ~GestureProviderImplTest() override {} |
| 19 | 19 |
| 20 virtual void OnGestureEvent(GestureEvent* event) override {} | 20 void OnGestureEvent(GestureEvent* event) override {} |
| 21 | 21 |
| 22 virtual void SetUp() override { | 22 void SetUp() override { |
| 23 provider_.reset(new GestureProviderImpl(this)); | 23 provider_.reset(new GestureProviderImpl(this)); |
| 24 } | 24 } |
| 25 | 25 |
| 26 virtual void TearDown() override { provider_.reset(); } | 26 void TearDown() override { provider_.reset(); } |
| 27 | 27 |
| 28 GestureProviderImpl* provider() { return provider_.get(); } | 28 GestureProviderImpl* provider() { return provider_.get(); } |
| 29 | 29 |
| 30 private: | 30 private: |
| 31 scoped_ptr<GestureProviderImpl> provider_; | 31 scoped_ptr<GestureProviderImpl> provider_; |
| 32 base::MessageLoopForUI message_loop_; | 32 base::MessageLoopForUI message_loop_; |
| 33 }; | 33 }; |
| 34 | 34 |
| 35 TEST_F(GestureProviderImplTest, IgnoresExtraPressEvents) { | 35 TEST_F(GestureProviderImplTest, IgnoresExtraPressEvents) { |
| 36 base::TimeDelta time = ui::EventTimeForNow(); | 36 base::TimeDelta time = ui::EventTimeForNow(); |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 kRadiusX, kRadiusY, kAngle, kForce); | 101 kRadiusX, kRadiusY, kAngle, kForce); |
| 102 // Position has changed, so don't ignore the move. | 102 // Position has changed, so don't ignore the move. |
| 103 EXPECT_TRUE(provider()->OnTouchEvent(move0_3)); | 103 EXPECT_TRUE(provider()->OnTouchEvent(move0_3)); |
| 104 | 104 |
| 105 time += base::TimeDelta::FromMilliseconds(10); | 105 time += base::TimeDelta::FromMilliseconds(10); |
| 106 TouchEvent move0_4(ET_TOUCH_MOVED, gfx::PointF(70, 75.1f), 0, kTouchId0, time, | 106 TouchEvent move0_4(ET_TOUCH_MOVED, gfx::PointF(70, 75.1f), 0, kTouchId0, time, |
| 107 kRadiusX, kRadiusY + 1, kAngle, kForce); | 107 kRadiusX, kRadiusY + 1, kAngle, kForce); |
| 108 } | 108 } |
| 109 | 109 |
| 110 } // namespace ui | 110 } // namespace ui |
| OLD | NEW |