summaryrefslogtreecommitdiffstats
path: root/ash/tooltips
diff options
context:
space:
mode:
authorvarunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-24 02:02:28 +0000
committervarunjain@chromium.org <varunjain@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-04-24 02:02:28 +0000
commit3341c653947c5343c74b5f4b3987dffdd11b1532 (patch)
tree2a580316dd110d8ca5d7d51a26d9829c9570b936 /ash/tooltips
parentd9be9b6e88709ec1520b5b8cd5de55946b946147 (diff)
downloadchromium_src-3341c653947c5343c74b5f4b3987dffdd11b1532.zip
chromium_src-3341c653947c5343c74b5f4b3987dffdd11b1532.tar.gz
chromium_src-3341c653947c5343c74b5f4b3987dffdd11b1532.tar.bz2
aura: Do not show tooltips if mouse cursor is hidden.
BUG=123961 TEST=added new test Review URL: http://codereview.chromium.org/10151001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@133601 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ash/tooltips')
-rw-r--r--ash/tooltips/tooltip_controller.cc3
-rw-r--r--ash/tooltips/tooltip_controller_unittest.cc28
2 files changed, 30 insertions, 1 deletions
diff --git a/ash/tooltips/tooltip_controller.cc b/ash/tooltips/tooltip_controller.cc
index d3efc1f..ba69352 100644
--- a/ash/tooltips/tooltip_controller.cc
+++ b/ash/tooltips/tooltip_controller.cc
@@ -372,7 +372,8 @@ void TooltipController::TooltipTimerFired() {
}
void TooltipController::UpdateIfRequired() {
- if (!tooltips_enabled_ || mouse_pressed_ || IsDragDropInProgress()) {
+ if (!tooltips_enabled_ || mouse_pressed_ || IsDragDropInProgress() ||
+ !Shell::GetRootWindow()->cursor_shown()) {
tooltip_->Hide();
return;
}
diff --git a/ash/tooltips/tooltip_controller_unittest.cc b/ash/tooltips/tooltip_controller_unittest.cc
index ff060dc..93b7208 100644
--- a/ash/tooltips/tooltip_controller_unittest.cc
+++ b/ash/tooltips/tooltip_controller_unittest.cc
@@ -225,6 +225,34 @@ TEST_F(TooltipControllerTest, EnableOrDisableTooltips) {
EXPECT_TRUE(IsTooltipVisible());
}
+TEST_F(TooltipControllerTest, HideTooltipWhenCursorHidden) {
+ scoped_ptr<views::Widget> widget(CreateNewWidget());
+ TooltipTestView* view = new TooltipTestView;
+ AddViewToWidgetAndResize(widget.get(), view);
+ view->set_tooltip_text(ASCIIToUTF16("Tooltip Text"));
+ EXPECT_EQ(ASCIIToUTF16(""), GetTooltipText());
+ EXPECT_EQ(NULL, GetTooltipWindow());
+
+ aura::test::EventGenerator generator(Shell::GetRootWindow());
+ generator.MoveMouseRelativeTo(widget->GetNativeView(),
+ view->bounds().CenterPoint());
+ string16 expected_tooltip = ASCIIToUTF16("Tooltip Text");
+
+ // Fire tooltip timer so tooltip becomes visible.
+ FireTooltipTimer();
+ EXPECT_TRUE(IsTooltipVisible());
+
+ // Hide the cursor and check again.
+ Shell::GetRootWindow()->ShowCursor(false);
+ FireTooltipTimer();
+ EXPECT_FALSE(IsTooltipVisible());
+
+ // Show the cursor and re-check.
+ Shell::GetRootWindow()->ShowCursor(true);
+ FireTooltipTimer();
+ EXPECT_TRUE(IsTooltipVisible());
+}
+
TEST_F(TooltipControllerTest, TrimTooltipToFitTests) {
string16 tooltip;
int max_width, line_count, expect_lines;