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

Unified Diff: ash/display/cursor_window_controller_unittest.cc

Issue 1137303004: Always update cursor visibility (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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 | « ash/display/cursor_window_controller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/display/cursor_window_controller_unittest.cc
diff --git a/ash/display/cursor_window_controller_unittest.cc b/ash/display/cursor_window_controller_unittest.cc
index 8298604de1dc1802ef91e0c27117e28282128a81..1831f43f45eadde6ec65fb4e81e3b465d347ee34 100644
--- a/ash/display/cursor_window_controller_unittest.cc
+++ b/ash/display/cursor_window_controller_unittest.cc
@@ -25,9 +25,7 @@ class CursorWindowControllerTest : public test::AshTestBase {
// test::AshTestBase:
void SetUp() override {
AshTestBase::SetUp();
- cursor_window_controller_ =
- Shell::GetInstance()->display_controller()->cursor_window_controller();
- cursor_window_controller_->SetCursorCompositingEnabled(true);
+ SetCursorCompositionEnabled(true);
}
int GetCursorType() const { return cursor_window_controller_->cursor_type_; }
@@ -44,6 +42,12 @@ class CursorWindowControllerTest : public test::AshTestBase {
return cursor_window_controller_->display_.id();
}
+ void SetCursorCompositionEnabled(bool enabled) {
+ cursor_window_controller_ =
+ Shell::GetInstance()->display_controller()->cursor_window_controller();
+ cursor_window_controller_->SetCursorCompositingEnabled(enabled);
+ }
+
private:
// Not owned.
CursorWindowController* cursor_window_controller_;
@@ -105,4 +109,39 @@ TEST_F(CursorWindowControllerTest, MoveToDifferentDisplay) {
EXPECT_EQ(50, cursor_bounds.y() + hot_point.y());
}
+// Windows doesn't support compositor based cursor.
+#if !defined(OS_WIN)
+// Make sure that composition cursor inherits the visibility state.
+TEST_F(CursorWindowControllerTest, VisibilityTest) {
+ ASSERT_TRUE(GetCursorWindow());
+ EXPECT_TRUE(GetCursorWindow()->IsVisible());
+ aura::client::CursorClient* client = Shell::GetInstance()->cursor_manager();
+ client->HideCursor();
+ ASSERT_TRUE(GetCursorWindow());
+ EXPECT_FALSE(GetCursorWindow()->IsVisible());
+
+ // Normal cursor should be in the correct state.
+ SetCursorCompositionEnabled(false);
+ ASSERT_FALSE(GetCursorWindow());
+ ASSERT_FALSE(client->IsCursorVisible());
+
+ // Cursor was hidden.
+ SetCursorCompositionEnabled(true);
+ ASSERT_TRUE(GetCursorWindow());
+ EXPECT_FALSE(GetCursorWindow()->IsVisible());
+
+ // Goback to normal cursor and show the cursor.
+ SetCursorCompositionEnabled(false);
+ ASSERT_FALSE(GetCursorWindow());
+ ASSERT_FALSE(client->IsCursorVisible());
+ client->ShowCursor();
+ ASSERT_TRUE(client->IsCursorVisible());
+
+ // Cursor was shown.
+ SetCursorCompositionEnabled(true);
+ ASSERT_TRUE(GetCursorWindow());
+ EXPECT_TRUE(GetCursorWindow()->IsVisible());
+}
+#endif
+
} // namespace ash
« no previous file with comments | « ash/display/cursor_window_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698