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

Unified Diff: ash/tooltips/tooltip_controller_unittest.cc

Issue 10151001: aura: Do not show tooltips if mouse cursor is hidden. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: patch Created 8 years, 8 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
« no previous file with comments | « ash/tooltips/tooltip_controller.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/tooltips/tooltip_controller_unittest.cc
diff --git a/ash/tooltips/tooltip_controller_unittest.cc b/ash/tooltips/tooltip_controller_unittest.cc
index ff060dc657a951483b9c22275cb4468531d3cdda..93b72084c747e7cd62d5fdf3d900796f9aa9cbcb 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;
« no previous file with comments | « ash/tooltips/tooltip_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698