Index: components/exo/shell_surface_unittest.cc |
diff --git a/components/exo/shell_surface_unittest.cc b/components/exo/shell_surface_unittest.cc |
index 468eb0bd69a7f5d7b95e9e67d8265f3f4951bbd5..483ecc8d768b16014cde2ad48e79201b374c40c9 100644 |
--- a/components/exo/shell_surface_unittest.cc |
+++ b/components/exo/shell_surface_unittest.cc |
@@ -2,8 +2,10 @@ |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
+#include "ash/aura/wm_window_aura.h" |
#include "ash/common/shell_window_ids.h" |
#include "ash/common/wm/window_state.h" |
+#include "ash/common/wm/wm_event.h" |
#include "ash/common/wm_shell.h" |
#include "ash/wm/window_state_aura.h" |
#include "base/message_loop/message_loop.h" |
@@ -607,5 +609,40 @@ TEST_F(ShellSurfaceTest, ShadowStartMaximized) { |
EXPECT_EQ(gfx::Rect(10, 10, 100, 100), shadow->layer()->parent()->bounds()); |
} |
+TEST_F(ShellSurfaceTest, ToggleFullscreen) { |
+ gfx::Size buffer_size(256, 256); |
+ std::unique_ptr<Buffer> buffer( |
+ new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); |
+ std::unique_ptr<Surface> surface(new Surface); |
+ std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); |
+ |
+ surface->Attach(buffer.get()); |
+ surface->Commit(); |
+ EXPECT_EQ( |
+ buffer_size.ToString(), |
+ shell_surface->GetWidget()->GetWindowBoundsInScreen().size().ToString()); |
+ |
+ shell_surface->Maximize(); |
+ EXPECT_EQ(CurrentContext()->bounds().width(), |
+ shell_surface->GetWidget()->GetWindowBoundsInScreen().width()); |
+ |
+ ash::wm::WMEvent event(ash::wm::WM_EVENT_TOGGLE_FULLSCREEN); |
+ ash::WmWindow* window = |
+ ash::WmWindowAura::Get(shell_surface->GetWidget()->GetNativeWindow()); |
+ |
+ // Enter fullscreen mode. |
+ window->GetWindowState()->OnWMEvent(&event); |
+ |
+ EXPECT_EQ(CurrentContext()->bounds().ToString(), |
+ shell_surface->GetWidget()->GetWindowBoundsInScreen().ToString()); |
+ |
+ // Leave fullscreen mode. |
+ window->GetWindowState()->OnWMEvent(&event); |
+ |
+ // Check that shell surface is maximized. |
+ EXPECT_EQ(CurrentContext()->bounds().width(), |
+ shell_surface->GetWidget()->GetWindowBoundsInScreen().width()); |
+} |
+ |
} // namespace |
} // namespace exo |