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" |
| 6 |
5 #include "ash/public/cpp/shell_window_ids.h" | 7 #include "ash/public/cpp/shell_window_ids.h" |
6 #include "ash/shell.h" | 8 #include "ash/shell.h" |
| 9 #include "ash/shell_port.h" |
7 #include "ash/wm/window_positioning_utils.h" | 10 #include "ash/wm/window_positioning_utils.h" |
8 #include "ash/wm_shell.h" | |
9 #include "ash/wm_window.h" | 11 #include "ash/wm_window.h" |
10 #include "components/exo/buffer.h" | 12 #include "components/exo/buffer.h" |
11 #include "components/exo/pointer.h" | |
12 #include "components/exo/pointer_delegate.h" | 13 #include "components/exo/pointer_delegate.h" |
13 #include "components/exo/shell_surface.h" | 14 #include "components/exo/shell_surface.h" |
14 #include "components/exo/surface.h" | 15 #include "components/exo/surface.h" |
15 #include "components/exo/test/exo_test_base.h" | 16 #include "components/exo/test/exo_test_base.h" |
16 #include "components/exo/test/exo_test_helper.h" | 17 #include "components/exo/test/exo_test_helper.h" |
17 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
18 #include "ui/events/event_utils.h" | 19 #include "ui/events/event_utils.h" |
19 #include "ui/events/test/event_generator.h" | 20 #include "ui/events/test/event_generator.h" |
20 | 21 |
21 namespace exo { | 22 namespace exo { |
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 true, false, ash::kShellWindowId_SystemModalContainer)); | 313 true, false, ash::kShellWindowId_SystemModalContainer)); |
313 std::unique_ptr<Buffer> buffer2( | 314 std::unique_ptr<Buffer> buffer2( |
314 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(gfx::Size(5, 5)))); | 315 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(gfx::Size(5, 5)))); |
315 surface2->Attach(buffer2.get()); | 316 surface2->Attach(buffer2.get()); |
316 surface2->Commit(); | 317 surface2->Commit(); |
317 ash::wm::CenterWindow(ash::WmWindow::Get(surface2->window())); | 318 ash::wm::CenterWindow(ash::WmWindow::Get(surface2->window())); |
318 gfx::Point location2 = surface2->window()->GetBoundsInScreen().origin(); | 319 gfx::Point location2 = surface2->window()->GetBoundsInScreen().origin(); |
319 | 320 |
320 // Make the window modal. | 321 // Make the window modal. |
321 shell_surface2->SetSystemModal(true); | 322 shell_surface2->SetSystemModal(true); |
322 EXPECT_TRUE(ash::WmShell::Get()->IsSystemModalWindowOpen()); | 323 EXPECT_TRUE(ash::ShellPort::Get()->IsSystemModalWindowOpen()); |
323 | 324 |
324 EXPECT_CALL(delegate, OnPointerFrame()).Times(testing::AnyNumber()); | 325 EXPECT_CALL(delegate, OnPointerFrame()).Times(testing::AnyNumber()); |
325 EXPECT_CALL(delegate, CanAcceptPointerEventsForSurface(surface.get())) | 326 EXPECT_CALL(delegate, CanAcceptPointerEventsForSurface(surface.get())) |
326 .WillRepeatedly(testing::Return(true)); | 327 .WillRepeatedly(testing::Return(true)); |
327 EXPECT_CALL(delegate, CanAcceptPointerEventsForSurface(surface2.get())) | 328 EXPECT_CALL(delegate, CanAcceptPointerEventsForSurface(surface2.get())) |
328 .WillRepeatedly(testing::Return(true)); | 329 .WillRepeatedly(testing::Return(true)); |
329 | 330 |
330 // Check if pointer events on modal window are registered. | 331 // Check if pointer events on modal window are registered. |
331 { | 332 { |
332 testing::InSequence sequence; | 333 testing::InSequence sequence; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
401 generator.ScrollSequence(location, base::TimeDelta(), 1, 1, 1, 1); | 402 generator.ScrollSequence(location, base::TimeDelta(), 1, 1, 1, 1); |
402 | 403 |
403 { | 404 { |
404 testing::InSequence sequence; | 405 testing::InSequence sequence; |
405 EXPECT_CALL(delegate, OnPointerLeave(surface.get())).Times(0); | 406 EXPECT_CALL(delegate, OnPointerLeave(surface.get())).Times(0); |
406 } | 407 } |
407 generator.MoveMouseTo(surface->window()->GetBoundsInScreen().bottom_right()); | 408 generator.MoveMouseTo(surface->window()->GetBoundsInScreen().bottom_right()); |
408 | 409 |
409 // Make the window non-modal. | 410 // Make the window non-modal. |
410 shell_surface2->SetSystemModal(false); | 411 shell_surface2->SetSystemModal(false); |
411 EXPECT_FALSE(ash::WmShell::Get()->IsSystemModalWindowOpen()); | 412 EXPECT_FALSE(ash::ShellPort::Get()->IsSystemModalWindowOpen()); |
412 | 413 |
413 // Check if pointer events on non-modal window are registered. | 414 // Check if pointer events on non-modal window are registered. |
414 { | 415 { |
415 testing::InSequence sequence; | 416 testing::InSequence sequence; |
416 EXPECT_CALL(delegate, OnPointerEnter(surface.get(), gfx::PointF(), 0)); | 417 EXPECT_CALL(delegate, OnPointerEnter(surface.get(), gfx::PointF(), 0)); |
417 } | 418 } |
418 generator.MoveMouseTo(location); | 419 generator.MoveMouseTo(location); |
419 | 420 |
420 { | 421 { |
421 testing::InSequence sequence; | 422 testing::InSequence sequence; |
(...skipping 24 matching lines...) Expand all Loading... |
446 EXPECT_CALL(delegate, OnPointerLeave(surface.get())); | 447 EXPECT_CALL(delegate, OnPointerLeave(surface.get())); |
447 } | 448 } |
448 generator.MoveMouseTo(surface->window()->GetBoundsInScreen().bottom_right()); | 449 generator.MoveMouseTo(surface->window()->GetBoundsInScreen().bottom_right()); |
449 | 450 |
450 EXPECT_CALL(delegate, OnPointerDestroying(pointer.get())); | 451 EXPECT_CALL(delegate, OnPointerDestroying(pointer.get())); |
451 pointer.reset(); | 452 pointer.reset(); |
452 } | 453 } |
453 | 454 |
454 } // namespace | 455 } // namespace |
455 } // namespace exo | 456 } // namespace exo |
OLD | NEW |