| 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> |
| (...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 ~ShelfViewTest() override {} | 302 ~ShelfViewTest() override {} |
| 303 | 303 |
| 304 void SetUp() override { | 304 void SetUp() override { |
| 305 AshTestBase::SetUp(); | 305 AshTestBase::SetUp(); |
| 306 ShellTestApi test_api(Shell::GetInstance()); | 306 ShellTestApi test_api(Shell::GetInstance()); |
| 307 model_ = test_api.shelf_model(); | 307 model_ = test_api.shelf_model(); |
| 308 Shelf* shelf = Shelf::ForPrimaryDisplay(); | 308 Shelf* shelf = Shelf::ForPrimaryDisplay(); |
| 309 shelf_view_ = ShelfTestAPI(shelf).shelf_view(); | 309 shelf_view_ = ShelfTestAPI(shelf).shelf_view(); |
| 310 | 310 |
| 311 // The bounds should be big enough for 4 buttons + overflow chevron. | 311 // The bounds should be big enough for 4 buttons + overflow chevron. |
| 312 shelf_view_->SetBounds(0, 0, 500, kShelfSize); | 312 shelf_view_->SetBounds(0, 0, 500, GetShelfLayoutConstant(SHELF_SIZE)); |
| 313 | 313 |
| 314 test_api_.reset(new ShelfViewTestAPI(shelf_view_)); | 314 test_api_.reset(new ShelfViewTestAPI(shelf_view_)); |
| 315 test_api_->SetAnimationDuration(1); // Speeds up animation for test. | 315 test_api_->SetAnimationDuration(1); // Speeds up animation for test. |
| 316 | 316 |
| 317 ReplaceShelfDelegate(); | 317 ReplaceShelfDelegate(); |
| 318 | 318 |
| 319 item_manager_ = Shell::GetInstance()->shelf_item_delegate_manager(); | 319 item_manager_ = Shell::GetInstance()->shelf_item_delegate_manager(); |
| 320 DCHECK(item_manager_); | 320 DCHECK(item_manager_); |
| 321 | 321 |
| 322 // Add browser shortcut shelf item at index 0 for test. | 322 // Add browser shortcut shelf item at index 0 for test. |
| (...skipping 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1577 AddPlatformAppNoWait(); | 1577 AddPlatformAppNoWait(); |
| 1578 while (!test_api_->IsOverflowButtonVisible()) { | 1578 while (!test_api_->IsOverflowButtonVisible()) { |
| 1579 test_api_->RunMessageLoopUntilAnimationsDone(); | 1579 test_api_->RunMessageLoopUntilAnimationsDone(); |
| 1580 AddPlatformAppNoWait(); | 1580 AddPlatformAppNoWait(); |
| 1581 ++items_added; | 1581 ++items_added; |
| 1582 ASSERT_LT(items_added, 10000); | 1582 ASSERT_LT(items_added, 10000); |
| 1583 } | 1583 } |
| 1584 | 1584 |
| 1585 // Resize shelf view with that animation running and stay overflown. | 1585 // Resize shelf view with that animation running and stay overflown. |
| 1586 gfx::Rect bounds = shelf_view_->bounds(); | 1586 gfx::Rect bounds = shelf_view_->bounds(); |
| 1587 bounds.set_width(bounds.width() - kShelfSize); | 1587 bounds.set_width(bounds.width() - GetShelfLayoutConstant(SHELF_SIZE)); |
| 1588 shelf_view_->SetBoundsRect(bounds); | 1588 shelf_view_->SetBoundsRect(bounds); |
| 1589 ASSERT_TRUE(test_api_->IsOverflowButtonVisible()); | 1589 ASSERT_TRUE(test_api_->IsOverflowButtonVisible()); |
| 1590 | 1590 |
| 1591 // Finish the animation. | 1591 // Finish the animation. |
| 1592 test_api_->RunMessageLoopUntilAnimationsDone(); | 1592 test_api_->RunMessageLoopUntilAnimationsDone(); |
| 1593 | 1593 |
| 1594 // App list button should ends up in its new ideal bounds. | 1594 // App list button should ends up in its new ideal bounds. |
| 1595 const int app_list_button_index = test_api_->GetButtonCount() - 1; | 1595 const int app_list_button_index = test_api_->GetButtonCount() - 1; |
| 1596 const gfx::Rect& app_list_ideal_bounds = | 1596 const gfx::Rect& app_list_ideal_bounds = |
| 1597 test_api_->GetIdealBoundsByIndex(app_list_button_index); | 1597 test_api_->GetIdealBoundsByIndex(app_list_button_index); |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1712 // win8-aura doesn't support multiple display. | 1712 // win8-aura doesn't support multiple display. |
| 1713 if (!SupportsMultipleDisplays()) | 1713 if (!SupportsMultipleDisplays()) |
| 1714 return; | 1714 return; |
| 1715 | 1715 |
| 1716 UpdateDisplay("800x600,800x600"); | 1716 UpdateDisplay("800x600,800x600"); |
| 1717 Shelf* secondary_shelf = Shelf::ForWindow(Shell::GetAllRootWindows()[1]); | 1717 Shelf* secondary_shelf = Shelf::ForWindow(Shell::GetAllRootWindows()[1]); |
| 1718 ShelfView* shelf_view_for_secondary = | 1718 ShelfView* shelf_view_for_secondary = |
| 1719 ShelfTestAPI(secondary_shelf).shelf_view(); | 1719 ShelfTestAPI(secondary_shelf).shelf_view(); |
| 1720 | 1720 |
| 1721 // The bounds should be big enough for 4 buttons + overflow chevron. | 1721 // The bounds should be big enough for 4 buttons + overflow chevron. |
| 1722 shelf_view_for_secondary->SetBounds(0, 0, 500, kShelfSize); | 1722 shelf_view_for_secondary->SetBounds(0, 0, 500, |
| 1723 GetShelfLayoutConstant(SHELF_SIZE)); |
| 1723 | 1724 |
| 1724 ShelfViewTestAPI test_api_for_secondary(shelf_view_for_secondary); | 1725 ShelfViewTestAPI test_api_for_secondary(shelf_view_for_secondary); |
| 1725 // Speeds up animation for test. | 1726 // Speeds up animation for test. |
| 1726 test_api_for_secondary.SetAnimationDuration(1); | 1727 test_api_for_secondary.SetAnimationDuration(1); |
| 1727 | 1728 |
| 1728 AddButtonsUntilOverflow(); | 1729 AddButtonsUntilOverflow(); |
| 1729 | 1730 |
| 1730 // Test #1: Test drag insertion bounds of primary shelf. | 1731 // Test #1: Test drag insertion bounds of primary shelf. |
| 1731 // Show overflow bubble. | 1732 // Show overflow bubble. |
| 1732 test_api_->ShowOverflowBubble(); | 1733 test_api_->ShowOverflowBubble(); |
| (...skipping 252 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1985 test_api_->RunMessageLoopUntilAnimationsDone(); | 1986 test_api_->RunMessageLoopUntilAnimationsDone(); |
| 1986 CheckAllItemsAreInBounds(); | 1987 CheckAllItemsAreInBounds(); |
| 1987 } | 1988 } |
| 1988 | 1989 |
| 1989 INSTANTIATE_TEST_CASE_P(LtrRtl, ShelfViewTextDirectionTest, testing::Bool()); | 1990 INSTANTIATE_TEST_CASE_P(LtrRtl, ShelfViewTextDirectionTest, testing::Bool()); |
| 1990 INSTANTIATE_TEST_CASE_P(VisibleBounds, ShelfViewVisibleBoundsTest, | 1991 INSTANTIATE_TEST_CASE_P(VisibleBounds, ShelfViewVisibleBoundsTest, |
| 1991 testing::Bool()); | 1992 testing::Bool()); |
| 1992 | 1993 |
| 1993 } // namespace test | 1994 } // namespace test |
| 1994 } // namespace ash | 1995 } // namespace ash |
| OLD | NEW |