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

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

Issue 2715743005: Revert of Avoid two targeting phases in aura client-lib and EventProcessor. (Closed)
Patch Set: 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"
11 #include "ui/events/event_utils.h" 10 #include "ui/events/event_utils.h"
12 #include "ui/views/bubble/bubble_border.h" 11 #include "ui/views/bubble/bubble_border.h"
13 #include "ui/views/bubble/bubble_dialog_delegate.h" 12 #include "ui/views/bubble/bubble_dialog_delegate.h"
14 #include "ui/views/test/views_test_base.h" 13 #include "ui/views/test/views_test_base.h"
15 #include "ui/views/widget/widget.h" 14 #include "ui/views/widget/widget.h"
16 15
17 namespace views { 16 namespace views {
18 17
19 namespace { 18 namespace {
20 19
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 80 }
82 81
83 std::unique_ptr<Widget> anchor_; 82 std::unique_ptr<Widget> anchor_;
84 std::unique_ptr<Widget> bubble_widget_; 83 std::unique_ptr<Widget> bubble_widget_;
85 BubbleDialogDelegateView* bubble_delegate_; 84 BubbleDialogDelegateView* bubble_delegate_;
86 85
87 DISALLOW_COPY_AND_ASSIGN(BubbleWindowTargeterTest); 86 DISALLOW_COPY_AND_ASSIGN(BubbleWindowTargeterTest);
88 }; 87 };
89 88
90 TEST_F(BubbleWindowTargeterTest, HitTest) { 89 TEST_F(BubbleWindowTargeterTest, HitTest) {
91 aura::Window* root = bubble_widget()->GetNativeWindow()->GetRootWindow(); 90 ui::EventTarget* root = bubble_widget()->GetNativeWindow()->GetRootWindow();
92 ui::EventTargeter* targeter = 91 ui::EventTargeter* targeter = root->GetEventTargeter();
93 root->GetHost()->dispatcher()->GetDefaultEventTargeter();
94 aura::Window* bubble_window = bubble_widget()->GetNativeWindow(); 92 aura::Window* bubble_window = bubble_widget()->GetNativeWindow();
95 gfx::Rect bubble_bounds = bubble_window->GetBoundsInRootWindow(); 93 gfx::Rect bubble_bounds = bubble_window->GetBoundsInRootWindow();
96 94
97 { 95 {
98 bubble_delegate()->set_margins(gfx::Insets()); 96 bubble_delegate()->set_margins(gfx::Insets());
99 ui::MouseEvent move1(ui::ET_MOUSE_MOVED, bubble_bounds.origin(), 97 ui::MouseEvent move1(ui::ET_MOUSE_MOVED, bubble_bounds.origin(),
100 bubble_bounds.origin(), ui::EventTimeForNow(), 98 bubble_bounds.origin(), ui::EventTimeForNow(),
101 ui::EF_NONE, ui::EF_NONE); 99 ui::EF_NONE, ui::EF_NONE);
102 EXPECT_EQ(bubble_window, targeter->FindTargetForEvent(root, &move1)); 100 EXPECT_EQ(bubble_window, targeter->FindTargetForEvent(root, &move1));
103 } 101 }
(...skipping 10 matching lines...) Expand all
114 { 112 {
115 bubble_delegate()->set_margins(gfx::Insets(20)); 113 bubble_delegate()->set_margins(gfx::Insets(20));
116 ui::MouseEvent move1(ui::ET_MOUSE_MOVED, bubble_bounds.origin(), 114 ui::MouseEvent move1(ui::ET_MOUSE_MOVED, bubble_bounds.origin(),
117 bubble_bounds.origin(), ui::EventTimeForNow(), 115 bubble_bounds.origin(), ui::EventTimeForNow(),
118 ui::EF_NONE, ui::EF_NONE); 116 ui::EF_NONE, ui::EF_NONE);
119 EXPECT_NE(bubble_window, targeter->FindTargetForEvent(root, &move1)); 117 EXPECT_NE(bubble_window, targeter->FindTargetForEvent(root, &move1));
120 } 118 }
121 } 119 }
122 120
123 } // namespace views 121 } // 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