OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/public/cpp/config.h" | 5 #include "ash/public/cpp/config.h" |
6 #include "ash/public/cpp/shell_window_ids.h" | 6 #include "ash/public/cpp/shell_window_ids.h" |
7 #include "ash/shell.h" | 7 #include "ash/shell.h" |
8 #include "ash/test/ash_test_base.h" | 8 #include "ash/test/ash_test_base.h" |
9 #include "ash/test/test_activation_delegate.h" | 9 #include "ash/test/test_activation_delegate.h" |
10 #include "ash/wm/window_util.h" | 10 #include "ash/wm/window_util.h" |
(...skipping 474 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
485 gfx::Point point1(kWindowLeft, kWindowTop); | 485 gfx::Point point1(kWindowLeft, kWindowTop); |
486 aura::Window::ConvertPointToTarget(window->parent(), root_window, &point1); | 486 aura::Window::ConvertPointToTarget(window->parent(), root_window, &point1); |
487 | 487 |
488 gfx::Point point2(kWindowLeft + 1, kWindowTop + 1); | 488 gfx::Point point2(kWindowLeft + 1, kWindowTop + 1); |
489 aura::Window::ConvertPointToTarget(window->parent(), root_window, &point2); | 489 aura::Window::ConvertPointToTarget(window->parent(), root_window, &point2); |
490 | 490 |
491 aura::WindowTreeHost* host = root_window->GetHost(); | 491 aura::WindowTreeHost* host = root_window->GetHost(); |
492 ui::EventSink* sink = host->event_sink(); | 492 ui::EventSink* sink = host->event_sink(); |
493 | 493 |
494 // Cursor starts as a pointer (set during Shell::Init()). | 494 // Cursor starts as a pointer (set during Shell::Init()). |
495 EXPECT_EQ(ui::kCursorPointer, host->last_cursor().native_type()); | 495 EXPECT_EQ(ui::CursorType::kPointer, host->last_cursor().native_type()); |
496 | 496 |
497 { | 497 { |
498 // Resize edges and corners show proper cursors. | 498 // Resize edges and corners show proper cursors. |
499 window_delegate.set_hittest_code(HTBOTTOM); | 499 window_delegate.set_hittest_code(HTBOTTOM); |
500 ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1, | 500 ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1, |
501 ui::EventTimeForNow(), 0, 0); | 501 ui::EventTimeForNow(), 0, 0); |
502 ui::EventDispatchDetails details = sink->OnEventFromSource(&move1); | 502 ui::EventDispatchDetails details = sink->OnEventFromSource(&move1); |
503 ASSERT_FALSE(details.dispatcher_destroyed); | 503 ASSERT_FALSE(details.dispatcher_destroyed); |
504 EXPECT_EQ(ui::kCursorSouthResize, host->last_cursor().native_type()); | 504 EXPECT_EQ(ui::CursorType::kSouthResize, host->last_cursor().native_type()); |
505 } | 505 } |
506 | 506 |
507 { | 507 { |
508 window_delegate.set_hittest_code(HTBOTTOMLEFT); | 508 window_delegate.set_hittest_code(HTBOTTOMLEFT); |
509 ui::MouseEvent move2(ui::ET_MOUSE_MOVED, point2, point2, | 509 ui::MouseEvent move2(ui::ET_MOUSE_MOVED, point2, point2, |
510 ui::EventTimeForNow(), 0, 0); | 510 ui::EventTimeForNow(), 0, 0); |
511 ui::EventDispatchDetails details = sink->OnEventFromSource(&move2); | 511 ui::EventDispatchDetails details = sink->OnEventFromSource(&move2); |
512 ASSERT_FALSE(details.dispatcher_destroyed); | 512 ASSERT_FALSE(details.dispatcher_destroyed); |
513 EXPECT_EQ(ui::kCursorSouthWestResize, host->last_cursor().native_type()); | 513 EXPECT_EQ(ui::CursorType::kSouthWestResize, |
| 514 host->last_cursor().native_type()); |
514 } | 515 } |
515 | 516 |
516 { | 517 { |
517 window_delegate.set_hittest_code(HTBOTTOMRIGHT); | 518 window_delegate.set_hittest_code(HTBOTTOMRIGHT); |
518 ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1, | 519 ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1, |
519 ui::EventTimeForNow(), 0, 0); | 520 ui::EventTimeForNow(), 0, 0); |
520 ui::EventDispatchDetails details = sink->OnEventFromSource(&move1); | 521 ui::EventDispatchDetails details = sink->OnEventFromSource(&move1); |
521 ASSERT_FALSE(details.dispatcher_destroyed); | 522 ASSERT_FALSE(details.dispatcher_destroyed); |
522 EXPECT_EQ(ui::kCursorSouthEastResize, host->last_cursor().native_type()); | 523 EXPECT_EQ(ui::CursorType::kSouthEastResize, |
| 524 host->last_cursor().native_type()); |
523 } | 525 } |
524 | 526 |
525 { | 527 { |
526 window_delegate.set_hittest_code(HTLEFT); | 528 window_delegate.set_hittest_code(HTLEFT); |
527 ui::MouseEvent move2(ui::ET_MOUSE_MOVED, point2, point2, | 529 ui::MouseEvent move2(ui::ET_MOUSE_MOVED, point2, point2, |
528 ui::EventTimeForNow(), 0, 0); | 530 ui::EventTimeForNow(), 0, 0); |
529 ui::EventDispatchDetails details = sink->OnEventFromSource(&move2); | 531 ui::EventDispatchDetails details = sink->OnEventFromSource(&move2); |
530 ASSERT_FALSE(details.dispatcher_destroyed); | 532 ASSERT_FALSE(details.dispatcher_destroyed); |
531 EXPECT_EQ(ui::kCursorWestResize, host->last_cursor().native_type()); | 533 EXPECT_EQ(ui::CursorType::kWestResize, host->last_cursor().native_type()); |
532 } | 534 } |
533 | 535 |
534 { | 536 { |
535 window_delegate.set_hittest_code(HTRIGHT); | 537 window_delegate.set_hittest_code(HTRIGHT); |
536 ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1, | 538 ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1, |
537 ui::EventTimeForNow(), 0, 0); | 539 ui::EventTimeForNow(), 0, 0); |
538 ui::EventDispatchDetails details = sink->OnEventFromSource(&move1); | 540 ui::EventDispatchDetails details = sink->OnEventFromSource(&move1); |
539 ASSERT_FALSE(details.dispatcher_destroyed); | 541 ASSERT_FALSE(details.dispatcher_destroyed); |
540 EXPECT_EQ(ui::kCursorEastResize, host->last_cursor().native_type()); | 542 EXPECT_EQ(ui::CursorType::kEastResize, host->last_cursor().native_type()); |
541 } | 543 } |
542 | 544 |
543 { | 545 { |
544 window_delegate.set_hittest_code(HTTOP); | 546 window_delegate.set_hittest_code(HTTOP); |
545 ui::MouseEvent move2(ui::ET_MOUSE_MOVED, point2, point2, | 547 ui::MouseEvent move2(ui::ET_MOUSE_MOVED, point2, point2, |
546 ui::EventTimeForNow(), 0, 0); | 548 ui::EventTimeForNow(), 0, 0); |
547 ui::EventDispatchDetails details = sink->OnEventFromSource(&move2); | 549 ui::EventDispatchDetails details = sink->OnEventFromSource(&move2); |
548 ASSERT_FALSE(details.dispatcher_destroyed); | 550 ASSERT_FALSE(details.dispatcher_destroyed); |
549 EXPECT_EQ(ui::kCursorNorthResize, host->last_cursor().native_type()); | 551 EXPECT_EQ(ui::CursorType::kNorthResize, host->last_cursor().native_type()); |
550 } | 552 } |
551 | 553 |
552 { | 554 { |
553 window_delegate.set_hittest_code(HTTOPLEFT); | 555 window_delegate.set_hittest_code(HTTOPLEFT); |
554 ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1, | 556 ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1, |
555 ui::EventTimeForNow(), 0, 0); | 557 ui::EventTimeForNow(), 0, 0); |
556 ui::EventDispatchDetails details = sink->OnEventFromSource(&move1); | 558 ui::EventDispatchDetails details = sink->OnEventFromSource(&move1); |
557 ASSERT_FALSE(details.dispatcher_destroyed); | 559 ASSERT_FALSE(details.dispatcher_destroyed); |
558 EXPECT_EQ(ui::kCursorNorthWestResize, host->last_cursor().native_type()); | 560 EXPECT_EQ(ui::CursorType::kNorthWestResize, |
| 561 host->last_cursor().native_type()); |
559 } | 562 } |
560 | 563 |
561 { | 564 { |
562 window_delegate.set_hittest_code(HTTOPRIGHT); | 565 window_delegate.set_hittest_code(HTTOPRIGHT); |
563 ui::MouseEvent move2(ui::ET_MOUSE_MOVED, point2, point2, | 566 ui::MouseEvent move2(ui::ET_MOUSE_MOVED, point2, point2, |
564 ui::EventTimeForNow(), 0, 0); | 567 ui::EventTimeForNow(), 0, 0); |
565 ui::EventDispatchDetails details = sink->OnEventFromSource(&move2); | 568 ui::EventDispatchDetails details = sink->OnEventFromSource(&move2); |
566 ASSERT_FALSE(details.dispatcher_destroyed); | 569 ASSERT_FALSE(details.dispatcher_destroyed); |
567 EXPECT_EQ(ui::kCursorNorthEastResize, host->last_cursor().native_type()); | 570 EXPECT_EQ(ui::CursorType::kNorthEastResize, |
| 571 host->last_cursor().native_type()); |
568 } | 572 } |
569 | 573 |
570 { | 574 { |
571 // Client area uses null cursor. | 575 // Client area uses null cursor. |
572 window_delegate.set_hittest_code(HTCLIENT); | 576 window_delegate.set_hittest_code(HTCLIENT); |
573 ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1, | 577 ui::MouseEvent move1(ui::ET_MOUSE_MOVED, point1, point1, |
574 ui::EventTimeForNow(), 0, 0); | 578 ui::EventTimeForNow(), 0, 0); |
575 ui::EventDispatchDetails details = sink->OnEventFromSource(&move1); | 579 ui::EventDispatchDetails details = sink->OnEventFromSource(&move1); |
576 ASSERT_FALSE(details.dispatcher_destroyed); | 580 ASSERT_FALSE(details.dispatcher_destroyed); |
577 EXPECT_EQ(ui::kCursorNull, host->last_cursor().native_type()); | 581 EXPECT_EQ(ui::CursorType::kNull, host->last_cursor().native_type()); |
578 } | 582 } |
579 } | 583 } |
580 | 584 |
581 TEST_F(WindowManagerTest, TransformActivate) { | 585 TEST_F(WindowManagerTest, TransformActivate) { |
582 aura::Window* root_window = Shell::GetPrimaryRootWindow(); | 586 aura::Window* root_window = Shell::GetPrimaryRootWindow(); |
583 gfx::Size size = root_window->bounds().size(); | 587 gfx::Size size = root_window->bounds().size(); |
584 EXPECT_EQ(gfx::Rect(size).ToString(), | 588 EXPECT_EQ(gfx::Rect(size).ToString(), |
585 display::Screen::GetScreen() | 589 display::Screen::GetScreen() |
586 ->GetDisplayNearestPoint(gfx::Point()) | 590 ->GetDisplayNearestPoint(gfx::Point()) |
587 .bounds() | 591 .bounds() |
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
853 observer_b.reset(); | 857 observer_b.reset(); |
854 generator.MoveMouseTo(50, 50); | 858 generator.MoveMouseTo(50, 50); |
855 EXPECT_TRUE(observer_a.did_visibility_change()); | 859 EXPECT_TRUE(observer_a.did_visibility_change()); |
856 EXPECT_FALSE(observer_b.did_visibility_change()); | 860 EXPECT_FALSE(observer_b.did_visibility_change()); |
857 EXPECT_TRUE(observer_a.is_cursor_visible()); | 861 EXPECT_TRUE(observer_a.is_cursor_visible()); |
858 | 862 |
859 cursor_manager->RemoveObserver(&observer_a); | 863 cursor_manager->RemoveObserver(&observer_a); |
860 } | 864 } |
861 | 865 |
862 } // namespace ash | 866 } // namespace ash |
OLD | NEW |