Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1719)

Unified Diff: components/mus/ws/window_tree_apptest.cc

Issue 1465803003: mus: Let clients set the cursor of their window. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix WindowTreeAppTest.SetCursor. Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 70613fc1f9692880ce6c8c509a7a9f0e12b47f1e..1ce74b3f253988eeeede68fba8f463d3056d07e5 100644
--- a/components/mus/ws/window_tree_apptest.cc
+++ b/components/mus/ws/window_tree_apptest.cc
@@ -257,6 +257,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);
+ }
+
private:
// Used when running a nested MessageLoop.
struct WaitState {
@@ -353,6 +359,10 @@ class TestWindowTreeClientImpl : public mojom::WindowTreeClient,
}
// TODO(sky): add testing coverage.
void OnWindowFocused(uint32_t focused_window_id) override {}
+ void OnWindowSetPredefinedCursor(uint32 window_id,
+ mojom::Cursor cursor_id) override {
+ tracker_.OnWindowSetPredefinedCursor(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;
@@ -1415,6 +1425,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.

Powered by Google App Engine
This is Rietveld 408576698