Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(305)

Side by Side Diff: ui/aura/window_targeter_unittest.cc

Issue 147203004: aura: Remove event-dispatch methods from WindowTreeHostDelegate interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: win Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/aura/test/event_generator.cc ('k') | ui/aura/window_tree_host_delegate.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « ui/aura/test/event_generator.cc ('k') | ui/aura/window_tree_host_delegate.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698