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

Unified Diff: components/exo/shell_surface_unittest.cc

Issue 2743053002: arc: Fix race condition in applying modal state. (Closed)
Patch Set: unit_test added + refactored apply logic 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
« 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 45cc534a335144fb5845a4567905ce6b074110a3..01233dd4387cf0535d56b21e84dc499bc1a208bf 100644
--- a/components/exo/shell_surface_unittest.cc
+++ b/components/exo/shell_surface_unittest.cc
@@ -470,6 +470,34 @@ TEST_F(ShellSurfaceTest, ModalWindow) {
EXPECT_FALSE(ash::WmShell::Get()->IsSystemModalWindowOpen());
}
+TEST_F(ShellSurfaceTest, ModalWindowInitializedBeforeCommit) {
reveman 2017/03/11 00:45:09 nit: s/Initialized/SetSystemModal/
khmel 2017/03/11 01:33:32 Done.
+ 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);
« 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