summaryrefslogtreecommitdiffstats
path: root/ash/tooltips
diff options
context:
space:
mode:
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;