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