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

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

Issue 607623002: Add unittests for null/empty window shapes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ShapedAppWindowTargeterTest Created 6 years, 3 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
Index: ui/views/widget/desktop_aura/x11_topmost_window_finder_interactive_uitest.cc
diff --git a/ui/views/widget/desktop_aura/x11_topmost_window_finder_interactive_uitest.cc b/ui/views/widget/desktop_aura/x11_topmost_window_finder_interactive_uitest.cc
index 0a930a2a1ae4e7089ef27a0113885e6ff40b7ba2..a3ca3462e077878bfc6292d42d4bd7f41321ac2e 100644
--- a/ui/views/widget/desktop_aura/x11_topmost_window_finder_interactive_uitest.cc
+++ b/ui/views/widget/desktop_aura/x11_topmost_window_finder_interactive_uitest.cc
@@ -356,6 +356,51 @@ TEST_F(X11TopmostWindowFinderTest, NonRectangular) {
XDestroyWindow(xdisplay(), xid2);
}
+// Test that a window with an empty shape are properly handled.
+TEST_F(X11TopmostWindowFinderTest, NonRectangularEmptyShape) {
+ if (!ui::IsShapeExtensionAvailable())
+ return;
+
+ scoped_ptr<Widget> widget1(
+ CreateAndShowWidget(gfx::Rect(100, 100, 100, 100)));
+ XID xid1 = widget1->GetNativeWindow()->GetHost()->GetAcceleratedWidget();
+ SkRegion* skregion1 = new SkRegion;
+ skregion1->op(SkIRect::MakeXYWH(0, 0, 0, 0), SkRegion::kUnion_Op);
+ // Widget takes ownership of |skregion1|.
+ widget1->SetShape(skregion1);
+
+ XID xids[] = { xid1 };
+ StackingClientListWaiter stack_waiter(xids, arraysize(xids));
+ stack_waiter.Wait();
+ ui::X11EventSource::GetInstance()->DispatchXEvents();
+
+ EXPECT_NE(xid1, FindTopmostXWindowAt(105, 105));
+}
+
+// Test that setting a Null shape removes the shape.
+TEST_F(X11TopmostWindowFinderTest, NonRectangularNullShape) {
+ if (!ui::IsShapeExtensionAvailable())
+ return;
+
+ scoped_ptr<Widget> widget1(
+ CreateAndShowWidget(gfx::Rect(100, 100, 100, 100)));
+ XID xid1 = widget1->GetNativeWindow()->GetHost()->GetAcceleratedWidget();
+ SkRegion* skregion1 = new SkRegion;
+ skregion1->op(SkIRect::MakeXYWH(0, 0, 0, 0), SkRegion::kUnion_Op);
+ // Widget takes ownership of |skregion1|.
+ widget1->SetShape(skregion1);
+
+ // Remove the shape - this is now just a normal window.
+ widget1->SetShape(NULL);
+
+ XID xids[] = { xid1 };
+ StackingClientListWaiter stack_waiter(xids, arraysize(xids));
+ stack_waiter.Wait();
+ ui::X11EventSource::GetInstance()->DispatchXEvents();
+
+ EXPECT_EQ(xid1, FindTopmostXWindowAt(105, 105));
+}
+
// Test that the TopmostWindowFinder finds windows which belong to menus
// (which may or may not belong to Chrome).
TEST_F(X11TopmostWindowFinderTest, Menu) {

Powered by Google App Engine
This is Rietveld 408576698