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

Side by Side Diff: ui/views/widget/widget_interactive_uitest.cc

Issue 108063004: Give up focus if the focused view becomes unfocusable (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Try to advance focus first Created 7 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "ui/gfx/native_widget_types.h" 8 #include "ui/gfx/native_widget_types.h"
9 #include "ui/views/test/widget_test.h" 9 #include "ui/views/test/widget_test.h"
10 #include "ui/views/widget/widget.h" 10 #include "ui/views/widget/widget.h"
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 // created. 155 // created.
156 // 2. If the active aura window in widget 1 created above, is set to NULL when 156 // 2. If the active aura window in widget 1 created above, is set to NULL when
157 // another top level widget is created and focused. 157 // another top level widget is created and focused.
158 // 3. On focusing the native platform window for widget 1, the active aura 158 // 3. On focusing the native platform window for widget 1, the active aura
159 // window for widget 1 should be set and that for widget 2 should reset. 159 // window for widget 1 should be set and that for widget 2 should reset.
160 // TODO(ananta) 160 // TODO(ananta)
161 // Discuss with erg on how to write this test for linux x11 aura. 161 // Discuss with erg on how to write this test for linux x11 aura.
162 TEST_F(WidgetTest, DesktopNativeWidgetAuraActivationAndFocusTest) { 162 TEST_F(WidgetTest, DesktopNativeWidgetAuraActivationAndFocusTest) {
163 // Create widget 1 and expect the active window to be its window. 163 // Create widget 1 and expect the active window to be its window.
164 View* contents_view1 = new View; 164 View* contents_view1 = new View;
165 contents_view1->set_focusable(true); 165 contents_view1->SetFocusable(true);
166 Widget widget1; 166 Widget widget1;
167 Widget::InitParams init_params = 167 Widget::InitParams init_params =
168 CreateParams(Widget::InitParams::TYPE_WINDOW_FRAMELESS); 168 CreateParams(Widget::InitParams::TYPE_WINDOW_FRAMELESS);
169 init_params.bounds = gfx::Rect(0, 0, 200, 200); 169 init_params.bounds = gfx::Rect(0, 0, 200, 200);
170 init_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 170 init_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
171 init_params.native_widget = new DesktopNativeWidgetAura(&widget1); 171 init_params.native_widget = new DesktopNativeWidgetAura(&widget1);
172 widget1.Init(init_params); 172 widget1.Init(init_params);
173 widget1.SetContentsView(contents_view1); 173 widget1.SetContentsView(contents_view1);
174 widget1.Show(); 174 widget1.Show();
175 aura::Window* root_window1= widget1.GetNativeView()->GetRootWindow(); 175 aura::Window* root_window1= widget1.GetNativeView()->GetRootWindow();
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
778 ui::EF_NONE); 778 ui::EF_NONE);
779 widget1.GetNativeWindow()->GetDispatcher()->AsRootWindowHostDelegate()-> 779 widget1.GetNativeWindow()->GetDispatcher()->AsRootWindowHostDelegate()->
780 OnHostMouseEvent(&mouse_event); 780 OnHostMouseEvent(&mouse_event);
781 EXPECT_TRUE(widget1.GetAndClearGotMouseEvent()); 781 EXPECT_TRUE(widget1.GetAndClearGotMouseEvent());
782 EXPECT_FALSE(widget2.GetAndClearGotMouseEvent()); 782 EXPECT_FALSE(widget2.GetAndClearGotMouseEvent());
783 } 783 }
784 #endif 784 #endif
785 785
786 } // namespace test 786 } // namespace test
787 } // namespace views 787 } // namespace views
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698