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

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

Issue 2071553002: Initial support of large mouse cursor on Exosphere (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: for comment #13 Created 4 years, 6 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
« ui/wm/core/cursor_manager.cc ('K') | « 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 c55ebe0a1c879fe03ea59a79f73b743f1ae81e49..8575dc3e20b50728d4750423145b9fb1463978b1 100644
--- a/ui/wm/core/cursor_manager_unittest.cc
+++ b/ui/wm/core/cursor_manager_unittest.cc
@@ -56,20 +56,33 @@ class TestingCursorClientObserver : public aura::client::CursorClientObserver {
public:
TestingCursorClientObserver()
: cursor_visibility_(false),
- did_visibility_change_(false) {}
- void reset() { cursor_visibility_ = did_visibility_change_ = false; }
+ did_visibility_change_(false),
+ cursor_set_(ui::CURSOR_SET_NORMAL),
+ did_cursor_set_change_(false) {}
+ void reset() {
+ cursor_visibility_ = did_visibility_change_ = false;
+ did_cursor_set_change_ = false;
sky 2016/06/20 15:27:51 Shouldn't you reset cursor_set_ here too?
yoshiki 2016/06/28 02:12:42 Done.
+ }
bool is_cursor_visible() const { return cursor_visibility_; }
bool did_visibility_change() const { return did_visibility_change_; }
+ ui::CursorSetType cursor_set() const { return cursor_set_; }
+ bool did_cursor_set_change() const { return did_cursor_set_change_; }
// Overridden from aura::client::CursorClientObserver:
void OnCursorVisibilityChanged(bool is_visible) override {
cursor_visibility_ = is_visible;
did_visibility_change_ = true;
}
+ void OnCursorSetChanged(ui::CursorSetType cursor_set) override {
+ cursor_set_ = cursor_set;
+ did_cursor_set_change_ = true;
+ }
private:
bool cursor_visibility_;
bool did_visibility_change_;
+ ui::CursorSetType cursor_set_;
+ bool did_cursor_set_change_;
DISALLOW_COPY_AND_ASSIGN(TestingCursorClientObserver);
};
@@ -175,16 +188,23 @@ TEST_F(CursorManagerTest, EnableDisableMouseEvents) {
}
TEST_F(CursorManagerTest, SetCursorSet) {
+ TestingCursorClientObserver observer;
+ cursor_manager_.AddObserver(&observer);
+
EXPECT_EQ(ui::CURSOR_SET_NORMAL, cursor_manager_.GetCursorSet());
+ EXPECT_EQ(ui::CURSOR_SET_NORMAL, observer.cursor_set());
cursor_manager_.SetCursorSet(ui::CURSOR_SET_NORMAL);
EXPECT_EQ(ui::CURSOR_SET_NORMAL, cursor_manager_.GetCursorSet());
+ EXPECT_EQ(ui::CURSOR_SET_NORMAL, observer.cursor_set());
cursor_manager_.SetCursorSet(ui::CURSOR_SET_LARGE);
EXPECT_EQ(ui::CURSOR_SET_LARGE, cursor_manager_.GetCursorSet());
+ EXPECT_EQ(ui::CURSOR_SET_LARGE, observer.cursor_set());
cursor_manager_.SetCursorSet(ui::CURSOR_SET_NORMAL);
EXPECT_EQ(ui::CURSOR_SET_NORMAL, cursor_manager_.GetCursorSet());
+ EXPECT_EQ(ui::CURSOR_SET_NORMAL, observer.cursor_set());
}
TEST_F(CursorManagerTest, IsMouseEventsEnabled) {
@@ -287,6 +307,10 @@ TEST_F(CursorManagerTest, TestCursorClientObserver) {
EXPECT_FALSE(observer_b.did_visibility_change());
EXPECT_FALSE(observer_a.is_cursor_visible());
EXPECT_FALSE(observer_b.is_cursor_visible());
+ EXPECT_FALSE(observer_a.did_cursor_set_change());
+ EXPECT_FALSE(observer_b.did_cursor_set_change());
+ EXPECT_EQ(ui::CURSOR_SET_NORMAL, observer_a.cursor_set());
+ EXPECT_EQ(ui::CURSOR_SET_NORMAL, observer_b.cursor_set());
// Hide the cursor using HideCursor().
cursor_manager_.HideCursor();
@@ -295,6 +319,13 @@ TEST_F(CursorManagerTest, TestCursorClientObserver) {
EXPECT_FALSE(observer_a.is_cursor_visible());
EXPECT_FALSE(observer_b.is_cursor_visible());
+ // Set the cursor set.
+ cursor_manager_.SetCursorSet(ui::CURSOR_SET_LARGE);
+ EXPECT_TRUE(observer_a.did_cursor_set_change());
+ EXPECT_TRUE(observer_b.did_cursor_set_change());
+ EXPECT_EQ(ui::CURSOR_SET_LARGE, observer_a.cursor_set());
+ EXPECT_EQ(ui::CURSOR_SET_LARGE, observer_b.cursor_set());
+
// Show the cursor using ShowCursor().
observer_a.reset();
observer_b.reset();
@@ -316,6 +347,13 @@ TEST_F(CursorManagerTest, TestCursorClientObserver) {
EXPECT_FALSE(observer_b.did_visibility_change());
EXPECT_FALSE(observer_a.is_cursor_visible());
+ // Set back the cursor set to normal.
+ cursor_manager_.SetCursorSet(ui::CURSOR_SET_NORMAL);
+ EXPECT_TRUE(observer_a.did_cursor_set_change());
+ EXPECT_FALSE(observer_b.did_cursor_set_change());
+ EXPECT_EQ(ui::CURSOR_SET_NORMAL, observer_a.cursor_set());
+ EXPECT_EQ(ui::CURSOR_SET_LARGE, observer_b.cursor_set());
+
// Show the cursor using ShowCursor().
observer_a.reset();
observer_b.reset();
« ui/wm/core/cursor_manager.cc ('K') | « ui/wm/core/cursor_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698