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