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

Unified Diff: ui/views/widget/widget_interactive_uitest.cc

Issue 1859283003: Avoid restoring maximized window down when going fullscreen. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « no previous file | ui/views/win/fullscreen_handler.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/widget_interactive_uitest.cc
diff --git a/ui/views/widget/widget_interactive_uitest.cc b/ui/views/widget/widget_interactive_uitest.cc
index a946d93c94e662b4e50a3a022f7a9db02efaa1ed..071be4550b91d5e1dbe889a3e44fc418ea11c7bb 100644
--- a/ui/views/widget/widget_interactive_uitest.cc
+++ b/ui/views/widget/widget_interactive_uitest.cc
@@ -842,6 +842,56 @@ TEST_F(WidgetTestInteractive, FullscreenBoundsReducedOnActivationLoss) {
widget1.CloseNow();
widget2.CloseNow();
}
+
+// Ensure the window rect and client rects are correct with a window that was
+// maximized.
+TEST_F(WidgetTestInteractive, FullscreenMaximizedWindowBounds) {
+ Widget widget;
+ Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW);
+ params.native_widget = new DesktopNativeWidgetAura(&widget);
+ params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
+ widget.set_frame_type(Widget::FRAME_TYPE_FORCE_CUSTOM);
+ widget.Init(params);
+ widget.SetBounds(gfx::Rect(0, 0, 200, 200));
+ widget.Show();
+
+ widget.Maximize();
+ EXPECT_TRUE(widget.IsMaximized());
+
+ widget.SetFullscreen(true);
+ EXPECT_TRUE(widget.IsFullscreen());
+ EXPECT_FALSE(widget.IsMaximized());
+ // Ensure that the StopIgnoringPosChanges task in HWNDMessageHandler runs.
+ // This task is queued when a widget becomes fullscreen.
+ RunPendingMessages();
+
+ aura::WindowTreeHost* host = widget.GetNativeWindow()->GetHost();
+ HWND hwnd = host->GetAcceleratedWidget();
+
+ HMONITOR monitor = ::MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST);
+ ASSERT_TRUE(!!monitor);
+ MONITORINFO monitor_info;
+ monitor_info.cbSize = sizeof(monitor_info);
+ ASSERT_TRUE(::GetMonitorInfo(monitor, &monitor_info));
+
+ gfx::Rect monitor_bounds(monitor_info.rcMonitor);
+ gfx::Rect window_bounds = widget.GetWindowBoundsInScreen();
+ gfx::Rect client_area_bounds = host->GetBounds();
+
+ EXPECT_EQ(window_bounds, monitor_bounds);
+ EXPECT_EQ(monitor_bounds, client_area_bounds);
+
+ // Setting not fullscreen should return it to maximized.
+ widget.SetFullscreen(false);
+ EXPECT_FALSE(widget.IsFullscreen());
+ EXPECT_TRUE(widget.IsMaximized());
+
+ client_area_bounds = host->GetBounds();
+ EXPECT_TRUE(monitor_bounds.Contains(client_area_bounds));
+ EXPECT_NE(monitor_bounds, client_area_bounds);
+
+ widget.CloseNow();
+}
#endif // defined(OS_WIN)
#if !defined(OS_CHROMEOS)
« no previous file with comments | « no previous file | ui/views/win/fullscreen_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698