OLD | NEW |
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/view_targeter.h" | 5 #include "ui/views/view_targeter.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
9 #include "ui/events/event_targeter.h" | 9 #include "ui/events/event_targeter.h" |
10 #include "ui/events/event_utils.h" | 10 #include "ui/events/event_utils.h" |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 | 118 |
119 // Verifies that the the functions ViewTargeter::FindTargetForEvent() | 119 // Verifies that the the functions ViewTargeter::FindTargetForEvent() |
120 // and ViewTargeter::FindNextBestTarget() are implemented correctly | 120 // and ViewTargeter::FindNextBestTarget() are implemented correctly |
121 // for key events. | 121 // for key events. |
122 TEST_F(ViewTargeterTest, ViewTargeterForKeyEvents) { | 122 TEST_F(ViewTargeterTest, ViewTargeterForKeyEvents) { |
123 Widget widget; | 123 Widget widget; |
124 Widget::InitParams init_params = | 124 Widget::InitParams init_params = |
125 CreateParams(Widget::InitParams::TYPE_POPUP); | 125 CreateParams(Widget::InitParams::TYPE_POPUP); |
126 init_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 126 init_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
127 widget.Init(init_params); | 127 widget.Init(init_params); |
| 128 widget.Show(); |
128 | 129 |
129 View* content = new View; | 130 View* content = new View; |
130 View* child = new View; | 131 View* child = new View; |
131 View* grandchild = new View; | 132 View* grandchild = new View; |
132 | 133 |
133 widget.SetContentsView(content); | 134 widget.SetContentsView(content); |
134 content->AddChildView(child); | 135 content->AddChildView(child); |
135 child->AddChildView(grandchild); | 136 child->AddChildView(grandchild); |
136 | 137 |
137 grandchild->SetFocusBehavior(View::FocusBehavior::ALWAYS); | 138 grandchild->SetFocusBehavior(View::FocusBehavior::ALWAYS); |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
665 EXPECT_EQ(v1, root_view->GetTooltipHandlerForPoint(v1_origin)); | 666 EXPECT_EQ(v1, root_view->GetTooltipHandlerForPoint(v1_origin)); |
666 EXPECT_EQ(root_view, root_view->GetTooltipHandlerForPoint(v2_origin)); | 667 EXPECT_EQ(root_view, root_view->GetTooltipHandlerForPoint(v2_origin)); |
667 | 668 |
668 EXPECT_FALSE(v1->GetTooltipHandlerForPoint(v2_origin)); | 669 EXPECT_FALSE(v1->GetTooltipHandlerForPoint(v2_origin)); |
669 | 670 |
670 widget->CloseNow(); | 671 widget->CloseNow(); |
671 } | 672 } |
672 | 673 |
673 } // namespace test | 674 } // namespace test |
674 } // namespace views | 675 } // namespace views |
OLD | NEW |