Index: components/mus/ws/window_tree_apptest.cc |
diff --git a/components/mus/ws/window_tree_apptest.cc b/components/mus/ws/window_tree_apptest.cc |
index 3895571ae595288c532f9f0e1fef1e48269070d7..e5fac7442b0eeacdbb1c536b0500761563bd72f4 100644 |
--- a/components/mus/ws/window_tree_apptest.cc |
+++ b/components/mus/ws/window_tree_apptest.cc |
@@ -248,6 +248,12 @@ class TestWindowTreeClientImpl : public mojom::WindowTreeClient, |
return WaitForChangeCompleted(change_id); |
} |
+ bool SetPredefinedCursor(Id window_id, mojom::Cursor cursor) { |
+ const uint32_t change_id = GetAndAdvanceChangeId(); |
+ tree()->SetPredefinedCursor(change_id, window_id, cursor); |
+ return WaitForChangeCompleted(change_id); |
+ } |
+ |
bool SetWindowVisibility(Id window_id, bool visible) { |
const uint32_t change_id = GetAndAdvanceChangeId(); |
tree()->SetWindowVisibility(change_id, window_id, visible); |
@@ -350,6 +356,10 @@ class TestWindowTreeClientImpl : public mojom::WindowTreeClient, |
} |
// TODO(sky): add testing coverage. |
void OnWindowFocused(uint32_t focused_window_id) override {} |
+ void OnWindowPredefinedCursorChanged(uint32 window_id, |
+ mojom::Cursor cursor_id) override { |
+ tracker_.OnWindowPredefinedCursorChanged(window_id, cursor_id); |
+ } |
void OnChangeCompleted(uint32_t change_id, bool success) override { |
if (waiting_change_id_ == change_id && change_completed_run_loop_) { |
on_change_completed_result_ = success; |
@@ -1412,6 +1422,21 @@ TEST_F(WindowTreeAppTest, SetWindowVisibility) { |
} |
} |
+// Test that we hear the cursor change in other connections. |
+TEST_F(WindowTreeAppTest, SetCursor) { |
+ // Get a second connection to listen in. |
+ ASSERT_NO_FATAL_FAILURE(EstablishSecondConnection(true)); |
+ Id window_1_1 = BuildWindowId(connection_id_1(), 1); |
+ changes2()->clear(); |
+ |
+ ASSERT_TRUE(ws_client1()->SetPredefinedCursor(window_1_1, |
+ mojom::Cursor::CURSOR_IBEAM)); |
+ ws_client2_->WaitForChangeCount(1u); |
+ |
+ EXPECT_EQ("CursorChanged id=" + IdToString(window_1_1) + " cursor_id=4", |
+ SingleChangeToDescription(*changes2())); |
+} |
+ |
// Assertions for SetWindowVisibility sending notifications. |
TEST_F(WindowTreeAppTest, SetWindowVisibilityNotifications) { |
// Create 1,1 and 1,2. 1,2 is made a child of 1,1 and 1,1 a child of the root. |