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

Unified Diff: ash/launcher/launcher_tooltip_manager_unittest.cc

Issue 23536012: [ash] Hide tooltip when mouse button is pressed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 3 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/launcher/launcher_tooltip_manager.cc ('k') | ash/launcher/launcher_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/launcher/launcher_tooltip_manager_unittest.cc
diff --git a/ash/launcher/launcher_tooltip_manager_unittest.cc b/ash/launcher/launcher_tooltip_manager_unittest.cc
index 5df58a6de330c04c806c1f2deccb5f4d97990c52..c0dec3e47a05971f6b7a57d25ce5fea507c51f53 100644
--- a/ash/launcher/launcher_tooltip_manager_unittest.cc
+++ b/ash/launcher/launcher_tooltip_manager_unittest.cc
@@ -217,7 +217,7 @@ TEST_F(LauncherTooltipManagerTest, ShouldHideForEvents) {
EXPECT_FALSE(TooltipIsVisible());
}
-TEST_F(LauncherTooltipManagerTest, HideForMouseEvent) {
+TEST_F(LauncherTooltipManagerTest, HideForMouseMoveEvent) {
ShowImmediately();
ASSERT_TRUE(TooltipIsVisible());
@@ -245,5 +245,39 @@ TEST_F(LauncherTooltipManagerTest, HideForMouseEvent) {
EXPECT_FALSE(TooltipIsVisible());
}
Mr4D (OOO till 08-26) 2013/09/04 03:21:47 Please add a comment for what the test does.
simonhong_ 2013/09/04 04:18:17 Done.
+TEST_F(LauncherTooltipManagerTest, HideForMouseClickEvent) {
+ ShowImmediately();
+ ASSERT_TRUE(TooltipIsVisible());
+
+ aura::RootWindow* root_window = Shell::GetInstance()->GetPrimaryRootWindow();
+ ui::EventHandler* event_handler = GetEventHandler();
+
+ gfx::Rect tooltip_rect = GetTooltipWidget()->GetNativeWindow()->bounds();
+ ASSERT_FALSE(tooltip_rect.IsEmpty());
+
+ // Should hide if the mouse is pressed in the tooltip.
+ ui::MouseEvent mouse_event(ui::ET_MOUSE_PRESSED, tooltip_rect.CenterPoint(),
+ tooltip_rect.CenterPoint(), ui::EF_NONE);
+
+ SetEventTarget(root_window, &mouse_event);
+ event_handler->OnMouseEvent(&mouse_event);
+ EXPECT_FALSE(mouse_event.handled());
+ RunAllPendingInMessageLoop();
+ EXPECT_FALSE(TooltipIsVisible());
+
+ // Should hide if the mouse is pressed outside of the tooltip.
+ ShowImmediately();
+ ASSERT_TRUE(TooltipIsVisible());
+
+ ui::LocatedEvent::TestApi test_api(&mouse_event);
+ test_api.set_location(tooltip_rect.origin() + gfx::Vector2d(-1, -1));
+
+ SetEventTarget(root_window, &mouse_event);
+ event_handler->OnMouseEvent(&mouse_event);
+ EXPECT_FALSE(mouse_event.handled());
+ RunAllPendingInMessageLoop();
+ EXPECT_FALSE(TooltipIsVisible());
+}
+
} // namespace test
} // namespace ash
« no previous file with comments | « ash/launcher/launcher_tooltip_manager.cc ('k') | ash/launcher/launcher_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698