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
parent d9be9b6e
......@@ -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;
}
......
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment