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

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

Issue 206593004: Move TestEventHandler to ui/events/test (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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/window_event_dispatcher_unittest.cc ('k') | ui/events/events.gyp » ('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"
10 #include "ui/aura/test/test_window_delegate.h" 9 #include "ui/aura/test/test_window_delegate.h"
11 #include "ui/aura/window.h" 10 #include "ui/aura/window.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
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 scoped_ptr<Window> window(CreateNormalWindow(1, root_window(), &delegate)); 57 scoped_ptr<Window> window(CreateNormalWindow(1, root_window(), &delegate));
58 Window* one = CreateNormalWindow(2, window.get(), &delegate); 58 Window* one = CreateNormalWindow(2, window.get(), &delegate);
59 Window* two = CreateNormalWindow(3, window.get(), &delegate); 59 Window* two = CreateNormalWindow(3, window.get(), &delegate);
60 60
61 window->SetBounds(gfx::Rect(0, 0, 100, 100)); 61 window->SetBounds(gfx::Rect(0, 0, 100, 100));
62 one->SetBounds(gfx::Rect(0, 0, 500, 100)); 62 one->SetBounds(gfx::Rect(0, 0, 500, 100));
63 two->SetBounds(gfx::Rect(501, 0, 500, 1000)); 63 two->SetBounds(gfx::Rect(501, 0, 500, 1000));
64 64
65 root_window()->Show(); 65 root_window()->Show();
66 66
67 test::TestEventHandler handler; 67 ui::test::TestEventHandler handler;
68 one->AddPreTargetHandler(&handler); 68 one->AddPreTargetHandler(&handler);
69 69
70 ui::MouseEvent press(ui::ET_MOUSE_PRESSED, 70 ui::MouseEvent press(ui::ET_MOUSE_PRESSED,
71 gfx::Point(20, 20), 71 gfx::Point(20, 20),
72 gfx::Point(20, 20), 72 gfx::Point(20, 20),
73 ui::EF_NONE, 73 ui::EF_NONE,
74 ui::EF_NONE); 74 ui::EF_NONE);
75 DispatchEventUsingWindowDispatcher(&press); 75 DispatchEventUsingWindowDispatcher(&press);
76 EXPECT_EQ(1, handler.num_mouse_events()); 76 EXPECT_EQ(1, handler.num_mouse_events());
77 77
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 EXPECT_EQ(gfx::RectF(300, 30, 200, 40).ToString(), 156 EXPECT_EQ(gfx::RectF(300, 30, 200, 40).ToString(),
157 GetEffectiveVisibleBoundsInRootWindow(window.get()).ToString()); 157 GetEffectiveVisibleBoundsInRootWindow(window.get()).ToString());
158 { 158 {
159 ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, event_location, event_location, 159 ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, event_location, event_location,
160 ui::EF_NONE, ui::EF_NONE); 160 ui::EF_NONE, ui::EF_NONE);
161 EXPECT_EQ(window.get(), targeter->FindTargetForEvent(root_target, &mouse)); 161 EXPECT_EQ(window.get(), targeter->FindTargetForEvent(root_target, &mouse));
162 } 162 }
163 } 163 }
164 164
165 } // namespace aura 165 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/window_event_dispatcher_unittest.cc ('k') | ui/events/events.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698