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

Unified Diff: ash/tooltips/tooltip_controller_unittest.cc

Issue 2652833002: Remove infinite spin, make tooltip delay consistent (Closed)
Patch Set: Fix nits. Created 3 years, 11 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 | « no previous file | ui/views/corewm/tooltip_controller.h » ('j') | 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 8e9e224a8f8f22b62484df79362b3864ba76f1b5..2ada1999123144ae5e80c5602edc243199418164 100644
--- a/ash/tooltips/tooltip_controller_unittest.cc
+++ b/ash/tooltips/tooltip_controller_unittest.cc
@@ -109,20 +109,21 @@ TEST_F(TooltipControllerTest, HideTooltipWhenCursorHidden) {
view->bounds().CenterPoint());
base::string16 expected_tooltip = base::ASCIIToUTF16("Tooltip Text");
- // Fire tooltip timer so tooltip becomes visible.
- helper_->FireTooltipTimer();
+ // Mouse event triggers tooltip update so it becomes visible.
EXPECT_TRUE(helper_->IsTooltipVisible());
- // Hide the cursor and check again.
+ // Disable mouse event which hides the cursor and check again.
ash::Shell::GetInstance()->cursor_manager()->DisableMouseEvents();
- helper_->FireTooltipTimer();
+ RunAllPendingInMessageLoop();
+ EXPECT_FALSE(ash::Shell::GetInstance()->cursor_manager()->IsCursorVisible());
+ helper_->UpdateIfRequired();
EXPECT_FALSE(helper_->IsTooltipVisible());
- // Show the cursor and re-check.
- RunAllPendingInMessageLoop();
+ // Enable mouse event which shows the cursor and re-check.
ash::Shell::GetInstance()->cursor_manager()->EnableMouseEvents();
RunAllPendingInMessageLoop();
- helper_->FireTooltipTimer();
+ EXPECT_TRUE(ash::Shell::GetInstance()->cursor_manager()->IsCursorVisible());
+ helper_->UpdateIfRequired();
EXPECT_TRUE(helper_->IsTooltipVisible());
}
@@ -150,7 +151,6 @@ TEST_F(TooltipControllerTest, TooltipsOnMultiDisplayShouldNotCrash) {
ui::test::EventGenerator generator(root_windows[1]);
generator.MoveMouseRelativeTo(widget2->GetNativeView(),
view2->bounds().CenterPoint());
- helper_->FireTooltipTimer();
EXPECT_TRUE(helper_->IsTooltipVisible());
// Get rid of secondary display. This destroy's the tooltip's aura window. If
@@ -164,7 +164,6 @@ TEST_F(TooltipControllerTest, TooltipsOnMultiDisplayShouldNotCrash) {
ui::test::EventGenerator generator1(root_windows[0]);
generator1.MoveMouseRelativeTo(widget1->GetNativeView(),
view1->bounds().CenterPoint());
- helper_->FireTooltipTimer();
EXPECT_TRUE(helper_->IsTooltipVisible());
}
« no previous file with comments | « no previous file | ui/views/corewm/tooltip_controller.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698