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

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

Issue 2083923002: MacViews: Fix WidgetObserverTest.WidgetBoundsChangedNative after r400463 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: More focused Created 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/widget/widget_unittest.cc
diff --git a/ui/views/widget/widget_unittest.cc b/ui/views/widget/widget_unittest.cc
index 8761f7f5cc83857e0164d4f81eb654e02b4c555d..f90572ca2ed9cd6939b1b186a03034646225a64b 100644
--- a/ui/views/widget/widget_unittest.cc
+++ b/ui/views/widget/widget_unittest.cc
@@ -888,10 +888,14 @@ TEST_F(WidgetObserverTest, WidgetBoundsChangedNative) {
EXPECT_FALSE(widget_bounds_changed());
+ Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW);
+
+ // Use an origin within the work area since platforms (e.g. Mac) may move a
+ // window into the work area when showing, triggering a bounds change.
+ params.bounds = gfx::Rect(50, 50, 100, 100);
+
// Init causes a bounds change, even while not showing. Note some platforms
// cause a bounds change even when the bounds are empty. Mac does not.
- Widget::InitParams params = CreateParams(Widget::InitParams::TYPE_WINDOW);
- params.bounds = gfx::Rect(0, 0, 100, 100);
widget->Init(params);
EXPECT_TRUE(widget_bounds_changed());
reset();
@@ -923,6 +927,20 @@ TEST_F(WidgetObserverTest, WidgetBoundsChangedNative) {
EXPECT_FALSE(widget_bounds_changed());
reset();
+ // Move, but don't change the size.
+ widget->SetBounds(gfx::Rect(110, 110, 170, 100));
+ // Currently fails on Mus. http://crbug.com/622575.
+ if (IsMus())
+ EXPECT_FALSE(widget_bounds_changed());
+ else
+ EXPECT_TRUE(widget_bounds_changed());
+ reset();
+
+ // Moving to the same place does nothing.
+ widget->SetBounds(gfx::Rect(110, 110, 170, 100));
+ EXPECT_FALSE(widget_bounds_changed());
+ reset();
+
// No bounds change when closing.
widget->CloseNow();
EXPECT_FALSE(widget_bounds_changed());
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698