| 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_event_handler.h" | 9 #include "ui/aura/test/test_event_handler.h" |
| 10 #include "ui/aura/test/test_window_delegate.h" | 10 #include "ui/aura/test/test_window_delegate.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 root_window()->Show(); | 53 root_window()->Show(); |
| 54 | 54 |
| 55 test::TestEventHandler handler; | 55 test::TestEventHandler handler; |
| 56 one->AddPreTargetHandler(&handler); | 56 one->AddPreTargetHandler(&handler); |
| 57 | 57 |
| 58 ui::MouseEvent press(ui::ET_MOUSE_PRESSED, | 58 ui::MouseEvent press(ui::ET_MOUSE_PRESSED, |
| 59 gfx::Point(20, 20), | 59 gfx::Point(20, 20), |
| 60 gfx::Point(20, 20), | 60 gfx::Point(20, 20), |
| 61 ui::EF_NONE, | 61 ui::EF_NONE, |
| 62 ui::EF_NONE); | 62 ui::EF_NONE); |
| 63 root_window()->GetDispatcher()->AsWindowTreeHostDelegate()-> | 63 DispatchEventUsingWindowDispatcher(&press); |
| 64 OnHostMouseEvent(&press); | |
| 65 EXPECT_EQ(1, handler.num_mouse_events()); | 64 EXPECT_EQ(1, handler.num_mouse_events()); |
| 66 | 65 |
| 67 handler.Reset(); | 66 handler.Reset(); |
| 68 ui::EventDispatchDetails details = | 67 DispatchEventUsingWindowDispatcher(&press); |
| 69 root_window()->GetDispatcher()->OnEventFromSource(&press); | |
| 70 EXPECT_FALSE(details.dispatcher_destroyed); | |
| 71 EXPECT_EQ(1, handler.num_mouse_events()); | 68 EXPECT_EQ(1, handler.num_mouse_events()); |
| 72 | 69 |
| 73 one->RemovePreTargetHandler(&handler); | 70 one->RemovePreTargetHandler(&handler); |
| 74 } | 71 } |
| 75 | 72 |
| 76 TEST_F(WindowTargeterTest, ScopedWindowTargeter) { | 73 TEST_F(WindowTargeterTest, ScopedWindowTargeter) { |
| 77 test::TestWindowDelegate delegate; | 74 test::TestWindowDelegate delegate; |
| 78 scoped_ptr<Window> window(CreateNormalWindow(1, root_window(), &delegate)); | 75 scoped_ptr<Window> window(CreateNormalWindow(1, root_window(), &delegate)); |
| 79 Window* child = CreateNormalWindow(2, window.get(), &delegate); | 76 Window* child = CreateNormalWindow(2, window.get(), &delegate); |
| 80 | 77 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 103 } | 100 } |
| 104 scoped_targeter.reset(); | 101 scoped_targeter.reset(); |
| 105 { | 102 { |
| 106 ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, event_location, event_location, | 103 ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, event_location, event_location, |
| 107 ui::EF_NONE, ui::EF_NONE); | 104 ui::EF_NONE, ui::EF_NONE); |
| 108 EXPECT_EQ(child, targeter->FindTargetForEvent(root, &mouse)); | 105 EXPECT_EQ(child, targeter->FindTargetForEvent(root, &mouse)); |
| 109 } | 106 } |
| 110 } | 107 } |
| 111 | 108 |
| 112 } // namespace aura | 109 } // namespace aura |
| OLD | NEW |