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

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

Issue 2823133002: Clean up some ash constants. (Closed)
Patch Set: updates Created 3 years, 8 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 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 ~ShelfViewTest() override {} 300 ~ShelfViewTest() override {}
301 301
302 void SetUp() override { 302 void SetUp() override {
303 AshTestBase::SetUp(); 303 AshTestBase::SetUp();
304 model_ = Shell::Get()->shelf_model(); 304 model_ = Shell::Get()->shelf_model();
305 shelf_view_ = GetPrimaryShelf()->GetShelfViewForTesting(); 305 shelf_view_ = GetPrimaryShelf()->GetShelfViewForTesting();
306 306
307 WebNotificationTray::DisableAnimationsForTest(true); 307 WebNotificationTray::DisableAnimationsForTest(true);
308 308
309 // The bounds should be big enough for 4 buttons + overflow chevron. 309 // The bounds should be big enough for 4 buttons + overflow chevron.
310 shelf_view_->SetBounds(0, 0, 500, GetShelfConstant(SHELF_SIZE)); 310 shelf_view_->SetBounds(0, 0, 500, kShelfSize);
311 311
312 test_api_.reset(new ShelfViewTestAPI(shelf_view_)); 312 test_api_.reset(new ShelfViewTestAPI(shelf_view_));
313 test_api_->SetAnimationDuration(1); // Speeds up animation for test. 313 test_api_->SetAnimationDuration(1); // Speeds up animation for test.
314 314
315 ReplaceShelfDelegate(); 315 ReplaceShelfDelegate();
316 316
317 // Add browser shortcut shelf item at index 0 for test. 317 // Add browser shortcut shelf item at index 0 for test.
318 AddBrowserShortcut(); 318 AddBrowserShortcut();
319 } 319 }
320 320
(...skipping 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1527 AddAppNoWait(); 1527 AddAppNoWait();
1528 while (!test_api_->IsOverflowButtonVisible()) { 1528 while (!test_api_->IsOverflowButtonVisible()) {
1529 test_api_->RunMessageLoopUntilAnimationsDone(); 1529 test_api_->RunMessageLoopUntilAnimationsDone();
1530 AddAppNoWait(); 1530 AddAppNoWait();
1531 ++items_added; 1531 ++items_added;
1532 ASSERT_LT(items_added, 10000); 1532 ASSERT_LT(items_added, 10000);
1533 } 1533 }
1534 1534
1535 // Resize shelf view with that animation running and stay overflown. 1535 // Resize shelf view with that animation running and stay overflown.
1536 gfx::Rect bounds = shelf_view_->bounds(); 1536 gfx::Rect bounds = shelf_view_->bounds();
1537 bounds.set_width(bounds.width() - GetShelfConstant(SHELF_SIZE)); 1537 bounds.set_width(bounds.width() - kShelfSize);
1538 shelf_view_->SetBoundsRect(bounds); 1538 shelf_view_->SetBoundsRect(bounds);
1539 ASSERT_TRUE(test_api_->IsOverflowButtonVisible()); 1539 ASSERT_TRUE(test_api_->IsOverflowButtonVisible());
1540 1540
1541 // Finish the animation. 1541 // Finish the animation.
1542 test_api_->RunMessageLoopUntilAnimationsDone(); 1542 test_api_->RunMessageLoopUntilAnimationsDone();
1543 1543
1544 // App list button should ends up in its new ideal bounds. 1544 // App list button should ends up in its new ideal bounds.
1545 const int app_list_button_index = test_api_->GetButtonCount() - 1; 1545 const int app_list_button_index = test_api_->GetButtonCount() - 1;
1546 const gfx::Rect& app_list_ideal_bounds = 1546 const gfx::Rect& app_list_ideal_bounds =
1547 test_api_->GetIdealBoundsByIndex(app_list_button_index); 1547 test_api_->GetIdealBoundsByIndex(app_list_button_index);
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
1655 1655
1656 // Check the drag insertion bounds of shelf view in multi monitor environment. 1656 // Check the drag insertion bounds of shelf view in multi monitor environment.
1657 TEST_F(ShelfViewTest, CheckDragInsertBoundsWithMultiMonitor) { 1657 TEST_F(ShelfViewTest, CheckDragInsertBoundsWithMultiMonitor) {
1658 UpdateDisplay("800x600,800x600"); 1658 UpdateDisplay("800x600,800x600");
1659 WmShelf* secondary_shelf = 1659 WmShelf* secondary_shelf =
1660 WmShelf::ForWindow(ShellPort::Get()->GetAllRootWindows()[1]); 1660 WmShelf::ForWindow(ShellPort::Get()->GetAllRootWindows()[1]);
1661 ShelfView* shelf_view_for_secondary = 1661 ShelfView* shelf_view_for_secondary =
1662 secondary_shelf->GetShelfViewForTesting(); 1662 secondary_shelf->GetShelfViewForTesting();
1663 1663
1664 // The bounds should be big enough for 4 buttons + overflow chevron. 1664 // The bounds should be big enough for 4 buttons + overflow chevron.
1665 shelf_view_for_secondary->SetBounds(0, 0, 500, GetShelfConstant(SHELF_SIZE)); 1665 shelf_view_for_secondary->SetBounds(0, 0, 500, kShelfSize);
1666 1666
1667 ShelfViewTestAPI test_api_for_secondary(shelf_view_for_secondary); 1667 ShelfViewTestAPI test_api_for_secondary(shelf_view_for_secondary);
1668 // Speeds up animation for test. 1668 // Speeds up animation for test.
1669 test_api_for_secondary.SetAnimationDuration(1); 1669 test_api_for_secondary.SetAnimationDuration(1);
1670 1670
1671 AddButtonsUntilOverflow(); 1671 AddButtonsUntilOverflow();
1672 1672
1673 // Test #1: Test drag insertion bounds of primary shelf. 1673 // Test #1: Test drag insertion bounds of primary shelf.
1674 // Show overflow bubble. 1674 // Show overflow bubble.
1675 test_api_->ShowOverflowBubble(); 1675 test_api_->ShowOverflowBubble();
(...skipping 1455 matching lines...) Expand 10 before | Expand all | Expand 10 after
3131 EXPECT_EQ(views::InkDropState::ACTIVATED, 3131 EXPECT_EQ(views::InkDropState::ACTIVATED,
3132 overflow_button_ink_drop_->GetTargetInkDropState()); 3132 overflow_button_ink_drop_->GetTargetInkDropState());
3133 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), 3133 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(),
3134 IsEmpty()); 3134 IsEmpty());
3135 3135
3136 ASSERT_TRUE(test_api_->IsShowingOverflowBubble()); 3136 ASSERT_TRUE(test_api_->IsShowingOverflowBubble());
3137 } 3137 }
3138 3138
3139 } // namespace test 3139 } // namespace test
3140 } // namespace ash 3140 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698