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/public/cpp/config.h" | 7 #include "ash/public/cpp/config.h" |
8 #include "ash/shelf/app_list_button.h" | 8 #include "ash/shelf/app_list_button.h" |
9 #include "ash/shelf/shelf_model.h" | 9 #include "ash/shelf/shelf_model.h" |
10 #include "ash/shelf/shelf_view.h" | 10 #include "ash/shelf/shelf_view.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 // The manager should not show or start the timer for a non-shelf view. | 78 // The manager should not show or start the timer for a non-shelf view. |
79 views::View view; | 79 views::View view; |
80 tooltip_manager_->ShowTooltip(&view); | 80 tooltip_manager_->ShowTooltip(&view); |
81 EXPECT_FALSE(tooltip_manager_->IsVisible()); | 81 EXPECT_FALSE(tooltip_manager_->IsVisible()); |
82 tooltip_manager_->ShowTooltipWithDelay(&view); | 82 tooltip_manager_->ShowTooltipWithDelay(&view); |
83 EXPECT_FALSE(IsTimerRunning()); | 83 EXPECT_FALSE(IsTimerRunning()); |
84 | 84 |
85 // The manager should start the timer for a view on the shelf. | 85 // The manager should start the timer for a view on the shelf. |
86 ShelfModel* model = shelf_view_->model(); | 86 ShelfModel* model = shelf_view_->model(); |
87 ShelfItem item; | 87 ShelfItem item; |
| 88 item.id = ShelfID("foo"); |
88 item.type = TYPE_PINNED_APP; | 89 item.type = TYPE_PINNED_APP; |
89 const int index = model->Add(item); | 90 const int index = model->Add(item); |
90 // Note: There's no easy way to correlate shelf a model index/id to its view. | 91 // Note: There's no easy way to correlate shelf a model index/id to its view. |
91 tooltip_manager_->ShowTooltipWithDelay( | 92 tooltip_manager_->ShowTooltipWithDelay( |
92 shelf_view_->child_at(shelf_view_->child_count() - 1)); | 93 shelf_view_->child_at(shelf_view_->child_count() - 1)); |
93 EXPECT_TRUE(IsTimerRunning()); | 94 EXPECT_TRUE(IsTimerRunning()); |
94 | 95 |
95 // Removing the view won't stop the timer, but the tooltip shouldn't be shown. | 96 // Removing the view won't stop the timer, but the tooltip shouldn't be shown. |
96 model->RemoveItemAt(index); | 97 model->RemoveItemAt(index); |
97 EXPECT_TRUE(IsTimerRunning()); | 98 EXPECT_TRUE(IsTimerRunning()); |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
234 | 235 |
235 // Should not hide for key events. | 236 // Should not hide for key events. |
236 tooltip_manager_->ShowTooltip(shelf_view_->GetAppListButton()); | 237 tooltip_manager_->ShowTooltip(shelf_view_->GetAppListButton()); |
237 ASSERT_TRUE(tooltip_manager_->IsVisible()); | 238 ASSERT_TRUE(tooltip_manager_->IsVisible()); |
238 generator.PressKey(ui::VKEY_A, ui::EF_NONE); | 239 generator.PressKey(ui::VKEY_A, ui::EF_NONE); |
239 EXPECT_TRUE(tooltip_manager_->IsVisible()); | 240 EXPECT_TRUE(tooltip_manager_->IsVisible()); |
240 } | 241 } |
241 | 242 |
242 } // namespace test | 243 } // namespace test |
243 } // namespace ash | 244 } // namespace ash |
OLD | NEW |