summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormazda@chromium.org <mazda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-16 18:33:28 +0000
committermazda@chromium.org <mazda@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-01-16 18:33:28 +0000
commit4bd875313272c66c696d3a826d74eee8d1e13152 (patch)
tree6f28d83528c4e11aac33211e0b9341db6811f6fb
parentf74b9dbf30ca99692f38b5fc9658b19d0a36a044 (diff)
downloadchromium_src-4bd875313272c66c696d3a826d74eee8d1e13152.zip
chromium_src-4bd875313272c66c696d3a826d74eee8d1e13152.tar.gz
chromium_src-4bd875313272c66c696d3a826d74eee8d1e13152.tar.bz2
Merge 176569
> Fix the issue that causes the cursor disappears when CursorManager::DisableMouseEvents is called multiple times. > > BUG=169404 > TEST=CursorManagerTest.MultipleDisableMouseEvents > > > Review URL: https://chromiumcodereview.appspot.com/11855004 TBR=mazda@chromium.org Review URL: https://codereview.chromium.org/11968019 git-svn-id: svn://svn.chromium.org/chrome/branches/1364/src@177179 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ash/wm/cursor_manager.cc3
-rw-r--r--ash/wm/cursor_manager_unittest.cc25
2 files changed, 27 insertions, 1 deletions
diff --git a/ash/wm/cursor_manager.cc b/ash/wm/cursor_manager.cc
index f0475e0..a126ae3 100644
--- a/ash/wm/cursor_manager.cc
+++ b/ash/wm/cursor_manager.cc
@@ -70,6 +70,8 @@ class CursorState {
bool mouse_events_enabled() const { return mouse_events_enabled_; }
void SetMouseEventsEnabled(bool enabled) {
+ if (mouse_events_enabled_ == enabled)
+ return;
mouse_events_enabled_ = enabled;
// Restores the visibility when mouse events are enabled.
@@ -81,7 +83,6 @@ class CursorState {
}
}
-
private:
gfx::NativeCursor cursor_;
bool visible_;
diff --git a/ash/wm/cursor_manager_unittest.cc b/ash/wm/cursor_manager_unittest.cc
index e31f3e0..a290512 100644
--- a/ash/wm/cursor_manager_unittest.cc
+++ b/ash/wm/cursor_manager_unittest.cc
@@ -266,6 +266,31 @@ TEST_F(CursorManagerTest, ShowAndEnable) {
EXPECT_FALSE(cursor_manager->IsMouseEventsEnabled());
}
+// Verifies that calling DisableMouseEvents multiple times in a row makes no
+// difference compared with calling it once.
+// This is a regression test for http://crbug.com/169404.
+TEST_F(CursorManagerTest, MultipleDisableMouseEvents) {
+ CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager();
+ cursor_manager->DisableMouseEvents();
+ cursor_manager->DisableMouseEvents();
+ cursor_manager->EnableMouseEvents();
+ cursor_manager->LockCursor();
+ cursor_manager->UnlockCursor();
+ EXPECT_TRUE(cursor_manager->IsCursorVisible());
+}
+
+// Verifies that calling EnableMouseEvents multiple times in a row makes no
+// difference compared with calling it once.
+TEST_F(CursorManagerTest, MultipleEnableMouseEvents) {
+ CursorManager* cursor_manager = Shell::GetInstance()->cursor_manager();
+ cursor_manager->DisableMouseEvents();
+ cursor_manager->EnableMouseEvents();
+ cursor_manager->EnableMouseEvents();
+ cursor_manager->LockCursor();
+ cursor_manager->UnlockCursor();
+ EXPECT_TRUE(cursor_manager->IsCursorVisible());
+}
+
#if defined(OS_WIN)
// Temporarily disabled for windows. See crbug.com/112222.
#define MAYBE_DisabledMouseEventsLocation DISABLED_DisabledMouseEventsLocation