| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/common/shell_window_ids.h" | 5 #include "ash/common/shell_window_ids.h" |
| 6 #include "ash/common/wm/window_state.h" | 6 #include "ash/common/wm/window_state.h" |
| 7 #include "ash/common/wm_shell.h" | 7 #include "ash/common/wm_shell.h" |
| 8 #include "ash/wm/window_state_aura.h" | 8 #include "ash/wm/window_state_aura.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 389 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 400 std::unique_ptr<Buffer> child_buffer( | 400 std::unique_ptr<Buffer> child_buffer( |
| 401 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); | 401 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); |
| 402 child->Attach(child_buffer.get()); | 402 child->Attach(child_buffer.get()); |
| 403 std::unique_ptr<SubSurface> sub_surface( | 403 std::unique_ptr<SubSurface> sub_surface( |
| 404 display->CreateSubSurface(child.get(), surface.get())); | 404 display->CreateSubSurface(child.get(), surface.get())); |
| 405 surface->SetSubSurfacePosition(child.get(), gfx::Point(10, 10)); | 405 surface->SetSubSurfacePosition(child.get(), gfx::Point(10, 10)); |
| 406 child->Commit(); | 406 child->Commit(); |
| 407 surface->Commit(); | 407 surface->Commit(); |
| 408 EXPECT_FALSE(ash::WmShell::Get()->IsSystemModalWindowOpen()); | 408 EXPECT_FALSE(ash::WmShell::Get()->IsSystemModalWindowOpen()); |
| 409 | 409 |
| 410 // Makeing the surface opaque shouldn't make it modal either. | 410 // Making the surface opaque shouldn't make it modal either. |
| 411 child->SetBlendMode(SkXfermode::kSrc_Mode); | 411 child->SetBlendMode(SkXfermode::kSrc_Mode); |
| 412 child->Commit(); | 412 child->Commit(); |
| 413 surface->Commit(); | 413 surface->Commit(); |
| 414 EXPECT_FALSE(ash::WmShell::Get()->IsSystemModalWindowOpen()); | 414 EXPECT_FALSE(ash::WmShell::Get()->IsSystemModalWindowOpen()); |
| 415 | 415 |
| 416 // Only surface with input regions should be modal. | 416 // Setting input regions won't make it modal either. |
| 417 surface->SetInputRegion( | 417 surface->SetInputRegion( |
| 418 SkRegion(gfx::RectToSkIRect(gfx::Rect(10, 10, 100, 100)))); | 418 SkRegion(gfx::RectToSkIRect(gfx::Rect(10, 10, 100, 100)))); |
| 419 surface->Commit(); | 419 surface->Commit(); |
| 420 EXPECT_FALSE(ash::WmShell::Get()->IsSystemModalWindowOpen()); |
| 421 |
| 422 // Only SetSystemModal changes modality. |
| 423 shell_surface->SetSystemModal(true); |
| 420 EXPECT_TRUE(ash::WmShell::Get()->IsSystemModalWindowOpen()); | 424 EXPECT_TRUE(ash::WmShell::Get()->IsSystemModalWindowOpen()); |
| 421 | 425 |
| 422 // Removing input resion should make it non system modal. | 426 shell_surface->SetSystemModal(false); |
| 423 surface->SetInputRegion(SkRegion()); | |
| 424 surface->Commit(); | |
| 425 EXPECT_FALSE(ash::WmShell::Get()->IsSystemModalWindowOpen()); | 427 EXPECT_FALSE(ash::WmShell::Get()->IsSystemModalWindowOpen()); |
| 426 } | 428 } |
| 427 | 429 |
| 428 TEST_F(ShellSurfaceTest, Shadow) { | 430 TEST_F(ShellSurfaceTest, Shadow) { |
| 429 std::unique_ptr<Surface> surface(new Surface); | 431 std::unique_ptr<Surface> surface(new Surface); |
| 430 std::unique_ptr<ShellSurface> shell_surface( | 432 std::unique_ptr<ShellSurface> shell_surface( |
| 431 new ShellSurface(surface.get(), nullptr, gfx::Rect(), true, | 433 new ShellSurface(surface.get(), nullptr, gfx::Rect(), true, |
| 432 ash::kShellWindowId_DefaultContainer)); | 434 ash::kShellWindowId_DefaultContainer)); |
| 433 surface->Commit(); | 435 surface->Commit(); |
| 434 | 436 |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 // 6) Seting non empty content bounds should enable shadow. | 487 // 6) Seting non empty content bounds should enable shadow. |
| 486 shell_surface->SetRectangularShadow(gfx::Rect(10, 10, 100, 100)); | 488 shell_surface->SetRectangularShadow(gfx::Rect(10, 10, 100, 100)); |
| 487 surface->Commit(); | 489 surface->Commit(); |
| 488 | 490 |
| 489 EXPECT_EQ(wm::SHADOW_TYPE_RECTANGULAR, wm::GetShadowType(window)); | 491 EXPECT_EQ(wm::SHADOW_TYPE_RECTANGULAR, wm::GetShadowType(window)); |
| 490 EXPECT_TRUE(shadow->layer()->visible()); | 492 EXPECT_TRUE(shadow->layer()->visible()); |
| 491 } | 493 } |
| 492 | 494 |
| 493 } // namespace | 495 } // namespace |
| 494 } // namespace exo | 496 } // namespace exo |
| OLD | NEW |