OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_targeter.h" | 5 #include "ui/aura/window_targeter.h" |
6 | 6 |
7 #include "ui/aura/scoped_window_targeter.h" | 7 #include "ui/aura/scoped_window_targeter.h" |
8 #include "ui/aura/test/aura_test_base.h" | 8 #include "ui/aura/test/aura_test_base.h" |
9 #include "ui/aura/test/test_window_delegate.h" | 9 #include "ui/aura/test/test_window_delegate.h" |
10 #include "ui/aura/window.h" | 10 #include "ui/aura/window.h" |
11 #include "ui/events/event_utils.h" | 11 #include "ui/events/event_utils.h" |
12 #include "ui/events/test/test_event_handler.h" | 12 #include "ui/events/test/test_event_handler.h" |
13 | 13 |
14 namespace aura { | 14 namespace aura { |
15 | 15 |
16 // Always returns the same window. | 16 // Always returns the same window. |
17 class StaticWindowTargeter : public ui::EventTargeter { | 17 class StaticWindowTargeter : public WindowTargeter { |
18 public: | 18 public: |
19 explicit StaticWindowTargeter(aura::Window* window) | 19 explicit StaticWindowTargeter(aura::Window* window) |
20 : window_(window) {} | 20 : window_(window) {} |
21 ~StaticWindowTargeter() override {} | 21 ~StaticWindowTargeter() override {} |
22 | 22 |
23 private: | 23 private: |
24 // ui::EventTargeter: | 24 // ui::EventTargeter: |
25 ui::EventTarget* FindTargetForLocatedEvent(ui::EventTarget* root, | 25 ui::EventTarget* FindTargetForLocatedEvent(ui::EventTarget* root, |
26 ui::LocatedEvent* event) override { | 26 ui::LocatedEvent* event) override { |
27 return window_; | 27 return window_; |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 EXPECT_EQ(gfx::RectF(300, 30, 200, 40).ToString(), | 169 EXPECT_EQ(gfx::RectF(300, 30, 200, 40).ToString(), |
170 GetEffectiveVisibleBoundsInRootWindow(window.get()).ToString()); | 170 GetEffectiveVisibleBoundsInRootWindow(window.get()).ToString()); |
171 { | 171 { |
172 ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, event_location, event_location, | 172 ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, event_location, event_location, |
173 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); | 173 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); |
174 EXPECT_EQ(window.get(), targeter->FindTargetForEvent(root_target, &mouse)); | 174 EXPECT_EQ(window.get(), targeter->FindTargetForEvent(root_target, &mouse)); |
175 } | 175 } |
176 } | 176 } |
177 | 177 |
178 } // namespace aura | 178 } // namespace aura |
OLD | NEW |