Chromium Code Reviews| 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 |