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

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: Do it the other way + explicit checks that it is a mouse pointer. 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
« no previous file with comments | « components/mus/ws/window_manager_access_policy.cc ('k') | components/mus/ws/window_tree_host_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « components/mus/ws/window_manager_access_policy.cc ('k') | components/mus/ws/window_tree_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698