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

Unified Diff: services/ui/ws/window_tree_unittest.cc

Issue 2918553003: Implement a MoveCursorToScreenLocation for just the window manager. (Closed)
Patch Set: Thread to the PlatformWindow. Created 3 years, 7 months 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 | « services/ui/ws/window_tree.cc ('k') | ui/aura/mus/window_tree_client.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 83b9de099926e015bba67ebad73b2c511145f941..8350e1f96b1faa40670fd8cf4c38805c88756529 100644
--- a/services/ui/ws/window_tree_unittest.cc
+++ b/services/ui/ws/window_tree_unittest.cc
@@ -1493,6 +1493,45 @@ TEST_F(WindowTreeTest, SetModalTypeForwardedToWindowManager) {
EXPECT_TRUE(wm_internal.on_set_modal_type_called());
}
+TEST_F(WindowTreeTest, TestWindowManagerSettingCursorLocation) {
+ const ClientWindowId embed_window_id = BuildClientWindowId(wm_tree(), 1);
+ EXPECT_TRUE(
+ wm_tree()->NewWindow(embed_window_id, ServerWindow::Properties()));
+ ServerWindow* embed_window = wm_tree()->GetWindowByClientId(embed_window_id);
+ ASSERT_TRUE(embed_window);
+ EXPECT_TRUE(wm_tree()->SetWindowVisibility(embed_window_id, true));
+ ASSERT_TRUE(FirstRoot(wm_tree()));
+ const ClientWindowId wm_root_id = FirstRootId(wm_tree());
+ EXPECT_TRUE(wm_tree()->AddWindow(wm_root_id, embed_window_id));
+ ServerWindow* wm_root = FirstRoot(wm_tree());
+ ASSERT_TRUE(wm_root);
+ wm_root->SetBounds(gfx::Rect(0, 0, 100, 100));
+ // This tests expects |wm_root| to be a possible target.
+ wm_root->set_event_targeting_policy(
+ mojom::EventTargetingPolicy::TARGET_AND_DESCENDANTS);
+ display()->root_window()->SetBounds(gfx::Rect(0, 0, 100, 100));
+ mojom::WindowTreeClientPtr client;
+ wm_client()->Bind(mojo::MakeRequest(&client));
+ const uint32_t embed_flags = 0;
+ wm_tree()->Embed(embed_window_id, std::move(client), embed_flags);
+ WindowTree* tree1 = window_server()->GetTreeWithRoot(embed_window);
+ ASSERT_TRUE(tree1 != nullptr);
+ ASSERT_NE(tree1, wm_tree());
+
+ embed_window->SetBounds(gfx::Rect(20, 20, 20, 20));
+ embed_window->SetCursor(ui::CursorData(ui::CursorType::kIBeam));
+
+ // Because the cursor is still at the origin, changing the cursor shouldn't
+ // have switched to ibeam.
+ EXPECT_EQ(ui::CursorType::kPointer, cursor_type());
+
+ // Have the window manager mvoe the cursor within the embed window.
sky 2017/06/02 13:10:07 mvoe -> move
+ static_cast<mojom::WindowManagerClient*>(wm_tree())
+ ->WmMoveCursorToDisplayLocation(gfx::Point(21, 21), -1);
+
+ EXPECT_EQ(ui::CursorType::kIBeam, cursor_type());
+}
+
using WindowTreeShutdownTest = testing::Test;
// Makes sure WindowTreeClient doesn't get any messages during shutdown.
« no previous file with comments | « services/ui/ws/window_tree.cc ('k') | ui/aura/mus/window_tree_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698