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

Unified Diff: ui/wm/core/cursor_manager_unittest.cc

Issue 1870743003: Ensure that the cursor visibility state is restored correctly on CursorManager creation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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 | « ui/wm/core/cursor_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/wm/core/cursor_manager_unittest.cc
diff --git a/ui/wm/core/cursor_manager_unittest.cc b/ui/wm/core/cursor_manager_unittest.cc
index 7add106969a4d89cc16984676b1325213741a972..e4f5429309a0c12d7ab3a2f01460931ae73d8bc9 100644
--- a/ui/wm/core/cursor_manager_unittest.cc
+++ b/ui/wm/core/cursor_manager_unittest.cc
@@ -325,3 +325,38 @@ TEST_F(CursorManagerTest, TestCursorClientObserver) {
EXPECT_FALSE(observer_b.did_visibility_change());
EXPECT_TRUE(observer_a.is_cursor_visible());
}
+
+// This test validates that the cursor visiblity state is restored when a
+// CursorManager instance is destroyed and recreated.
+TEST(CursorManagerCreateDestroyTest, VisibilityTest) {
+ // This block ensures that the cursor is hidden when the CursorManager
+ // instance is destroyed.
+ {
+ wm::CursorManager cursor_manager1(
+ scoped_ptr<wm::NativeCursorManager>(new TestingCursorManager));
+ cursor_manager1.ShowCursor();
+ EXPECT_TRUE(cursor_manager1.IsCursorVisible());
+ cursor_manager1.HideCursor();
+ EXPECT_FALSE(cursor_manager1.IsCursorVisible());
+ }
+
+ // This block validates that the cursor is hidden initially. It ensures that
+ // the cursor is visible when the CursorManager instance is destroyed.
+ {
+ wm::CursorManager cursor_manager2(
+ scoped_ptr<wm::NativeCursorManager>(new TestingCursorManager));
+ EXPECT_FALSE(cursor_manager2.IsCursorVisible());
+ cursor_manager2.ShowCursor();
+ EXPECT_TRUE(cursor_manager2.IsCursorVisible());
+ }
+
+ // This block validates that the cursor is visible initially. It then
+ // performs normal cursor visibility operations.
+ {
+ wm::CursorManager cursor_manager3(
+ scoped_ptr<wm::NativeCursorManager>(new TestingCursorManager));
+ EXPECT_TRUE(cursor_manager3.IsCursorVisible());
+ cursor_manager3.HideCursor();
+ EXPECT_FALSE(cursor_manager3.IsCursorVisible());
+ }
+}
« no previous file with comments | « ui/wm/core/cursor_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698