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/test/test_event_handler.h" | 11 #include "ui/events/test/test_event_handler.h" |
12 | 12 |
13 namespace aura { | 13 namespace aura { |
14 | 14 |
15 // Always returns the same window. | 15 // Always returns the same window. |
16 class StaticWindowTargeter : public ui::EventTargeter { | 16 class StaticWindowTargeter : public ui::EventTargeter { |
17 public: | 17 public: |
18 explicit StaticWindowTargeter(aura::Window* window) | 18 explicit StaticWindowTargeter(aura::Window* window) |
19 : window_(window) {} | 19 : window_(window) {} |
20 virtual ~StaticWindowTargeter() {} | 20 virtual ~StaticWindowTargeter() {} |
21 | 21 |
22 private: | 22 private: |
23 // ui::EventTargeter: | 23 // ui::EventTargeter: |
24 virtual ui::EventTarget* FindTargetForLocatedEvent( | 24 virtual ui::EventTarget* FindTargetForLocatedEvent( |
25 ui::EventTarget* root, | 25 ui::EventTarget* root, |
26 ui::LocatedEvent* event) OVERRIDE { | 26 ui::LocatedEvent* event) override { |
27 return window_; | 27 return window_; |
28 } | 28 } |
29 | 29 |
30 Window* window_; | 30 Window* window_; |
31 | 31 |
32 DISALLOW_COPY_AND_ASSIGN(StaticWindowTargeter); | 32 DISALLOW_COPY_AND_ASSIGN(StaticWindowTargeter); |
33 }; | 33 }; |
34 | 34 |
35 class WindowTargeterTest : public test::AuraTestBase { | 35 class WindowTargeterTest : public test::AuraTestBase { |
36 public: | 36 public: |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 EXPECT_EQ(gfx::RectF(300, 30, 200, 40).ToString(), | 171 EXPECT_EQ(gfx::RectF(300, 30, 200, 40).ToString(), |
172 GetEffectiveVisibleBoundsInRootWindow(window.get()).ToString()); | 172 GetEffectiveVisibleBoundsInRootWindow(window.get()).ToString()); |
173 { | 173 { |
174 ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, event_location, event_location, | 174 ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, event_location, event_location, |
175 ui::EF_NONE, ui::EF_NONE); | 175 ui::EF_NONE, ui::EF_NONE); |
176 EXPECT_EQ(window.get(), targeter->FindTargetForEvent(root_target, &mouse)); | 176 EXPECT_EQ(window.get(), targeter->FindTargetForEvent(root_target, &mouse)); |
177 } | 177 } |
178 } | 178 } |
179 | 179 |
180 } // namespace aura | 180 } // namespace aura |
OLD | NEW |