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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« 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 »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <vector> 5 #include <vector>
6 6
7 #include <X11/extensions/shape.h> 7 #include <X11/extensions/shape.h>
8 #include <X11/Xlib.h> 8 #include <X11/Xlib.h>
9 9
10 // Get rid of X11 macros which conflict with gtest. 10 // Get rid of X11 macros which conflict with gtest.
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 EXPECT_TRUE(widget->IsFullscreen()); 360 EXPECT_TRUE(widget->IsFullscreen());
361 361
362 // Calling Widget::SetFullscreen(false) should clear the widget's fullscreen 362 // Calling Widget::SetFullscreen(false) should clear the widget's fullscreen
363 // state and clean things up. 363 // state and clean things up.
364 widget->SetFullscreen(false); 364 widget->SetFullscreen(false);
365 EXPECT_FALSE(widget->IsFullscreen()); 365 EXPECT_FALSE(widget->IsFullscreen());
366 EXPECT_EQ(initial_bounds.ToString(), 366 EXPECT_EQ(initial_bounds.ToString(),
367 widget->GetWindowBoundsInScreen().ToString()); 367 widget->GetWindowBoundsInScreen().ToString());
368 } 368 }
369 369
370 // Tests that the minimization information is propagated to the content window.
371 TEST_F(DesktopWindowTreeHostX11Test, ToggleMinimizePropogateToContentWindow) {
372 Widget widget;
373 Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW);
374 params.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
375 params.native_widget = new DesktopNativeWidgetAura(&widget);
376 widget.Init(params);
377 widget.Show();
378 ui::X11EventSource::GetInstance()->DispatchXEvents();
379
380 XID xid = widget.GetNativeWindow()->GetHost()->GetAcceleratedWidget();
381 Display* display = gfx::GetXDisplay();
382
383 // Minimize by sending _NET_WM_STATE_HIDDEN
384 {
385 const char* kAtomsToCache[] = {
386 "_NET_WM_STATE",
387 "_NET_WM_STATE_HIDDEN",
388 NULL
389 };
390
391 ui::X11AtomCache atom_cache(display, kAtomsToCache);
392
393 std::vector< ::Atom> atom_list;
394 atom_list.push_back(atom_cache.GetAtom("_NET_WM_STATE_HIDDEN"));
395 ui::SetAtomArrayProperty(xid, "_NET_WM_STATE", "ATOM", atom_list);
396
397 XEvent xevent;
398 memset(&xevent, 0, sizeof(xevent));
399 xevent.type = PropertyNotify;
400 xevent.xproperty.type = PropertyNotify;
401 xevent.xproperty.send_event = 1;
402 xevent.xproperty.display = display;
403 xevent.xproperty.window = xid;
404 xevent.xproperty.atom = atom_cache.GetAtom("_NET_WM_STATE");
405 xevent.xproperty.state = 0;
406 XSendEvent(display, DefaultRootWindow(display), False,
407 SubstructureRedirectMask | SubstructureNotifyMask,
408 &xevent);
409
410 WMStateWaiter waiter(xid, "_NET_WM_STATE_HIDDEN", true);
411 waiter.Wait();
412 }
413 EXPECT_FALSE(widget.GetNativeWindow()->IsVisible());
414
415 // Show from minimized by sending _NET_WM_STATE_FOCUSED
416 {
417 const char* kAtomsToCache[] = {
418 "_NET_WM_STATE",
419 "_NET_WM_STATE_FOCUSED",
420 NULL
421 };
422
423 ui::X11AtomCache atom_cache(display, kAtomsToCache);
424
425 std::vector< ::Atom> atom_list;
426 atom_list.push_back(atom_cache.GetAtom("_NET_WM_STATE_FOCUSED"));
427 ui::SetAtomArrayProperty(xid, "_NET_WM_STATE", "ATOM", atom_list);
428
429 XEvent xevent;
430 memset(&xevent, 0, sizeof(xevent));
431 xevent.type = PropertyNotify;
432 xevent.xproperty.type = PropertyNotify;
433 xevent.xproperty.send_event = 1;
434 xevent.xproperty.display = display;
435 xevent.xproperty.window = xid;
436 xevent.xproperty.atom = atom_cache.GetAtom("_NET_WM_STATE");
437 xevent.xproperty.state = 0;
438 XSendEvent(display, DefaultRootWindow(display), False,
439 SubstructureRedirectMask | SubstructureNotifyMask,
440 &xevent);
441
442 WMStateWaiter waiter(xid, "_NET_WM_STATE_FOCUSED", true);
443 waiter.Wait();
444 }
445 EXPECT_TRUE(widget.GetNativeWindow()->IsVisible());
446 }
447
370 } // namespace views 448 } // namespace views
OLDNEW
« 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