| 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 "ui/views/view_targeter.h" | 5 #include "ui/views/view_targeter.h" |
| 6 | 6 |
| 7 #include "base/macros.h" | 7 #include "base/macros.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "ui/events/event_targeter.h" | 9 #include "ui/events/event_targeter.h" |
| 10 #include "ui/events/event_utils.h" | 10 #include "ui/events/event_utils.h" |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 EXPECT_EQ(content, static_cast<View*>(current_target)); | 226 EXPECT_EQ(content, static_cast<View*>(current_target)); |
| 227 } | 227 } |
| 228 | 228 |
| 229 // Convenience to make constructing a GestureEvent simpler. | 229 // Convenience to make constructing a GestureEvent simpler. |
| 230 class GestureEventForTest : public ui::GestureEvent { | 230 class GestureEventForTest : public ui::GestureEvent { |
| 231 public: | 231 public: |
| 232 GestureEventForTest(ui::EventType type, int x, int y) | 232 GestureEventForTest(ui::EventType type, int x, int y) |
| 233 : GestureEvent(x, | 233 : GestureEvent(x, |
| 234 y, | 234 y, |
| 235 0, | 235 0, |
| 236 base::TimeDelta(), | 236 base::TimeTicks(), |
| 237 ui::GestureEventDetails(type)) {} | 237 ui::GestureEventDetails(type)) {} |
| 238 | 238 |
| 239 GestureEventForTest(ui::GestureEventDetails details) | 239 GestureEventForTest(ui::GestureEventDetails details) |
| 240 : GestureEvent(details.bounding_box().CenterPoint().x(), | 240 : GestureEvent(details.bounding_box().CenterPoint().x(), |
| 241 details.bounding_box().CenterPoint().y(), | 241 details.bounding_box().CenterPoint().y(), |
| 242 0, | 242 0, |
| 243 base::TimeDelta(), | 243 base::TimeTicks(), |
| 244 details) {} | 244 details) {} |
| 245 }; | 245 }; |
| 246 | 246 |
| 247 // Verifies that the the functions ViewTargeter::FindTargetForEvent() | 247 // Verifies that the the functions ViewTargeter::FindTargetForEvent() |
| 248 // and ViewTargeter::FindNextBestTarget() are implemented correctly | 248 // and ViewTargeter::FindNextBestTarget() are implemented correctly |
| 249 // for gesture events. | 249 // for gesture events. |
| 250 TEST_F(ViewTargeterTest, ViewTargeterForGestureEvents) { | 250 TEST_F(ViewTargeterTest, ViewTargeterForGestureEvents) { |
| 251 Widget widget; | 251 Widget widget; |
| 252 Widget::InitParams init_params = CreateParams(Widget::InitParams::TYPE_POPUP); | 252 Widget::InitParams init_params = CreateParams(Widget::InitParams::TYPE_POPUP); |
| 253 init_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 253 init_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
| (...skipping 411 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 665 EXPECT_EQ(v1, root_view->GetTooltipHandlerForPoint(v1_origin)); | 665 EXPECT_EQ(v1, root_view->GetTooltipHandlerForPoint(v1_origin)); |
| 666 EXPECT_EQ(root_view, root_view->GetTooltipHandlerForPoint(v2_origin)); | 666 EXPECT_EQ(root_view, root_view->GetTooltipHandlerForPoint(v2_origin)); |
| 667 | 667 |
| 668 EXPECT_FALSE(v1->GetTooltipHandlerForPoint(v2_origin)); | 668 EXPECT_FALSE(v1->GetTooltipHandlerForPoint(v2_origin)); |
| 669 | 669 |
| 670 widget->CloseNow(); | 670 widget->CloseNow(); |
| 671 } | 671 } |
| 672 | 672 |
| 673 } // namespace test | 673 } // namespace test |
| 674 } // namespace views | 674 } // namespace views |
| OLD | NEW |