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. |