| Index: components/exo/shell_surface_unittest.cc
|
| diff --git a/components/exo/shell_surface_unittest.cc b/components/exo/shell_surface_unittest.cc
|
| index fc705357235b4d1f24f16594d428d3838efa928d..1ba2412c316d2ad9e7bef8fa30d56b30f17d7262 100644
|
| --- a/components/exo/shell_surface_unittest.cc
|
| +++ b/components/exo/shell_surface_unittest.cc
|
| @@ -444,6 +444,46 @@ TEST_F(ShellSurfaceTest, ModalWindow) {
|
| EXPECT_FALSE(ash::WmShell::Get()->IsSystemModalWindowOpen());
|
| }
|
|
|
| +TEST_F(ShellSurfaceTest, PopupWindow) {
|
| + Surface parent_surface;
|
| + ShellSurface parent(&parent_surface);
|
| + const gfx::Rect parent_bounds(100, 100, 300, 300);
|
| +
|
| + Buffer parent_buffer(
|
| + exo_test_helper()->CreateGpuMemoryBuffer(parent_bounds.size()));
|
| + parent_surface.Attach(&parent_buffer);
|
| + parent_surface.Commit();
|
| +
|
| + parent.GetWidget()->SetBounds(parent_bounds);
|
| +
|
| + Display display;
|
| + Surface popup_surface;
|
| + const gfx::Rect popup_bounds(10, 10, 100, 100);
|
| + std::unique_ptr<ShellSurface> popup = display.CreatePopupShellSurface(
|
| + &popup_surface, &parent, popup_bounds.origin());
|
| +
|
| + Buffer popup_buffer(
|
| + exo_test_helper()->CreateGpuMemoryBuffer(popup_bounds.size()));
|
| + popup_surface.Attach(&popup_buffer);
|
| + popup_surface.Commit();
|
| +
|
| + // Popup bounds are relative to parent.
|
| + EXPECT_EQ(gfx::Rect(parent_bounds.origin() + popup_bounds.OffsetFromOrigin(),
|
| + popup_bounds.size()),
|
| + popup->GetWidget()->GetWindowBoundsInScreen());
|
| +
|
| + const gfx::Rect geometry(5, 5, 90, 90);
|
| + popup->SetGeometry(geometry);
|
| + popup_surface.Commit();
|
| +
|
| + // Popup position is fixed, and geometry is relative to it.
|
| + EXPECT_EQ(gfx::Rect(parent_bounds.origin() +
|
| + popup_bounds.OffsetFromOrigin() +
|
| + geometry.OffsetFromOrigin(),
|
| + geometry.size()),
|
| + popup->GetWidget()->GetWindowBoundsInScreen());
|
| +}
|
| +
|
| TEST_F(ShellSurfaceTest, Shadow) {
|
| std::unique_ptr<Surface> surface(new Surface);
|
| std::unique_ptr<ShellSurface> shell_surface(
|
|
|