| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ash/shelf/shelf_tooltip_manager.h" | 5 #include "ash/shelf/shelf_tooltip_manager.h" |
| 6 | 6 |
| 7 #include "ash/common/shelf/shelf_item_delegate_manager.h" | 7 #include "ash/common/shelf/shelf_item_delegate_manager.h" |
| 8 #include "ash/common/shelf/shelf_model.h" | 8 #include "ash/common/shelf/shelf_model.h" |
| 9 #include "ash/shelf/app_list_button.h" | 9 #include "ash/shelf/app_list_button.h" |
| 10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 tooltip_manager_->ShowTooltip(shelf_->GetAppListButton()); | 53 tooltip_manager_->ShowTooltip(shelf_->GetAppListButton()); |
| 54 EXPECT_TRUE(tooltip_manager_->IsVisible()); | 54 EXPECT_TRUE(tooltip_manager_->IsVisible()); |
| 55 EXPECT_FALSE(IsTimerRunning()); | 55 EXPECT_FALSE(IsTimerRunning()); |
| 56 } | 56 } |
| 57 | 57 |
| 58 TEST_F(ShelfTooltipManagerTest, ShowTooltipWithDelay) { | 58 TEST_F(ShelfTooltipManagerTest, ShowTooltipWithDelay) { |
| 59 // ShowTooltipWithDelay should start the timer instead of showing immediately. | 59 // ShowTooltipWithDelay should start the timer instead of showing immediately. |
| 60 tooltip_manager_->ShowTooltipWithDelay(shelf_->GetAppListButton()); | 60 tooltip_manager_->ShowTooltipWithDelay(shelf_->GetAppListButton()); |
| 61 EXPECT_FALSE(tooltip_manager_->IsVisible()); | 61 EXPECT_FALSE(tooltip_manager_->IsVisible()); |
| 62 EXPECT_TRUE(IsTimerRunning()); | 62 EXPECT_TRUE(IsTimerRunning()); |
| 63 RunAllPendingInMessageLoop(); | 63 // TODO: Test that the delayed tooltip is shown, without flaky failures. |
| 64 #if !defined(OS_WIN) | |
| 65 // This check fails on Windows. | |
| 66 EXPECT_TRUE(tooltip_manager_->IsVisible()); | |
| 67 #endif // !OS_WIN | |
| 68 EXPECT_FALSE(IsTimerRunning()); | |
| 69 } | 64 } |
| 70 | 65 |
| 71 TEST_F(ShelfTooltipManagerTest, DoNotShowForInvalidView) { | 66 TEST_F(ShelfTooltipManagerTest, DoNotShowForInvalidView) { |
| 72 // The manager should not show or start the timer for a null view. | 67 // The manager should not show or start the timer for a null view. |
| 73 tooltip_manager_->ShowTooltip(nullptr); | 68 tooltip_manager_->ShowTooltip(nullptr); |
| 74 EXPECT_FALSE(tooltip_manager_->IsVisible()); | 69 EXPECT_FALSE(tooltip_manager_->IsVisible()); |
| 75 tooltip_manager_->ShowTooltipWithDelay(nullptr); | 70 tooltip_manager_->ShowTooltipWithDelay(nullptr); |
| 76 EXPECT_FALSE(IsTimerRunning()); | 71 EXPECT_FALSE(IsTimerRunning()); |
| 77 | 72 |
| 78 // The manager should not show or start the timer for a non-shelf view. | 73 // The manager should not show or start the timer for a non-shelf view. |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 226 | 221 |
| 227 // Should not hide for key events. | 222 // Should not hide for key events. |
| 228 tooltip_manager_->ShowTooltip(shelf_->GetAppListButton()); | 223 tooltip_manager_->ShowTooltip(shelf_->GetAppListButton()); |
| 229 ASSERT_TRUE(tooltip_manager_->IsVisible()); | 224 ASSERT_TRUE(tooltip_manager_->IsVisible()); |
| 230 generator.PressKey(ui::VKEY_A, ui::EF_NONE); | 225 generator.PressKey(ui::VKEY_A, ui::EF_NONE); |
| 231 EXPECT_TRUE(tooltip_manager_->IsVisible()); | 226 EXPECT_TRUE(tooltip_manager_->IsVisible()); |
| 232 } | 227 } |
| 233 | 228 |
| 234 } // namespace test | 229 } // namespace test |
| 235 } // namespace ash | 230 } // namespace ash |
| OLD | NEW |