OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_view.h" | 5 #include "ash/shelf/shelf_view.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <memory> | 8 #include <memory> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "ash/root_window_controller.h" | 12 #include "ash/root_window_controller.h" |
13 #include "ash/shelf/app_list_button.h" | 13 #include "ash/shelf/app_list_button.h" |
14 #include "ash/shelf/overflow_bubble.h" | 14 #include "ash/shelf/overflow_bubble.h" |
15 #include "ash/shelf/overflow_bubble_view.h" | 15 #include "ash/shelf/overflow_bubble_view.h" |
16 #include "ash/shelf/shelf.h" | 16 #include "ash/shelf/shelf.h" |
17 #include "ash/shelf/shelf_button.h" | 17 #include "ash/shelf/shelf_button.h" |
18 #include "ash/shelf/shelf_constants.h" | 18 #include "ash/shelf/shelf_constants.h" |
19 #include "ash/shelf/shelf_icon_observer.h" | 19 #include "ash/shelf/shelf_icon_observer.h" |
20 #include "ash/shelf/shelf_item_delegate_manager.h" | 20 #include "ash/shelf/shelf_item_delegate_manager.h" |
21 #include "ash/shelf/shelf_layout_manager.h" | |
22 #include "ash/shelf/shelf_model.h" | 21 #include "ash/shelf/shelf_model.h" |
23 #include "ash/shelf/shelf_tooltip_manager.h" | 22 #include "ash/shelf/shelf_tooltip_manager.h" |
24 #include "ash/shelf/shelf_widget.h" | 23 #include "ash/shelf/shelf_widget.h" |
25 #include "ash/shell.h" | 24 #include "ash/shell.h" |
26 #include "ash/shell_window_ids.h" | 25 #include "ash/shell_window_ids.h" |
27 #include "ash/test/ash_test_base.h" | 26 #include "ash/test/ash_test_base.h" |
28 #include "ash/test/overflow_bubble_view_test_api.h" | 27 #include "ash/test/overflow_bubble_view_test_api.h" |
29 #include "ash/test/shelf_test_api.h" | 28 #include "ash/test/shelf_test_api.h" |
30 #include "ash/test/shelf_view_test_api.h" | 29 #include "ash/test/shelf_view_test_api.h" |
31 #include "ash/test/shell_test_api.h" | 30 #include "ash/test/shell_test_api.h" |
(...skipping 1319 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1351 model_->Set(index, item); | 1350 model_->Set(index, item); |
1352 ASSERT_EQ(ShelfButton::STATE_ACTIVE, button->state()); | 1351 ASSERT_EQ(ShelfButton::STATE_ACTIVE, button->state()); |
1353 item.status = STATUS_ATTENTION; | 1352 item.status = STATUS_ATTENTION; |
1354 model_->Set(index, item); | 1353 model_->Set(index, item); |
1355 ASSERT_EQ(ShelfButton::STATE_ATTENTION, button->state()); | 1354 ASSERT_EQ(ShelfButton::STATE_ATTENTION, button->state()); |
1356 } | 1355 } |
1357 | 1356 |
1358 // Confirm that shelf item bounds are correctly updated on shelf changes. | 1357 // Confirm that shelf item bounds are correctly updated on shelf changes. |
1359 TEST_F(ShelfViewTest, ShelfItemBoundsCheck) { | 1358 TEST_F(ShelfViewTest, ShelfItemBoundsCheck) { |
1360 VerifyShelfItemBoundsAreValid(); | 1359 VerifyShelfItemBoundsAreValid(); |
1361 shelf_view_->shelf()->shelf_layout_manager()->SetAutoHideBehavior( | 1360 shelf_view_->shelf()->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
1362 SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | |
1363 test_api_->RunMessageLoopUntilAnimationsDone(); | 1361 test_api_->RunMessageLoopUntilAnimationsDone(); |
1364 VerifyShelfItemBoundsAreValid(); | 1362 VerifyShelfItemBoundsAreValid(); |
1365 shelf_view_->shelf()->shelf_layout_manager()->SetAutoHideBehavior( | 1363 shelf_view_->shelf()->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
1366 SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | |
1367 test_api_->RunMessageLoopUntilAnimationsDone(); | 1364 test_api_->RunMessageLoopUntilAnimationsDone(); |
1368 VerifyShelfItemBoundsAreValid(); | 1365 VerifyShelfItemBoundsAreValid(); |
1369 } | 1366 } |
1370 | 1367 |
1371 TEST_F(ShelfViewTest, ShelfTooltipTest) { | 1368 TEST_F(ShelfViewTest, ShelfTooltipTest) { |
1372 ASSERT_EQ(test_api_->GetLastVisibleIndex() + 1, test_api_->GetButtonCount()); | 1369 ASSERT_EQ(test_api_->GetLastVisibleIndex() + 1, test_api_->GetButtonCount()); |
1373 | 1370 |
1374 // Prepare some items to the shelf. | 1371 // Prepare some items to the shelf. |
1375 ShelfID app_button_id = AddAppShortcut(); | 1372 ShelfID app_button_id = AddAppShortcut(); |
1376 ShelfID platform_button_id = AddPlatformApp(); | 1373 ShelfID platform_button_id = AddPlatformApp(); |
(...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1985 test_api_->RunMessageLoopUntilAnimationsDone(); | 1982 test_api_->RunMessageLoopUntilAnimationsDone(); |
1986 CheckAllItemsAreInBounds(); | 1983 CheckAllItemsAreInBounds(); |
1987 } | 1984 } |
1988 | 1985 |
1989 INSTANTIATE_TEST_CASE_P(LtrRtl, ShelfViewTextDirectionTest, testing::Bool()); | 1986 INSTANTIATE_TEST_CASE_P(LtrRtl, ShelfViewTextDirectionTest, testing::Bool()); |
1990 INSTANTIATE_TEST_CASE_P(VisibleBounds, ShelfViewVisibleBoundsTest, | 1987 INSTANTIATE_TEST_CASE_P(VisibleBounds, ShelfViewVisibleBoundsTest, |
1991 testing::Bool()); | 1988 testing::Bool()); |
1992 | 1989 |
1993 } // namespace test | 1990 } // namespace test |
1994 } // namespace ash | 1991 } // namespace ash |
OLD | NEW |