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

Side by Side Diff: ui/views/bubble/bubble_window_targeter_unittest.cc

Issue 2681613002: Avoid two targeting phases in aura client-lib and EventProcessor. (Closed)
Patch Set: early return Created 3 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
« no previous file with comments | « ui/events/test/test_event_processor.cc ('k') | ui/views/test/event_generator_delegate_mac.mm » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/views/bubble/bubble_window_targeter.h" 5 #include "ui/views/bubble/bubble_window_targeter.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "ui/aura/window.h" 8 #include "ui/aura/window.h"
9 #include "ui/aura/window_event_dispatcher.h" 9 #include "ui/aura/window_event_dispatcher.h"
10 #include "ui/aura/window_tree_host.h"
10 #include "ui/events/event_utils.h" 11 #include "ui/events/event_utils.h"
11 #include "ui/views/bubble/bubble_border.h" 12 #include "ui/views/bubble/bubble_border.h"
12 #include "ui/views/bubble/bubble_dialog_delegate.h" 13 #include "ui/views/bubble/bubble_dialog_delegate.h"
13 #include "ui/views/test/views_test_base.h" 14 #include "ui/views/test/views_test_base.h"
14 #include "ui/views/widget/widget.h" 15 #include "ui/views/widget/widget.h"
15 16
16 namespace views { 17 namespace views {
17 18
18 namespace { 19 namespace {
19 20
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 } 81 }
81 82
82 std::unique_ptr<Widget> anchor_; 83 std::unique_ptr<Widget> anchor_;
83 std::unique_ptr<Widget> bubble_widget_; 84 std::unique_ptr<Widget> bubble_widget_;
84 BubbleDialogDelegateView* bubble_delegate_; 85 BubbleDialogDelegateView* bubble_delegate_;
85 86
86 DISALLOW_COPY_AND_ASSIGN(BubbleWindowTargeterTest); 87 DISALLOW_COPY_AND_ASSIGN(BubbleWindowTargeterTest);
87 }; 88 };
88 89
89 TEST_F(BubbleWindowTargeterTest, HitTest) { 90 TEST_F(BubbleWindowTargeterTest, HitTest) {
90 ui::EventTarget* root = bubble_widget()->GetNativeWindow()->GetRootWindow(); 91 aura::Window* root = bubble_widget()->GetNativeWindow()->GetRootWindow();
91 ui::EventTargeter* targeter = root->GetEventTargeter(); 92 ui::EventTargeter* targeter =
93 root->GetHost()->dispatcher()->GetDefaultEventTargeter();
92 aura::Window* bubble_window = bubble_widget()->GetNativeWindow(); 94 aura::Window* bubble_window = bubble_widget()->GetNativeWindow();
93 gfx::Rect bubble_bounds = bubble_window->GetBoundsInRootWindow(); 95 gfx::Rect bubble_bounds = bubble_window->GetBoundsInRootWindow();
94 96
95 { 97 {
96 bubble_delegate()->set_margins(gfx::Insets()); 98 bubble_delegate()->set_margins(gfx::Insets());
97 ui::MouseEvent move1(ui::ET_MOUSE_MOVED, bubble_bounds.origin(), 99 ui::MouseEvent move1(ui::ET_MOUSE_MOVED, bubble_bounds.origin(),
98 bubble_bounds.origin(), ui::EventTimeForNow(), 100 bubble_bounds.origin(), ui::EventTimeForNow(),
99 ui::EF_NONE, ui::EF_NONE); 101 ui::EF_NONE, ui::EF_NONE);
100 EXPECT_EQ(bubble_window, targeter->FindTargetForEvent(root, &move1)); 102 EXPECT_EQ(bubble_window, targeter->FindTargetForEvent(root, &move1));
101 } 103 }
(...skipping 10 matching lines...) Expand all
112 { 114 {
113 bubble_delegate()->set_margins(gfx::Insets(20)); 115 bubble_delegate()->set_margins(gfx::Insets(20));
114 ui::MouseEvent move1(ui::ET_MOUSE_MOVED, bubble_bounds.origin(), 116 ui::MouseEvent move1(ui::ET_MOUSE_MOVED, bubble_bounds.origin(),
115 bubble_bounds.origin(), ui::EventTimeForNow(), 117 bubble_bounds.origin(), ui::EventTimeForNow(),
116 ui::EF_NONE, ui::EF_NONE); 118 ui::EF_NONE, ui::EF_NONE);
117 EXPECT_NE(bubble_window, targeter->FindTargetForEvent(root, &move1)); 119 EXPECT_NE(bubble_window, targeter->FindTargetForEvent(root, &move1));
118 } 120 }
119 } 121 }
120 122
121 } // namespace views 123 } // namespace views
OLDNEW
« no previous file with comments | « ui/events/test/test_event_processor.cc ('k') | ui/views/test/event_generator_delegate_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698