Chromium Code Reviews| 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" | 21 #include "ash/shelf/shelf_layout_manager.h" |
|
msw
2016/06/01 00:53:24
nit: remove
James Cook
2016/06/01 15:53:06
Done.
| |
| 22 #include "ash/shelf/shelf_model.h" | 22 #include "ash/shelf/shelf_model.h" |
| 23 #include "ash/shelf/shelf_tooltip_manager.h" | 23 #include "ash/shelf/shelf_tooltip_manager.h" |
| 24 #include "ash/shelf/shelf_widget.h" | 24 #include "ash/shelf/shelf_widget.h" |
| 25 #include "ash/shell.h" | 25 #include "ash/shell.h" |
| 26 #include "ash/shell_window_ids.h" | 26 #include "ash/shell_window_ids.h" |
| 27 #include "ash/test/ash_test_base.h" | 27 #include "ash/test/ash_test_base.h" |
| 28 #include "ash/test/overflow_bubble_view_test_api.h" | 28 #include "ash/test/overflow_bubble_view_test_api.h" |
| 29 #include "ash/test/shelf_test_api.h" | 29 #include "ash/test/shelf_test_api.h" |
| 30 #include "ash/test/shelf_view_test_api.h" | 30 #include "ash/test/shelf_view_test_api.h" |
| 31 #include "ash/test/shell_test_api.h" | 31 #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); | 1351 model_->Set(index, item); |
| 1352 ASSERT_EQ(ShelfButton::STATE_ACTIVE, button->state()); | 1352 ASSERT_EQ(ShelfButton::STATE_ACTIVE, button->state()); |
| 1353 item.status = STATUS_ATTENTION; | 1353 item.status = STATUS_ATTENTION; |
| 1354 model_->Set(index, item); | 1354 model_->Set(index, item); |
| 1355 ASSERT_EQ(ShelfButton::STATE_ATTENTION, button->state()); | 1355 ASSERT_EQ(ShelfButton::STATE_ATTENTION, button->state()); |
| 1356 } | 1356 } |
| 1357 | 1357 |
| 1358 // Confirm that shelf item bounds are correctly updated on shelf changes. | 1358 // Confirm that shelf item bounds are correctly updated on shelf changes. |
| 1359 TEST_F(ShelfViewTest, ShelfItemBoundsCheck) { | 1359 TEST_F(ShelfViewTest, ShelfItemBoundsCheck) { |
| 1360 VerifyShelfItemBoundsAreValid(); | 1360 VerifyShelfItemBoundsAreValid(); |
| 1361 shelf_view_->shelf()->shelf_layout_manager()->SetAutoHideBehavior( | 1361 shelf_view_->shelf()->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
| 1362 SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | |
| 1363 test_api_->RunMessageLoopUntilAnimationsDone(); | 1362 test_api_->RunMessageLoopUntilAnimationsDone(); |
| 1364 VerifyShelfItemBoundsAreValid(); | 1363 VerifyShelfItemBoundsAreValid(); |
| 1365 shelf_view_->shelf()->shelf_layout_manager()->SetAutoHideBehavior( | 1364 shelf_view_->shelf()->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
| 1366 SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | |
| 1367 test_api_->RunMessageLoopUntilAnimationsDone(); | 1365 test_api_->RunMessageLoopUntilAnimationsDone(); |
| 1368 VerifyShelfItemBoundsAreValid(); | 1366 VerifyShelfItemBoundsAreValid(); |
| 1369 } | 1367 } |
| 1370 | 1368 |
| 1371 TEST_F(ShelfViewTest, ShelfTooltipTest) { | 1369 TEST_F(ShelfViewTest, ShelfTooltipTest) { |
| 1372 ASSERT_EQ(test_api_->GetLastVisibleIndex() + 1, test_api_->GetButtonCount()); | 1370 ASSERT_EQ(test_api_->GetLastVisibleIndex() + 1, test_api_->GetButtonCount()); |
| 1373 | 1371 |
| 1374 // Prepare some items to the shelf. | 1372 // Prepare some items to the shelf. |
| 1375 ShelfID app_button_id = AddAppShortcut(); | 1373 ShelfID app_button_id = AddAppShortcut(); |
| 1376 ShelfID platform_button_id = AddPlatformApp(); | 1374 ShelfID platform_button_id = AddPlatformApp(); |
| (...skipping 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1985 test_api_->RunMessageLoopUntilAnimationsDone(); | 1983 test_api_->RunMessageLoopUntilAnimationsDone(); |
| 1986 CheckAllItemsAreInBounds(); | 1984 CheckAllItemsAreInBounds(); |
| 1987 } | 1985 } |
| 1988 | 1986 |
| 1989 INSTANTIATE_TEST_CASE_P(LtrRtl, ShelfViewTextDirectionTest, testing::Bool()); | 1987 INSTANTIATE_TEST_CASE_P(LtrRtl, ShelfViewTextDirectionTest, testing::Bool()); |
| 1990 INSTANTIATE_TEST_CASE_P(VisibleBounds, ShelfViewVisibleBoundsTest, | 1988 INSTANTIATE_TEST_CASE_P(VisibleBounds, ShelfViewVisibleBoundsTest, |
| 1991 testing::Bool()); | 1989 testing::Bool()); |
| 1992 | 1990 |
| 1993 } // namespace test | 1991 } // namespace test |
| 1994 } // namespace ash | 1992 } // namespace ash |
| OLD | NEW |