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

Unified Diff: ash/common/shelf/shelf_tooltip_manager_unittest.cc

Issue 2383833003: Show tooltips in SHELF_AUTO_HIDE ShelfVisibilityState. (Closed)
Patch Set: Fix auto-hide shown and hidden behavior; fix tests. Created 4 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/common/shelf/shelf_tooltip_manager.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/shelf/shelf_tooltip_manager_unittest.cc
diff --git a/ash/common/shelf/shelf_tooltip_manager_unittest.cc b/ash/common/shelf/shelf_tooltip_manager_unittest.cc
index 902c83bb88fc7ba72c6b48b55767d53ace4d0b94..33c8edfcdce9426b4fdf5dda71416eaa43300b10 100644
--- a/ash/common/shelf/shelf_tooltip_manager_unittest.cc
+++ b/ash/common/shelf/shelf_tooltip_manager_unittest.cc
@@ -123,14 +123,16 @@ TEST_F(ShelfTooltipManagerTest, HideWhenShelfIsHidden) {
EXPECT_FALSE(IsTimerRunning());
}
-TEST_F(ShelfTooltipManagerTest, HideWhenShelfIsAutoHide) {
- // Create a visible window so auto-hide behavior is enforced.
+TEST_F(ShelfTooltipManagerTest, HideWhenShelfIsAutoHideHidden) {
+ // Create a visible window so auto-hide behavior can actually hide the shelf.
std::unique_ptr<views::Widget> widget = CreateTestWidget();
tooltip_manager_->ShowTooltip(shelf_view_->GetAppListButton());
ASSERT_TRUE(tooltip_manager_->IsVisible());
GetPrimaryShelf()->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS);
GetPrimaryShelf()->UpdateAutoHideState();
+ ASSERT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS,
+ GetPrimaryShelf()->auto_hide_behavior());
ASSERT_EQ(SHELF_AUTO_HIDE_HIDDEN, GetPrimaryShelf()->GetAutoHideState());
// Tooltip visibility change for auto hide may take time.
@@ -145,6 +147,21 @@ TEST_F(ShelfTooltipManagerTest, HideWhenShelfIsAutoHide) {
// ShowTooltipWithDelay doesn't even run the timer for the hidden shelf.
tooltip_manager_->ShowTooltipWithDelay(shelf_view_->GetAppListButton());
EXPECT_FALSE(IsTimerRunning());
+
+ // Close the window to show the auto-hide shelf; tooltips should now show.
+ widget.reset();
+ GetPrimaryShelf()->UpdateAutoHideState();
+ ASSERT_EQ(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS,
+ GetPrimaryShelf()->auto_hide_behavior());
+ ASSERT_EQ(SHELF_AUTO_HIDE_SHOWN, GetPrimaryShelf()->GetAutoHideState());
+
+ // The tooltip should show for an auto-hide-shown shelf.
+ tooltip_manager_->ShowTooltip(shelf_view_->GetAppListButton());
+ EXPECT_TRUE(tooltip_manager_->IsVisible());
+
+ // ShowTooltipWithDelay should run the timer for an auto-hide-shown shelf.
+ tooltip_manager_->ShowTooltipWithDelay(shelf_view_->GetAppListButton());
+ EXPECT_TRUE(IsTimerRunning());
}
TEST_F(ShelfTooltipManagerTest, HideForEvents) {
« no previous file with comments | « ash/common/shelf/shelf_tooltip_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698