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

Unified Diff: ash/wm/window_state_unittest.cc

Issue 2175833002: AdjustBoundsToEnsureMinimumWindowVisibility may cause unwanted shift if window dimension is small (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ensure window abuts the bottom of screen Created 4 years, 4 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
« ash/common/wm/default_state.cc ('K') | « ash/common/wm/default_state.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/wm/window_state_unittest.cc
diff --git a/ash/wm/window_state_unittest.cc b/ash/wm/window_state_unittest.cc
index 1a1bf33c1d494ffb4968e091beabfef8aeb84649..d2860f609950449f49f3cefb1a482d35cf985ea9 100644
--- a/ash/wm/window_state_unittest.cc
+++ b/ash/wm/window_state_unittest.cc
@@ -7,6 +7,7 @@
#include <utility>
#include "ash/common/material_design/material_design_controller.h"
+#include "ash/common/shelf/wm_shelf.h"
#include "ash/common/wm/window_state.h"
#include "ash/common/wm/wm_event.h"
#include "ash/screen_util.h"
@@ -408,6 +409,29 @@ TEST_P(WindowStateTest, AllowSetBoundsInMaximized) {
EXPECT_EQ(work_area, window->bounds());
}
+// When there is a workarea bounds changed event caused by shelf layout, the
+// wm::AdjustBoundsToEnsureMinimumWindowVisibility method may cause window
+// bounds change, which leads to the status bubble bug in crbug.com/624806.
+TEST_P(WindowStateTest, AvoidPossibleBoundsChangeIfIgnoredByShelf) {
+ WmShelf* shelf = test::AshTestBase::GetPrimaryShelf();
+ shelf->SetAlignment(ash::SHELF_ALIGNMENT_LEFT);
+ const gfx::Rect display_area =
+ display::Screen::GetScreen()->GetPrimaryDisplay().bounds();
+ std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithId(0));
+ GetWindowState(window.get())->set_ignored_by_shelf(true);
+ // window height should be smaller than wm::kMinimumOnScreenArea,
+ // which is 25 to simulate a status bubble window.
+ gfx::Rect bounds(0, 0, 80, 22);
+ // Ensure the window abuts the bottom of screen.
+ bounds.set_y(display_area.bottom() - bounds.height());
+ window->SetBounds(bounds);
+ EXPECT_EQ(display_area.bottom(), window->bounds().bottom());
+ gfx::Rect expected = window->bounds();
+
+ shelf->SetAlignment(ash::SHELF_ALIGNMENT_BOTTOM);
+ EXPECT_EQ(expected, window->bounds());
+}
+
// TODO(skuhne): Add more unit test to verify the correctness for the restore
// operation.
« ash/common/wm/default_state.cc ('K') | « ash/common/wm/default_state.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698