| 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 "components/exo/pointer.h" | 5 #include "components/exo/pointer.h" |
| 6 | 6 |
| 7 #include "ash/public/cpp/shell_window_ids.h" | 7 #include "ash/public/cpp/shell_window_ids.h" |
| 8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/shell_port.h" | 9 #include "ash/shell_port.h" |
| 10 #include "ash/wm/window_positioning_utils.h" | 10 #include "ash/wm/window_positioning_utils.h" |
| 11 #include "ash/wm_window.h" | |
| 12 #include "components/exo/buffer.h" | 11 #include "components/exo/buffer.h" |
| 13 #include "components/exo/pointer_delegate.h" | 12 #include "components/exo/pointer_delegate.h" |
| 14 #include "components/exo/shell_surface.h" | 13 #include "components/exo/shell_surface.h" |
| 15 #include "components/exo/surface.h" | 14 #include "components/exo/surface.h" |
| 16 #include "components/exo/test/exo_test_base.h" | 15 #include "components/exo/test/exo_test_base.h" |
| 17 #include "components/exo/test/exo_test_helper.h" | 16 #include "components/exo/test/exo_test_helper.h" |
| 18 #include "testing/gmock/include/gmock/gmock.h" | 17 #include "testing/gmock/include/gmock/gmock.h" |
| 19 #include "ui/events/event_utils.h" | 18 #include "ui/events/event_utils.h" |
| 20 #include "ui/events/test/event_generator.h" | 19 #include "ui/events/test/event_generator.h" |
| 21 | 20 |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 | 305 |
| 307 // Create surface for modal window. | 306 // Create surface for modal window. |
| 308 std::unique_ptr<Surface> surface2(new Surface); | 307 std::unique_ptr<Surface> surface2(new Surface); |
| 309 std::unique_ptr<ShellSurface> shell_surface2(new ShellSurface( | 308 std::unique_ptr<ShellSurface> shell_surface2(new ShellSurface( |
| 310 surface2.get(), nullptr, ShellSurface::BoundsMode::FIXED, gfx::Point(), | 309 surface2.get(), nullptr, ShellSurface::BoundsMode::FIXED, gfx::Point(), |
| 311 true, false, ash::kShellWindowId_SystemModalContainer)); | 310 true, false, ash::kShellWindowId_SystemModalContainer)); |
| 312 std::unique_ptr<Buffer> buffer2( | 311 std::unique_ptr<Buffer> buffer2( |
| 313 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(gfx::Size(5, 5)))); | 312 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(gfx::Size(5, 5)))); |
| 314 surface2->Attach(buffer2.get()); | 313 surface2->Attach(buffer2.get()); |
| 315 surface2->Commit(); | 314 surface2->Commit(); |
| 316 ash::wm::CenterWindow(ash::WmWindow::Get(surface2->window())); | 315 ash::wm::CenterWindow(surface2->window()); |
| 317 gfx::Point location2 = surface2->window()->GetBoundsInScreen().origin(); | 316 gfx::Point location2 = surface2->window()->GetBoundsInScreen().origin(); |
| 318 | 317 |
| 319 // Make the window modal. | 318 // Make the window modal. |
| 320 shell_surface2->SetSystemModal(true); | 319 shell_surface2->SetSystemModal(true); |
| 321 EXPECT_TRUE(ash::ShellPort::Get()->IsSystemModalWindowOpen()); | 320 EXPECT_TRUE(ash::ShellPort::Get()->IsSystemModalWindowOpen()); |
| 322 | 321 |
| 323 EXPECT_CALL(delegate, OnPointerFrame()).Times(testing::AnyNumber()); | 322 EXPECT_CALL(delegate, OnPointerFrame()).Times(testing::AnyNumber()); |
| 324 EXPECT_CALL(delegate, CanAcceptPointerEventsForSurface(surface.get())) | 323 EXPECT_CALL(delegate, CanAcceptPointerEventsForSurface(surface.get())) |
| 325 .WillRepeatedly(testing::Return(true)); | 324 .WillRepeatedly(testing::Return(true)); |
| 326 EXPECT_CALL(delegate, CanAcceptPointerEventsForSurface(surface2.get())) | 325 EXPECT_CALL(delegate, CanAcceptPointerEventsForSurface(surface2.get())) |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 442 EXPECT_CALL(delegate, OnPointerLeave(surface.get())); | 441 EXPECT_CALL(delegate, OnPointerLeave(surface.get())); |
| 443 } | 442 } |
| 444 generator.MoveMouseTo(surface->window()->GetBoundsInScreen().bottom_right()); | 443 generator.MoveMouseTo(surface->window()->GetBoundsInScreen().bottom_right()); |
| 445 | 444 |
| 446 EXPECT_CALL(delegate, OnPointerDestroying(pointer.get())); | 445 EXPECT_CALL(delegate, OnPointerDestroying(pointer.get())); |
| 447 pointer.reset(); | 446 pointer.reset(); |
| 448 } | 447 } |
| 449 | 448 |
| 450 } // namespace | 449 } // namespace |
| 451 } // namespace exo | 450 } // namespace exo |
| OLD | NEW |