| Index: services/ui/ws/window_tree_unittest.cc
|
| diff --git a/services/ui/ws/window_tree_unittest.cc b/services/ui/ws/window_tree_unittest.cc
|
| index 1d64d28f69545c33ac0e528a05cdfda3354a2b5d..15a844ae7e21706733947197ee8ec91648bf51ff 100644
|
| --- a/services/ui/ws/window_tree_unittest.cc
|
| +++ b/services/ui/ws/window_tree_unittest.cc
|
| @@ -31,6 +31,7 @@
|
| #include "services/ui/ws/window_server_delegate.h"
|
| #include "services/ui/ws/window_tree_binding.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| +#include "ui/base/cursor/cursor.h"
|
| #include "ui/events/event.h"
|
| #include "ui/events/event_utils.h"
|
| #include "ui/gfx/geometry/rect.h"
|
| @@ -129,8 +130,8 @@ class WindowTreeTest : public testing::Test {
|
| WindowTreeTest() {}
|
| ~WindowTreeTest() override {}
|
|
|
| - ui::mojom::CursorType cursor_id() {
|
| - return window_event_targeting_helper_.cursor();
|
| + ui::CursorType cursor_type() {
|
| + return window_event_targeting_helper_.cursor_type();
|
| }
|
| Display* display() { return window_event_targeting_helper_.display(); }
|
| TestWindowTreeClient* last_window_tree_client() {
|
| @@ -475,11 +476,11 @@ TEST_F(WindowTreeTest, CursorChangesWhenMouseOverWindowAndWindowSetsCursor) {
|
| DispatchEventAndAckImmediately(CreateMouseMoveEvent(21, 22));
|
|
|
| // Set the cursor on the parent as that is where the cursor is picked up from.
|
| - window->parent()->SetPredefinedCursor(mojom::CursorType::kIBeam);
|
| + window->parent()->SetCursor(ui::CursorData(ui::CursorType::kIBeam));
|
|
|
| // Because the cursor is over the window when SetCursor was called, we should
|
| // have immediately changed the cursor.
|
| - EXPECT_EQ(mojom::CursorType::kIBeam, cursor_id());
|
| + EXPECT_EQ(ui::CursorType::kIBeam, cursor_type());
|
| }
|
|
|
| TEST_F(WindowTreeTest, CursorChangesWhenEnteringWindowWithDifferentCursor) {
|
| @@ -492,11 +493,11 @@ TEST_F(WindowTreeTest, CursorChangesWhenEnteringWindowWithDifferentCursor) {
|
| // inside.
|
| DispatchEventAndAckImmediately(CreateMouseMoveEvent(5, 5));
|
| // Set the cursor on the parent as that is where the cursor is picked up from.
|
| - window->parent()->SetPredefinedCursor(mojom::CursorType::kIBeam);
|
| - EXPECT_EQ(mojom::CursorType::kPointer, cursor_id());
|
| + window->parent()->SetCursor(ui::CursorData(ui::CursorType::kIBeam));
|
| + EXPECT_EQ(ui::CursorType::kPointer, cursor_type());
|
|
|
| DispatchEventAndAckImmediately(CreateMouseMoveEvent(21, 22));
|
| - EXPECT_EQ(mojom::CursorType::kIBeam, cursor_id());
|
| + EXPECT_EQ(ui::CursorType::kIBeam, cursor_type());
|
| }
|
|
|
| TEST_F(WindowTreeTest, TouchesDontChangeCursor) {
|
| @@ -508,12 +509,12 @@ TEST_F(WindowTreeTest, TouchesDontChangeCursor) {
|
| // Let's create a pointer event outside the window and then move the pointer
|
| // inside.
|
| DispatchEventAndAckImmediately(CreateMouseMoveEvent(5, 5));
|
| - window->SetPredefinedCursor(mojom::CursorType::kIBeam);
|
| - EXPECT_EQ(mojom::CursorType::kPointer, cursor_id());
|
| + window->SetCursor(ui::CursorData(ui::CursorType::kIBeam));
|
| + EXPECT_EQ(ui::CursorType::kPointer, cursor_type());
|
|
|
| // With a touch event, we shouldn't update the cursor.
|
| DispatchEventAndAckImmediately(CreatePointerDownEvent(21, 22));
|
| - EXPECT_EQ(mojom::CursorType::kPointer, cursor_id());
|
| + EXPECT_EQ(ui::CursorType::kPointer, cursor_type());
|
| }
|
|
|
| TEST_F(WindowTreeTest, DragOutsideWindow) {
|
| @@ -526,25 +527,25 @@ TEST_F(WindowTreeTest, DragOutsideWindow) {
|
| // change the cursor.
|
| DispatchEventAndAckImmediately(CreateMouseMoveEvent(5, 5));
|
| // Set the cursor on the parent as that is where the cursor is picked up from.
|
| - window->parent()->SetPredefinedCursor(mojom::CursorType::kIBeam);
|
| - EXPECT_EQ(mojom::CursorType::kPointer, cursor_id());
|
| + window->parent()->SetCursor(ui::CursorData(ui::CursorType::kIBeam));
|
| + EXPECT_EQ(ui::CursorType::kPointer, cursor_type());
|
|
|
| // Move the pointer to the inside of the window
|
| DispatchEventAndAckImmediately(CreateMouseMoveEvent(21, 22));
|
| - EXPECT_EQ(mojom::CursorType::kIBeam, cursor_id());
|
| + EXPECT_EQ(ui::CursorType::kIBeam, cursor_type());
|
|
|
| // Start the drag.
|
| DispatchEventAndAckImmediately(CreateMouseDownEvent(21, 22));
|
| - EXPECT_EQ(mojom::CursorType::kIBeam, cursor_id());
|
| + EXPECT_EQ(ui::CursorType::kIBeam, cursor_type());
|
|
|
| // Move the cursor (mouse is still down) outside the window.
|
| DispatchEventAndAckImmediately(CreateMouseMoveEvent(5, 5));
|
| - EXPECT_EQ(mojom::CursorType::kIBeam, cursor_id());
|
| + EXPECT_EQ(ui::CursorType::kIBeam, cursor_type());
|
|
|
| // Release the cursor. We should now adapt the cursor of the window
|
| // underneath the pointer.
|
| DispatchEventAndAckImmediately(CreateMouseUpEvent(5, 5));
|
| - EXPECT_EQ(mojom::CursorType::kPointer, cursor_id());
|
| + EXPECT_EQ(ui::CursorType::kPointer, cursor_type());
|
| }
|
|
|
| TEST_F(WindowTreeTest, ChangingWindowBoundsChangesCursor) {
|
| @@ -556,17 +557,17 @@ TEST_F(WindowTreeTest, ChangingWindowBoundsChangesCursor) {
|
| // Put the cursor just outside the bounds of the window.
|
| DispatchEventAndAckImmediately(CreateMouseMoveEvent(41, 41));
|
| // Sets the cursor on the root as that is where the cursor is picked up from.
|
| - window->parent()->SetPredefinedCursor(mojom::CursorType::kIBeam);
|
| - EXPECT_EQ(mojom::CursorType::kPointer, cursor_id());
|
| + window->parent()->SetCursor(ui::CursorData(ui::CursorType::kIBeam));
|
| + EXPECT_EQ(ui::CursorType::kPointer, cursor_type());
|
|
|
| // Expand the bounds of the window so they now include where the cursor now
|
| // is.
|
| window->SetBounds(gfx::Rect(20, 20, 25, 25));
|
| - EXPECT_EQ(mojom::CursorType::kIBeam, cursor_id());
|
| + EXPECT_EQ(ui::CursorType::kIBeam, cursor_type());
|
|
|
| // Contract the bounds again.
|
| window->SetBounds(gfx::Rect(20, 20, 20, 20));
|
| - EXPECT_EQ(mojom::CursorType::kPointer, cursor_id());
|
| + EXPECT_EQ(ui::CursorType::kPointer, cursor_type());
|
| }
|
|
|
| TEST_F(WindowTreeTest, WindowReorderingChangesCursor) {
|
| @@ -583,14 +584,14 @@ TEST_F(WindowTreeTest, WindowReorderingChangesCursor) {
|
| mojom::EventTargetingPolicy::TARGET_AND_DESCENDANTS);
|
| embed_window2->set_event_targeting_policy(
|
| mojom::EventTargetingPolicy::TARGET_AND_DESCENDANTS);
|
| - embed_window1->SetPredefinedCursor(mojom::CursorType::kIBeam);
|
| - embed_window2->SetPredefinedCursor(mojom::CursorType::kCross);
|
| + embed_window1->SetCursor(ui::CursorData(ui::CursorType::kIBeam));
|
| + embed_window2->SetCursor(ui::CursorData(ui::CursorType::kCross));
|
| DispatchEventAndAckImmediately(CreateMouseMoveEvent(5, 5));
|
| // Cursor should match that of top-most window, which is |embed_window2|.
|
| - EXPECT_EQ(mojom::CursorType::kCross, cursor_id());
|
| + EXPECT_EQ(ui::CursorType::kCross, cursor_type());
|
| // Move |embed_window1| on top, cursor should now match it.
|
| embed_window1->parent()->StackChildAtTop(embed_window1);
|
| - EXPECT_EQ(mojom::CursorType::kIBeam, cursor_id());
|
| + EXPECT_EQ(ui::CursorType::kIBeam, cursor_type());
|
| }
|
|
|
| // Assertions around moving cursor between trees with roots.
|
| @@ -608,9 +609,9 @@ TEST_F(WindowTreeTest, CursorMultipleTrees) {
|
| mojom::EventTargetingPolicy::TARGET_AND_DESCENDANTS);
|
| embed_window2->parent()->set_event_targeting_policy(
|
| mojom::EventTargetingPolicy::TARGET_AND_DESCENDANTS);
|
| - embed_window1->SetPredefinedCursor(mojom::CursorType::kIBeam);
|
| - embed_window2->SetPredefinedCursor(mojom::CursorType::kCross);
|
| - embed_window1->parent()->SetPredefinedCursor(mojom::CursorType::kCopy);
|
| + embed_window1->SetCursor(ui::CursorData(ui::CursorType::kIBeam));
|
| + embed_window2->SetCursor(ui::CursorData(ui::CursorType::kCross));
|
| + embed_window1->parent()->SetCursor(ui::CursorData(ui::CursorType::kCopy));
|
|
|
| // Create a child of |embed_window1|.
|
| ServerWindow* embed_window1_child = NewWindowInTreeWithParent(
|
| @@ -621,15 +622,15 @@ TEST_F(WindowTreeTest, CursorMultipleTrees) {
|
|
|
| // Move mouse into |embed_window1|.
|
| DispatchEventAndAckImmediately(CreateMouseMoveEvent(5, 5));
|
| - EXPECT_EQ(mojom::CursorType::kIBeam, cursor_id());
|
| + EXPECT_EQ(ui::CursorType::kIBeam, cursor_type());
|
|
|
| // Move mouse into |embed_window2|.
|
| DispatchEventAndAckImmediately(CreateMouseMoveEvent(25, 25));
|
| - EXPECT_EQ(mojom::CursorType::kCross, cursor_id());
|
| + EXPECT_EQ(ui::CursorType::kCross, cursor_type());
|
|
|
| // Move mouse into area between, which should use cursor set on parent.
|
| DispatchEventAndAckImmediately(CreateMouseMoveEvent(15, 15));
|
| - EXPECT_EQ(mojom::CursorType::kCopy, cursor_id());
|
| + EXPECT_EQ(ui::CursorType::kCopy, cursor_type());
|
| }
|
|
|
| TEST_F(WindowTreeTest, EventAck) {
|
|
|