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

Unified Diff: components/exo/shell_surface_unittest.cc

Issue 2177623002: exo: Implement custom fullscreening for ShellSurfaces. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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
« components/exo/shell_surface.cc ('K') | « components/exo/shell_surface.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« components/exo/shell_surface.cc ('K') | « components/exo/shell_surface.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698