Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: ash/shelf/shelf_view_unittest.cc

Issue 1998933002: Update shelf spacing in Chrome OS according to the MD specs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 ~ShelfViewTest() override {} 306 ~ShelfViewTest() override {}
307 307
308 void SetUp() override { 308 void SetUp() override {
309 AshTestBase::SetUp(); 309 AshTestBase::SetUp();
310 ShellTestApi test_api(Shell::GetInstance()); 310 ShellTestApi test_api(Shell::GetInstance());
311 model_ = test_api.shelf_model(); 311 model_ = test_api.shelf_model();
312 Shelf* shelf = Shelf::ForPrimaryDisplay(); 312 Shelf* shelf = Shelf::ForPrimaryDisplay();
313 shelf_view_ = ShelfTestAPI(shelf).shelf_view(); 313 shelf_view_ = ShelfTestAPI(shelf).shelf_view();
314 314
315 // The bounds should be big enough for 4 buttons + overflow chevron. 315 // The bounds should be big enough for 4 buttons + overflow chevron.
316 shelf_view_->SetBounds(0, 0, 500, kShelfSize); 316 shelf_view_->SetBounds(0, 0, 500, GetShelfConstant(SHELF_SIZE));
317 317
318 test_api_.reset(new ShelfViewTestAPI(shelf_view_)); 318 test_api_.reset(new ShelfViewTestAPI(shelf_view_));
319 test_api_->SetAnimationDuration(1); // Speeds up animation for test. 319 test_api_->SetAnimationDuration(1); // Speeds up animation for test.
320 320
321 ReplaceShelfDelegate(); 321 ReplaceShelfDelegate();
322 322
323 item_manager_ = Shell::GetInstance()->shelf_item_delegate_manager(); 323 item_manager_ = Shell::GetInstance()->shelf_item_delegate_manager();
324 DCHECK(item_manager_); 324 DCHECK(item_manager_);
325 325
326 // Add browser shortcut shelf item at index 0 for test. 326 // Add browser shortcut shelf item at index 0 for test.
(...skipping 1250 matching lines...) Expand 10 before | Expand all | Expand 10 after
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() - GetShelfConstant(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
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, GetShelfConstant(SHELF_SIZE));
1723 1723
1724 ShelfViewTestAPI test_api_for_secondary(shelf_view_for_secondary); 1724 ShelfViewTestAPI test_api_for_secondary(shelf_view_for_secondary);
1725 // Speeds up animation for test. 1725 // Speeds up animation for test.
1726 test_api_for_secondary.SetAnimationDuration(1); 1726 test_api_for_secondary.SetAnimationDuration(1);
1727 1727
1728 AddButtonsUntilOverflow(); 1728 AddButtonsUntilOverflow();
1729 1729
1730 // Test #1: Test drag insertion bounds of primary shelf. 1730 // Test #1: Test drag insertion bounds of primary shelf.
1731 // Show overflow bubble. 1731 // Show overflow bubble.
1732 test_api_->ShowOverflowBubble(); 1732 test_api_->ShowOverflowBubble();
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
1983 test_api_->RunMessageLoopUntilAnimationsDone(); 1983 test_api_->RunMessageLoopUntilAnimationsDone();
1984 CheckAllItemsAreInBounds(); 1984 CheckAllItemsAreInBounds();
1985 } 1985 }
1986 1986
1987 INSTANTIATE_TEST_CASE_P(LtrRtl, ShelfViewTextDirectionTest, testing::Bool()); 1987 INSTANTIATE_TEST_CASE_P(LtrRtl, ShelfViewTextDirectionTest, testing::Bool());
1988 INSTANTIATE_TEST_CASE_P(VisibleBounds, ShelfViewVisibleBoundsTest, 1988 INSTANTIATE_TEST_CASE_P(VisibleBounds, ShelfViewVisibleBoundsTest,
1989 testing::Bool()); 1989 testing::Bool());
1990 1990
1991 } // namespace test 1991 } // namespace test
1992 } // namespace ash 1992 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698