| 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 "ui/aura/window.h" | 5 #include "ui/aura/window.h" |
| 6 | 6 |
| 7 #include <limits.h> | 7 #include <limits.h> |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 } | 284 } |
| 285 | 285 |
| 286 const gfx::Point& position() const { return position_; } | 286 const gfx::Point& position() const { return position_; } |
| 287 | 287 |
| 288 private: | 288 private: |
| 289 gfx::Point position_; | 289 gfx::Point position_; |
| 290 | 290 |
| 291 DISALLOW_COPY_AND_ASSIGN(GestureTrackPositionDelegate); | 291 DISALLOW_COPY_AND_ASSIGN(GestureTrackPositionDelegate); |
| 292 }; | 292 }; |
| 293 | 293 |
| 294 base::TimeDelta getTime() { | 294 base::TimeTicks getTime() { |
| 295 return ui::EventTimeForNow(); | 295 return ui::EventTimeForNow(); |
| 296 } | 296 } |
| 297 | 297 |
| 298 class SelfEventHandlingWindowDelegate : public TestWindowDelegate { | 298 class SelfEventHandlingWindowDelegate : public TestWindowDelegate { |
| 299 public: | 299 public: |
| 300 SelfEventHandlingWindowDelegate() {} | 300 SelfEventHandlingWindowDelegate() {} |
| 301 | 301 |
| 302 bool ShouldDescendIntoChildForEventHandling( | 302 bool ShouldDescendIntoChildForEventHandling( |
| 303 Window* child, | 303 Window* child, |
| 304 const gfx::Point& location) override { | 304 const gfx::Point& location) override { |
| (...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 928 EXPECT_EQ(0, delegate1.gesture_event_count()); | 928 EXPECT_EQ(0, delegate1.gesture_event_count()); |
| 929 EXPECT_EQ(0, delegate1.touch_event_count()); | 929 EXPECT_EQ(0, delegate1.touch_event_count()); |
| 930 EXPECT_EQ(0, delegate2.gesture_event_count()); | 930 EXPECT_EQ(0, delegate2.gesture_event_count()); |
| 931 EXPECT_EQ(0, delegate2.touch_event_count()); | 931 EXPECT_EQ(0, delegate2.touch_event_count()); |
| 932 } | 932 } |
| 933 | 933 |
| 934 TEST_F(WindowTest, TouchCaptureDoesntCancelCapturedTouches) { | 934 TEST_F(WindowTest, TouchCaptureDoesntCancelCapturedTouches) { |
| 935 CaptureWindowDelegateImpl delegate; | 935 CaptureWindowDelegateImpl delegate; |
| 936 std::unique_ptr<Window> window(CreateTestWindowWithDelegate( | 936 std::unique_ptr<Window> window(CreateTestWindowWithDelegate( |
| 937 &delegate, 0, gfx::Rect(0, 0, 50, 50), root_window())); | 937 &delegate, 0, gfx::Rect(0, 0, 50, 50), root_window())); |
| 938 base::TimeDelta time = getTime(); | 938 base::TimeTicks time = getTime(); |
| 939 const int kTimeDelta = 100; | 939 const int kTimeDelta = 100; |
| 940 | 940 |
| 941 ui::TouchEvent press( | 941 ui::TouchEvent press( |
| 942 ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, time); | 942 ui::ET_TOUCH_PRESSED, gfx::Point(10, 10), 0, time); |
| 943 DispatchEventUsingWindowDispatcher(&press); | 943 DispatchEventUsingWindowDispatcher(&press); |
| 944 | 944 |
| 945 // We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN. | 945 // We will get both GESTURE_BEGIN and GESTURE_TAP_DOWN. |
| 946 EXPECT_EQ(2, delegate.gesture_event_count()); | 946 EXPECT_EQ(2, delegate.gesture_event_count()); |
| 947 EXPECT_EQ(1, delegate.touch_event_count()); | 947 EXPECT_EQ(1, delegate.touch_event_count()); |
| 948 delegate.ResetCounts(); | 948 delegate.ResetCounts(); |
| (...skipping 2032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2981 | 2981 |
| 2982 EXPECT_TRUE(animator.get()); | 2982 EXPECT_TRUE(animator.get()); |
| 2983 EXPECT_FALSE(animator->is_animating()); | 2983 EXPECT_FALSE(animator->is_animating()); |
| 2984 EXPECT_TRUE(observer.animation_completed()); | 2984 EXPECT_TRUE(observer.animation_completed()); |
| 2985 EXPECT_FALSE(observer.animation_aborted()); | 2985 EXPECT_FALSE(observer.animation_aborted()); |
| 2986 animator->RemoveObserver(&observer); | 2986 animator->RemoveObserver(&observer); |
| 2987 } | 2987 } |
| 2988 | 2988 |
| 2989 } // namespace test | 2989 } // namespace test |
| 2990 } // namespace aura | 2990 } // namespace aura |
| OLD | NEW |