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

Side by Side Diff: ui/views/focus/focus_manager_unittest.cc

Issue 2049723002: views/mus: Chaneg how Widget activation works in mus. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | « no previous file | ui/views/mus/BUILD.gn » ('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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/focus/focus_manager.h" 5 #include "ui/views/focus/focus_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 Widget* widget_; 859 Widget* widget_;
860 bool should_advance_focus_to_parent_; 860 bool should_advance_focus_to_parent_;
861 861
862 DISALLOW_COPY_AND_ASSIGN(AdvanceFocusWidgetDelegate); 862 DISALLOW_COPY_AND_ASSIGN(AdvanceFocusWidgetDelegate);
863 }; 863 };
864 864
865 } // namespace 865 } // namespace
866 866
867 // Verifies focus wrapping happens in the same widget. 867 // Verifies focus wrapping happens in the same widget.
868 TEST_F(FocusManagerTest, AdvanceFocusStaysInWidget) { 868 TEST_F(FocusManagerTest, AdvanceFocusStaysInWidget) {
869 // Mus doesn't support child Widgets well yet. https://crbug.com/612820
870 if (IsMus())
871 return;
869 // Add |widget_view| as a child of the Widget. 872 // Add |widget_view| as a child of the Widget.
870 View* widget_view = new View; 873 View* widget_view = new View;
871 widget_view->SetFocusBehavior(View::FocusBehavior::ALWAYS); 874 widget_view->SetFocusBehavior(View::FocusBehavior::ALWAYS);
872 widget_view->SetBounds(20, 0, 20, 20); 875 widget_view->SetBounds(20, 0, 20, 20);
873 GetContentsView()->AddChildView(widget_view); 876 GetContentsView()->AddChildView(widget_view);
874 877
875 // Create a widget with two views, focus the second. 878 // Create a widget with two views, focus the second.
876 std::unique_ptr<AdvanceFocusWidgetDelegate> delegate; 879 std::unique_ptr<AdvanceFocusWidgetDelegate> delegate;
877 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW); 880 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW);
878 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 881 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
(...skipping 29 matching lines...) Expand all
908 EXPECT_EQ(view1, GetFocusManager()->GetFocusedView()); 911 EXPECT_EQ(view1, GetFocusManager()->GetFocusedView());
909 912
910 // Allow focus to go to the parent, and focus backwards which should now move 913 // Allow focus to go to the parent, and focus backwards which should now move
911 // up |widget_view| (in the parent). 914 // up |widget_view| (in the parent).
912 delegate->set_should_advance_focus_to_parent(true); 915 delegate->set_should_advance_focus_to_parent(true);
913 GetFocusManager()->AdvanceFocus(true); 916 GetFocusManager()->AdvanceFocus(true);
914 EXPECT_EQ(widget_view, GetFocusManager()->GetFocusedView()); 917 EXPECT_EQ(widget_view, GetFocusManager()->GetFocusedView());
915 } 918 }
916 919
917 } // namespace views 920 } // namespace views
OLDNEW
« no previous file with comments | « no previous file | ui/views/mus/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698