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

Unified Diff: ui/views/widget/desktop_aura/desktop_window_tree_host_x11_unittest.cc

Issue 340783004: visibility bug fix for https://crbug.com/246844 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Better code structure Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/desktop_aura/desktop_window_tree_host_x11_unittest.cc
diff --git a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11_unittest.cc b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11_unittest.cc
index f48a3b1209ebb2d10093a3518c461ecd2d756ab0..8a66c6e032717e46a21ab5390aaa305c76b6565a 100644
--- a/ui/views/widget/desktop_aura/desktop_window_tree_host_x11_unittest.cc
+++ b/ui/views/widget/desktop_aura/desktop_window_tree_host_x11_unittest.cc
@@ -367,4 +367,82 @@ TEST_F(DesktopWindowTreeHostX11Test, WindowManagerTogglesFullscreen) {
widget->GetWindowBoundsInScreen().ToString());
}
+// Tests that the minimization information is propagated to the content window.
+TEST_F(DesktopWindowTreeHostX11Test, ToggleMinimizePropogateToContentWindow) {
+ Widget widget;
+ Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW);
+ params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
+ params.native_widget = new DesktopNativeWidgetAura(&widget);
+ widget.Init(params);
+ widget.Show();
+ ui::X11EventSource::GetInstance()->DispatchXEvents();
+
+ XID xid = widget.GetNativeWindow()->GetHost()->GetAcceleratedWidget();
+ Display* display = gfx::GetXDisplay();
+
+ // Minimize by sending _NET_WM_STATE_HIDDEN
+ {
+ const char* kAtomsToCache[] = {
+ "_NET_WM_STATE",
+ "_NET_WM_STATE_HIDDEN",
+ NULL
+ };
+
+ ui::X11AtomCache atom_cache(display, kAtomsToCache);
+
+ std::vector< ::Atom> atom_list;
+ atom_list.push_back(atom_cache.GetAtom("_NET_WM_STATE_HIDDEN"));
+ ui::SetAtomArrayProperty(xid, "_NET_WM_STATE", "ATOM", atom_list);
+
+ XEvent xevent;
+ memset(&xevent, 0, sizeof(xevent));
+ xevent.type = PropertyNotify;
+ xevent.xproperty.type = PropertyNotify;
+ xevent.xproperty.send_event = 1;
+ xevent.xproperty.display = display;
+ xevent.xproperty.window = xid;
+ xevent.xproperty.atom = atom_cache.GetAtom("_NET_WM_STATE");
+ xevent.xproperty.state = 0;
+ XSendEvent(display, DefaultRootWindow(display), False,
+ SubstructureRedirectMask | SubstructureNotifyMask,
+ &xevent);
+
+ WMStateWaiter waiter(xid, "_NET_WM_STATE_HIDDEN", true);
+ waiter.Wait();
+ }
+ EXPECT_FALSE(widget.GetNativeWindow()->IsVisible());
+
+ // Show from minimized by sending _NET_WM_STATE_FOCUSED
+ {
+ const char* kAtomsToCache[] = {
+ "_NET_WM_STATE",
+ "_NET_WM_STATE_FOCUSED",
+ NULL
+ };
+
+ ui::X11AtomCache atom_cache(display, kAtomsToCache);
+
+ std::vector< ::Atom> atom_list;
+ atom_list.push_back(atom_cache.GetAtom("_NET_WM_STATE_FOCUSED"));
+ ui::SetAtomArrayProperty(xid, "_NET_WM_STATE", "ATOM", atom_list);
+
+ XEvent xevent;
+ memset(&xevent, 0, sizeof(xevent));
+ xevent.type = PropertyNotify;
+ xevent.xproperty.type = PropertyNotify;
+ xevent.xproperty.send_event = 1;
+ xevent.xproperty.display = display;
+ xevent.xproperty.window = xid;
+ xevent.xproperty.atom = atom_cache.GetAtom("_NET_WM_STATE");
+ xevent.xproperty.state = 0;
+ XSendEvent(display, DefaultRootWindow(display), False,
+ SubstructureRedirectMask | SubstructureNotifyMask,
+ &xevent);
+
+ WMStateWaiter waiter(xid, "_NET_WM_STATE_FOCUSED", true);
+ waiter.Wait();
+ }
+ EXPECT_TRUE(widget.GetNativeWindow()->IsVisible());
+}
+
} // namespace views
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_x11.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698