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/aura/wm_window_aura.h" | 5 #include "ash/aura/wm_window_aura.h" |
6 #include "ash/common/wm/window_positioning_utils.h" | 6 #include "ash/common/wm/window_positioning_utils.h" |
7 #include "ash/common/wm_shell.h" | 7 #include "ash/common/wm_shell.h" |
8 #include "ash/public/cpp/shell_window_ids.h" | 8 #include "ash/public/cpp/shell_window_ids.h" |
9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
10 #include "components/exo/buffer.h" | 10 #include "components/exo/buffer.h" |
(...skipping 18 matching lines...) Expand all Loading... |
29 | 29 |
30 // Overridden from PointerDelegate: | 30 // Overridden from PointerDelegate: |
31 MOCK_METHOD1(OnPointerDestroying, void(Pointer*)); | 31 MOCK_METHOD1(OnPointerDestroying, void(Pointer*)); |
32 MOCK_CONST_METHOD1(CanAcceptPointerEventsForSurface, bool(Surface*)); | 32 MOCK_CONST_METHOD1(CanAcceptPointerEventsForSurface, bool(Surface*)); |
33 MOCK_METHOD3(OnPointerEnter, void(Surface*, const gfx::PointF&, int)); | 33 MOCK_METHOD3(OnPointerEnter, void(Surface*, const gfx::PointF&, int)); |
34 MOCK_METHOD1(OnPointerLeave, void(Surface*)); | 34 MOCK_METHOD1(OnPointerLeave, void(Surface*)); |
35 MOCK_METHOD2(OnPointerMotion, void(base::TimeTicks, const gfx::PointF&)); | 35 MOCK_METHOD2(OnPointerMotion, void(base::TimeTicks, const gfx::PointF&)); |
36 MOCK_METHOD3(OnPointerButton, void(base::TimeTicks, int, bool)); | 36 MOCK_METHOD3(OnPointerButton, void(base::TimeTicks, int, bool)); |
37 MOCK_METHOD3(OnPointerScroll, | 37 MOCK_METHOD3(OnPointerScroll, |
38 void(base::TimeTicks, const gfx::Vector2dF&, bool)); | 38 void(base::TimeTicks, const gfx::Vector2dF&, bool)); |
39 MOCK_METHOD1(OnPointerScrollCancel, void(base::TimeTicks)); | |
40 MOCK_METHOD1(OnPointerScrollStop, void(base::TimeTicks)); | 39 MOCK_METHOD1(OnPointerScrollStop, void(base::TimeTicks)); |
41 MOCK_METHOD0(OnPointerFrame, void()); | 40 MOCK_METHOD0(OnPointerFrame, void()); |
42 }; | 41 }; |
43 | 42 |
44 TEST_F(PointerTest, SetCursor) { | 43 TEST_F(PointerTest, SetCursor) { |
45 std::unique_ptr<Surface> surface(new Surface); | 44 std::unique_ptr<Surface> surface(new Surface); |
46 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); | 45 std::unique_ptr<ShellSurface> shell_surface(new ShellSurface(surface.get())); |
47 gfx::Size buffer_size(10, 10); | 46 gfx::Size buffer_size(10, 10); |
48 std::unique_ptr<Buffer> buffer( | 47 std::unique_ptr<Buffer> buffer( |
49 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); | 48 new Buffer(exo_test_helper()->CreateGpuMemoryBuffer(buffer_size))); |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 .WillRepeatedly(testing::Return(true)); | 245 .WillRepeatedly(testing::Return(true)); |
247 EXPECT_CALL(delegate, OnPointerFrame()).Times(4); | 246 EXPECT_CALL(delegate, OnPointerFrame()).Times(4); |
248 | 247 |
249 EXPECT_CALL(delegate, OnPointerEnter(surface.get(), gfx::PointF(), 0)); | 248 EXPECT_CALL(delegate, OnPointerEnter(surface.get(), gfx::PointF(), 0)); |
250 generator.MoveMouseTo(location); | 249 generator.MoveMouseTo(location); |
251 | 250 |
252 { | 251 { |
253 // Expect fling stop followed by scroll and scroll stop. | 252 // Expect fling stop followed by scroll and scroll stop. |
254 testing::InSequence sequence; | 253 testing::InSequence sequence; |
255 | 254 |
256 EXPECT_CALL(delegate, OnPointerScrollCancel(testing::_)); | |
257 EXPECT_CALL(delegate, | 255 EXPECT_CALL(delegate, |
258 OnPointerScroll(testing::_, gfx::Vector2dF(1.2, 1.2), false)); | 256 OnPointerScroll(testing::_, gfx::Vector2dF(1.2, 1.2), false)); |
259 EXPECT_CALL(delegate, OnPointerScrollStop(testing::_)); | 257 EXPECT_CALL(delegate, OnPointerScrollStop(testing::_)); |
260 } | 258 } |
261 generator.ScrollSequence(location, base::TimeDelta(), 1, 1, 1, 1); | 259 generator.ScrollSequence(location, base::TimeDelta(), 1, 1, 1, 1); |
262 | 260 |
263 EXPECT_CALL(delegate, OnPointerDestroying(pointer.get())); | 261 EXPECT_CALL(delegate, OnPointerDestroying(pointer.get())); |
264 pointer.reset(); | 262 pointer.reset(); |
265 } | 263 } |
266 | 264 |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 testing::InSequence sequence; | 341 testing::InSequence sequence; |
344 EXPECT_CALL(delegate, | 342 EXPECT_CALL(delegate, |
345 OnPointerButton(testing::_, ui::EF_LEFT_MOUSE_BUTTON, true)); | 343 OnPointerButton(testing::_, ui::EF_LEFT_MOUSE_BUTTON, true)); |
346 EXPECT_CALL(delegate, | 344 EXPECT_CALL(delegate, |
347 OnPointerButton(testing::_, ui::EF_LEFT_MOUSE_BUTTON, false)); | 345 OnPointerButton(testing::_, ui::EF_LEFT_MOUSE_BUTTON, false)); |
348 } | 346 } |
349 generator.ClickLeftButton(); | 347 generator.ClickLeftButton(); |
350 | 348 |
351 { | 349 { |
352 testing::InSequence sequence; | 350 testing::InSequence sequence; |
353 EXPECT_CALL(delegate, OnPointerScrollCancel(testing::_)); | |
354 EXPECT_CALL(delegate, | 351 EXPECT_CALL(delegate, |
355 OnPointerScroll(testing::_, gfx::Vector2dF(1.2, 1.2), false)); | 352 OnPointerScroll(testing::_, gfx::Vector2dF(1.2, 1.2), false)); |
356 EXPECT_CALL(delegate, OnPointerScrollStop(testing::_)); | 353 EXPECT_CALL(delegate, OnPointerScrollStop(testing::_)); |
357 } | 354 } |
358 generator.ScrollSequence(location2, base::TimeDelta(), 1, 1, 1, 1); | 355 generator.ScrollSequence(location2, base::TimeDelta(), 1, 1, 1, 1); |
359 | 356 |
360 { | 357 { |
361 testing::InSequence sequence; | 358 testing::InSequence sequence; |
362 EXPECT_CALL(delegate, OnPointerLeave(surface2.get())); | 359 EXPECT_CALL(delegate, OnPointerLeave(surface2.get())); |
363 } | 360 } |
(...skipping 20 matching lines...) Expand all Loading... |
384 OnPointerButton(testing::_, ui::EF_LEFT_MOUSE_BUTTON, true)) | 381 OnPointerButton(testing::_, ui::EF_LEFT_MOUSE_BUTTON, true)) |
385 .Times(0); | 382 .Times(0); |
386 EXPECT_CALL(delegate, | 383 EXPECT_CALL(delegate, |
387 OnPointerButton(testing::_, ui::EF_LEFT_MOUSE_BUTTON, false)) | 384 OnPointerButton(testing::_, ui::EF_LEFT_MOUSE_BUTTON, false)) |
388 .Times(0); | 385 .Times(0); |
389 } | 386 } |
390 generator.ClickLeftButton(); | 387 generator.ClickLeftButton(); |
391 | 388 |
392 { | 389 { |
393 testing::InSequence sequence; | 390 testing::InSequence sequence; |
394 EXPECT_CALL(delegate, OnPointerScrollCancel(testing::_)).Times(0); | |
395 EXPECT_CALL(delegate, | 391 EXPECT_CALL(delegate, |
396 OnPointerScroll(testing::_, gfx::Vector2dF(1.2, 1.2), false)) | 392 OnPointerScroll(testing::_, gfx::Vector2dF(1.2, 1.2), false)) |
397 .Times(0); | 393 .Times(0); |
398 EXPECT_CALL(delegate, OnPointerScrollStop(testing::_)).Times(0); | 394 EXPECT_CALL(delegate, OnPointerScrollStop(testing::_)).Times(0); |
399 } | 395 } |
400 generator.ScrollSequence(location, base::TimeDelta(), 1, 1, 1, 1); | 396 generator.ScrollSequence(location, base::TimeDelta(), 1, 1, 1, 1); |
401 | 397 |
402 { | 398 { |
403 testing::InSequence sequence; | 399 testing::InSequence sequence; |
404 EXPECT_CALL(delegate, OnPointerLeave(surface.get())).Times(0); | 400 EXPECT_CALL(delegate, OnPointerLeave(surface.get())).Times(0); |
(...skipping 21 matching lines...) Expand all Loading... |
426 testing::InSequence sequence; | 422 testing::InSequence sequence; |
427 EXPECT_CALL(delegate, | 423 EXPECT_CALL(delegate, |
428 OnPointerButton(testing::_, ui::EF_LEFT_MOUSE_BUTTON, true)); | 424 OnPointerButton(testing::_, ui::EF_LEFT_MOUSE_BUTTON, true)); |
429 EXPECT_CALL(delegate, | 425 EXPECT_CALL(delegate, |
430 OnPointerButton(testing::_, ui::EF_LEFT_MOUSE_BUTTON, false)); | 426 OnPointerButton(testing::_, ui::EF_LEFT_MOUSE_BUTTON, false)); |
431 } | 427 } |
432 generator.ClickLeftButton(); | 428 generator.ClickLeftButton(); |
433 | 429 |
434 { | 430 { |
435 testing::InSequence sequence; | 431 testing::InSequence sequence; |
436 EXPECT_CALL(delegate, OnPointerScrollCancel(testing::_)); | |
437 EXPECT_CALL(delegate, | 432 EXPECT_CALL(delegate, |
438 OnPointerScroll(testing::_, gfx::Vector2dF(1.2, 1.2), false)); | 433 OnPointerScroll(testing::_, gfx::Vector2dF(1.2, 1.2), false)); |
439 EXPECT_CALL(delegate, OnPointerScrollStop(testing::_)); | 434 EXPECT_CALL(delegate, OnPointerScrollStop(testing::_)); |
440 } | 435 } |
441 generator.ScrollSequence(location, base::TimeDelta(), 1, 1, 1, 1); | 436 generator.ScrollSequence(location, base::TimeDelta(), 1, 1, 1, 1); |
442 | 437 |
443 { | 438 { |
444 testing::InSequence sequence; | 439 testing::InSequence sequence; |
445 EXPECT_CALL(delegate, OnPointerLeave(surface.get())); | 440 EXPECT_CALL(delegate, OnPointerLeave(surface.get())); |
446 } | 441 } |
447 generator.MoveMouseTo(surface->window()->GetBoundsInScreen().bottom_right()); | 442 generator.MoveMouseTo(surface->window()->GetBoundsInScreen().bottom_right()); |
448 | 443 |
449 EXPECT_CALL(delegate, OnPointerDestroying(pointer.get())); | 444 EXPECT_CALL(delegate, OnPointerDestroying(pointer.get())); |
450 pointer.reset(); | 445 pointer.reset(); |
451 } | 446 } |
452 | 447 |
453 } // namespace | 448 } // namespace |
454 } // namespace exo | 449 } // namespace exo |
OLD | NEW |