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

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

Issue 291093012: Fix some views unittests on desktop Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: UI_BASE_EXPORT Created 6 years, 7 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.h ('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 d2001697538e260e2a67cfb9b3ad35cc18460238..c3d07824e7a2d15967dcd094aaea0b5b1547cefd 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
@@ -262,45 +262,53 @@ TEST_F(DesktopWindowTreeHostX11Test, Shape) {
XID xid1 = widget1->GetNativeWindow()->GetHost()->GetAcceleratedWidget();
std::vector<gfx::Rect> shape_rects = GetShapeRects(xid1);
ASSERT_FALSE(shape_rects.empty());
- EXPECT_TRUE(ShapeRectContainsPoint(shape_rects, 85, 5));
- EXPECT_FALSE(ShapeRectContainsPoint(shape_rects, 95, 5));
- EXPECT_TRUE(ShapeRectContainsPoint(shape_rects, 95, 15));
- EXPECT_FALSE(ShapeRectContainsPoint(shape_rects, 105, 15));
+
+ // The widget was supposed to be 100x100, but the WM might have ignored this
+ // suggestion.
+ int widget_width = widget1->GetWindowBoundsInScreen().width();
+ EXPECT_TRUE(ShapeRectContainsPoint(shape_rects, widget_width - 15, 5));
+ EXPECT_FALSE(ShapeRectContainsPoint(shape_rects, widget_width - 5, 5));
+ EXPECT_TRUE(ShapeRectContainsPoint(shape_rects, widget_width - 5, 15));
+ EXPECT_FALSE(ShapeRectContainsPoint(shape_rects, widget_width + 5, 15));
// Changing widget's size should update the shape.
widget1->SetBounds(gfx::Rect(100, 100, 200, 200));
ui::X11EventSource::GetInstance()->DispatchXEvents();
- shape_rects = GetShapeRects(xid1);
- ASSERT_FALSE(shape_rects.empty());
- EXPECT_TRUE(ShapeRectContainsPoint(shape_rects, 85, 5));
- EXPECT_TRUE(ShapeRectContainsPoint(shape_rects, 95, 5));
- EXPECT_TRUE(ShapeRectContainsPoint(shape_rects, 185, 5));
- EXPECT_FALSE(ShapeRectContainsPoint(shape_rects, 195, 5));
- EXPECT_TRUE(ShapeRectContainsPoint(shape_rects, 195, 15));
- EXPECT_FALSE(ShapeRectContainsPoint(shape_rects, 205, 15));
-
- // The shape should be changed to a rectangle which fills the entire screen
- // when |widget1| is maximized.
- {
- MaximizeWaiter waiter(xid1);
- widget1->Maximize();
- waiter.Wait();
+ if (widget1->GetWindowBoundsInScreen().width() == 200) {
+ shape_rects = GetShapeRects(xid1);
+ ASSERT_FALSE(shape_rects.empty());
+ EXPECT_TRUE(ShapeRectContainsPoint(shape_rects, 85, 5));
+ EXPECT_TRUE(ShapeRectContainsPoint(shape_rects, 95, 5));
+ EXPECT_TRUE(ShapeRectContainsPoint(shape_rects, 185, 5));
+ EXPECT_FALSE(ShapeRectContainsPoint(shape_rects, 195, 5));
+ EXPECT_TRUE(ShapeRectContainsPoint(shape_rects, 195, 15));
+ EXPECT_FALSE(ShapeRectContainsPoint(shape_rects, 205, 15));
}
- // xvfb does not support Xrandr so we cannot check the maximized window's
- // bounds.
- gfx::Rect maximized_bounds;
- ui::GetWindowRect(xid1, &maximized_bounds);
-
- shape_rects = GetShapeRects(xid1);
- ASSERT_FALSE(shape_rects.empty());
- EXPECT_TRUE(ShapeRectContainsPoint(shape_rects,
- maximized_bounds.width() - 1,
- 5));
- EXPECT_TRUE(ShapeRectContainsPoint(shape_rects,
- maximized_bounds.width() - 1,
- 15));
+ if (ui::WmSupportsHint(ui::GetAtom("_NET_WM_STATE_MAXIMIZED_VERT"))) {
+ // The shape should be changed to a rectangle which fills the entire screen
+ // when |widget1| is maximized.
+ {
+ MaximizeWaiter waiter(xid1);
+ widget1->Maximize();
+ waiter.Wait();
+ }
+
+ // xvfb does not support Xrandr so we cannot check the maximized window's
+ // bounds.
+ gfx::Rect maximized_bounds;
+ ui::GetWindowRect(xid1, &maximized_bounds);
+
+ shape_rects = GetShapeRects(xid1);
+ ASSERT_FALSE(shape_rects.empty());
+ EXPECT_TRUE(ShapeRectContainsPoint(shape_rects,
+ maximized_bounds.width() - 1,
+ 5));
+ EXPECT_TRUE(ShapeRectContainsPoint(shape_rects,
+ maximized_bounds.width() - 1,
+ 15));
+ }
// 2) Test setting the window shape via Widget::SetShape().
gfx::Path shape2;
« no previous file with comments | « ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698