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

Side by Side Diff: ui/views/widget/desktop_aura/desktop_native_widget_aura_unittest.cc

Issue 2256983003: Check Content Window Visibility in DesktopNativeWidgetAura::IsVisible (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: CR Feedback Created 4 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 unified diff | Download patch
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_native_widget_aura.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "ui/views/widget/desktop_aura/desktop_native_widget_aura.h" 5 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/run_loop.h" 9 #include "base/run_loop.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 TEST_F(DesktopNativeWidgetAuraTest, NativeViewInitiallyHidden) { 94 TEST_F(DesktopNativeWidgetAuraTest, NativeViewInitiallyHidden) {
95 Widget widget; 95 Widget widget;
96 Widget::InitParams init_params = 96 Widget::InitParams init_params =
97 CreateParams(Widget::InitParams::TYPE_WINDOW); 97 CreateParams(Widget::InitParams::TYPE_WINDOW);
98 init_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 98 init_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
99 init_params.native_widget = new DesktopNativeWidgetAura(&widget); 99 init_params.native_widget = new DesktopNativeWidgetAura(&widget);
100 widget.Init(init_params); 100 widget.Init(init_params);
101 EXPECT_FALSE(widget.GetNativeView()->IsVisible()); 101 EXPECT_FALSE(widget.GetNativeView()->IsVisible());
102 } 102 }
103 103
104 // Verifies that if the DesktopWindowTreeHost is already shown, the native view
105 // still reports not visible as we haven't shown the content window.
106 TEST_F(DesktopNativeWidgetAuraTest, WidgetNotVisibleOnlyWindowTreeHostShown) {
107 Widget widget;
108 Widget::InitParams init_params =
109 CreateParams(Widget::InitParams::TYPE_WINDOW);
110 init_params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
111 init_params.native_widget = new DesktopNativeWidgetAura(&widget);
112 widget.Init(init_params);
113 DesktopNativeWidgetAura* desktop_native_widget_aura =
114 static_cast<DesktopNativeWidgetAura*>(widget.native_widget());
115 desktop_native_widget_aura->host()->Show();
116 EXPECT_FALSE(widget.IsVisible());
117 }
118
104 // Verify that the cursor state is shared between two native widgets. 119 // Verify that the cursor state is shared between two native widgets.
105 TEST_F(DesktopNativeWidgetAuraTest, GlobalCursorState) { 120 TEST_F(DesktopNativeWidgetAuraTest, GlobalCursorState) {
106 // Create two native widgets, each owning different root windows. 121 // Create two native widgets, each owning different root windows.
107 Widget widget_a; 122 Widget widget_a;
108 Widget::InitParams init_params_a = 123 Widget::InitParams init_params_a =
109 CreateParams(Widget::InitParams::TYPE_WINDOW); 124 CreateParams(Widget::InitParams::TYPE_WINDOW);
110 init_params_a.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 125 init_params_a.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
111 DesktopNativeWidgetAura* desktop_native_widget_aura_a = 126 DesktopNativeWidgetAura* desktop_native_widget_aura_a =
112 new DesktopNativeWidgetAura(&widget_a); 127 new DesktopNativeWidgetAura(&widget_a);
113 init_params_a.native_widget = desktop_native_widget_aura_a; 128 init_params_a.native_widget = desktop_native_widget_aura_a;
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
658 target->HandleKeyboardMessage(WM_CHAR, 0, 0, &handled); 673 target->HandleKeyboardMessage(WM_CHAR, 0, 0, &handled);
659 target->HandleKeyboardMessage(WM_SYSCHAR, 0, 0, &handled); 674 target->HandleKeyboardMessage(WM_SYSCHAR, 0, 0, &handled);
660 target->HandleKeyboardMessage(WM_SYSDEADCHAR, 0, 0, &handled); 675 target->HandleKeyboardMessage(WM_SYSDEADCHAR, 0, 0, &handled);
661 widget.CloseNow(); 676 widget.CloseNow();
662 } 677 }
663 678
664 #endif // defined(OS_WIN) 679 #endif // defined(OS_WIN)
665 680
666 } // namespace test 681 } // namespace test
667 } // namespace views 682 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_native_widget_aura.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698