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

Unified Diff: components/exo/shell_surface_unittest.cc

Issue 2743053002: arc: Fix race condition in applying modal state. (Closed)
Patch Set: forgotten nit Created 3 years, 9 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
« no previous file with comments | « 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 8ad2c3a13f28971cbd2f909eaf0b915ad1ae14cc..988a68005ce03e6652239acd2af86376d2d6fe30 100644
--- a/components/exo/shell_surface_unittest.cc
+++ b/components/exo/shell_surface_unittest.cc
@@ -471,6 +471,34 @@ TEST_F(ShellSurfaceTest, ModalWindow) {
EXPECT_FALSE(ash::WmShell::Get()->IsSystemModalWindowOpen());
}
+TEST_F(ShellSurfaceTest, ModalWindowSetSystemModalBeforeCommit) {
+ std::unique_ptr<Surface> surface(new Surface);
+ std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(
+ surface.get(), nullptr, ShellSurface::BoundsMode::SHELL, gfx::Point(),
+ true, false, ash::kShellWindowId_SystemModalContainer));
+ gfx::Size desktop_size(640, 480);
+ std::unique_ptr<Buffer> desktop_buffer(
+ new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(desktop_size)));
+ surface->Attach(desktop_buffer.get());
+ surface->SetInputRegion(SkRegion());
+
+ // Set SetSystemModal before any commit happens. Widget is not created at
+ // this time.
+ EXPECT_FALSE(shell_surface->GetWidget());
+ shell_surface->SetSystemModal(true);
+
+ surface->Commit();
+
+ // It is expected that modal window is shown.
+ EXPECT_TRUE(shell_surface->GetWidget());
+ EXPECT_TRUE(ash::WmShell::Get()->IsSystemModalWindowOpen());
+
+ // Now widget is created and setting modal state should be applied
+ // immediately.
+ shell_surface->SetSystemModal(false);
+ EXPECT_FALSE(ash::WmShell::Get()->IsSystemModalWindowOpen());
+}
+
TEST_F(ShellSurfaceTest, PopupWindow) {
Surface parent_surface;
ShellSurface parent(&parent_surface);
« no previous file with comments | « components/exo/shell_surface.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698