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

Unified Diff: ui/views/focus/focus_manager_unittest.cc

Issue 23475012: Fixes focus traversal bug (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Better docs Created 7 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/focus/focus_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/focus/focus_manager_unittest.cc
diff --git a/ui/views/focus/focus_manager_unittest.cc b/ui/views/focus/focus_manager_unittest.cc
index 51341f56500e68f2f3a2106143886c96dec96870..d712afb412cd755066842023f14f4ef55e104021 100644
--- a/ui/views/focus/focus_manager_unittest.cc
+++ b/ui/views/focus/focus_manager_unittest.cc
@@ -829,4 +829,33 @@ TEST_F(FocusManagerTest, StoreFocusedView) {
EXPECT_EQ(&view, GetFocusManager()->GetStoredFocusView());
}
+// Verifies focus wrapping happens in the same widget.
+TEST_F(FocusManagerTest, AdvanceFocusStaysInWidget) {
+ Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW);
+ params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
+ params.child = true;
+ params.bounds = gfx::Rect(10, 10, 100, 100);
+ params.parent = GetWidget()->GetNativeView();
+ Widget child_widget;
+ child_widget.Init(params);
+
+ View* view1 = new View;
+ view1->set_focusable(true);
+ view1->SetBounds(0, 0, 20, 20);
+ View* view2 = new View;
+ view2->set_focusable(true);
+ view2->SetBounds(20, 0, 20, 20);
+
+ child_widget.client_view()->AddChildView(view1);
+ child_widget.client_view()->AddChildView(view2);
+
+ child_widget.Show();
+
+ // GetFocusManager()->SetFocusedView(view2);
+ view2->RequestFocus();
+ EXPECT_EQ(view2, GetFocusManager()->GetFocusedView());
+ GetFocusManager()->AdvanceFocus(false);
dmazzoni 2013/09/03 16:33:57 Also cycle in the reverse direction for better tes
sky 2013/09/03 16:48:17 Done.
+ EXPECT_EQ(view1, GetFocusManager()->GetFocusedView());
+}
+
} // namespace views
« no previous file with comments | « ui/views/focus/focus_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698