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 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 ~ShelfViewTest() override {} | 242 ~ShelfViewTest() override {} |
243 | 243 |
244 void SetUp() override { | 244 void SetUp() override { |
245 AshTestBase::SetUp(); | 245 AshTestBase::SetUp(); |
246 model_ = Shell::Get()->shelf_model(); | 246 model_ = Shell::Get()->shelf_model(); |
247 shelf_view_ = GetPrimaryShelf()->GetShelfViewForTesting(); | 247 shelf_view_ = GetPrimaryShelf()->GetShelfViewForTesting(); |
248 | 248 |
249 WebNotificationTray::DisableAnimationsForTest(true); | 249 WebNotificationTray::DisableAnimationsForTest(true); |
250 | 250 |
251 // The bounds should be big enough for 4 buttons + overflow chevron. | 251 // The bounds should be big enough for 4 buttons + overflow chevron. |
252 shelf_view_->SetBounds(0, 0, 500, GetShelfConstant(SHELF_SIZE)); | 252 shelf_view_->SetBounds(0, 0, 500, kShelfSize); |
253 | 253 |
254 test_api_.reset(new ShelfViewTestAPI(shelf_view_)); | 254 test_api_.reset(new ShelfViewTestAPI(shelf_view_)); |
255 test_api_->SetAnimationDuration(1); // Speeds up animation for test. | 255 test_api_->SetAnimationDuration(1); // Speeds up animation for test. |
256 | 256 |
257 // Add browser shortcut shelf item at index 0 for test. | 257 // Add browser shortcut shelf item at index 0 for test. |
258 AddItem(TYPE_BROWSER_SHORTCUT, true); | 258 AddItem(TYPE_BROWSER_SHORTCUT, true); |
259 } | 259 } |
260 | 260 |
261 void TearDown() override { | 261 void TearDown() override { |
262 WebNotificationTray::DisableAnimationsForTest(false); // Reenable animation | 262 WebNotificationTray::DisableAnimationsForTest(false); // Reenable animation |
(...skipping 1147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1410 AddAppNoWait(); | 1410 AddAppNoWait(); |
1411 while (!test_api_->IsOverflowButtonVisible()) { | 1411 while (!test_api_->IsOverflowButtonVisible()) { |
1412 test_api_->RunMessageLoopUntilAnimationsDone(); | 1412 test_api_->RunMessageLoopUntilAnimationsDone(); |
1413 AddAppNoWait(); | 1413 AddAppNoWait(); |
1414 ++items_added; | 1414 ++items_added; |
1415 ASSERT_LT(items_added, 10000); | 1415 ASSERT_LT(items_added, 10000); |
1416 } | 1416 } |
1417 | 1417 |
1418 // Resize shelf view with that animation running and stay overflown. | 1418 // Resize shelf view with that animation running and stay overflown. |
1419 gfx::Rect bounds = shelf_view_->bounds(); | 1419 gfx::Rect bounds = shelf_view_->bounds(); |
1420 bounds.set_width(bounds.width() - GetShelfConstant(SHELF_SIZE)); | 1420 bounds.set_width(bounds.width() - kShelfSize); |
1421 shelf_view_->SetBoundsRect(bounds); | 1421 shelf_view_->SetBoundsRect(bounds); |
1422 ASSERT_TRUE(test_api_->IsOverflowButtonVisible()); | 1422 ASSERT_TRUE(test_api_->IsOverflowButtonVisible()); |
1423 | 1423 |
1424 // Finish the animation. | 1424 // Finish the animation. |
1425 test_api_->RunMessageLoopUntilAnimationsDone(); | 1425 test_api_->RunMessageLoopUntilAnimationsDone(); |
1426 | 1426 |
1427 // App list button should ends up in its new ideal bounds. | 1427 // App list button should ends up in its new ideal bounds. |
1428 const int app_list_button_index = test_api_->GetButtonCount() - 1; | 1428 const int app_list_button_index = test_api_->GetButtonCount() - 1; |
1429 const gfx::Rect& app_list_ideal_bounds = | 1429 const gfx::Rect& app_list_ideal_bounds = |
1430 test_api_->GetIdealBoundsByIndex(app_list_button_index); | 1430 test_api_->GetIdealBoundsByIndex(app_list_button_index); |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1537 | 1537 |
1538 // Check the drag insertion bounds of shelf view in multi monitor environment. | 1538 // Check the drag insertion bounds of shelf view in multi monitor environment. |
1539 TEST_F(ShelfViewTest, CheckDragInsertBoundsWithMultiMonitor) { | 1539 TEST_F(ShelfViewTest, CheckDragInsertBoundsWithMultiMonitor) { |
1540 UpdateDisplay("800x600,800x600"); | 1540 UpdateDisplay("800x600,800x600"); |
1541 WmShelf* secondary_shelf = | 1541 WmShelf* secondary_shelf = |
1542 WmShelf::ForWindow(ShellPort::Get()->GetAllRootWindows()[1]); | 1542 WmShelf::ForWindow(ShellPort::Get()->GetAllRootWindows()[1]); |
1543 ShelfView* shelf_view_for_secondary = | 1543 ShelfView* shelf_view_for_secondary = |
1544 secondary_shelf->GetShelfViewForTesting(); | 1544 secondary_shelf->GetShelfViewForTesting(); |
1545 | 1545 |
1546 // The bounds should be big enough for 4 buttons + overflow chevron. | 1546 // The bounds should be big enough for 4 buttons + overflow chevron. |
1547 shelf_view_for_secondary->SetBounds(0, 0, 500, GetShelfConstant(SHELF_SIZE)); | 1547 shelf_view_for_secondary->SetBounds(0, 0, 500, kShelfSize); |
1548 | 1548 |
1549 ShelfViewTestAPI test_api_for_secondary(shelf_view_for_secondary); | 1549 ShelfViewTestAPI test_api_for_secondary(shelf_view_for_secondary); |
1550 // Speeds up animation for test. | 1550 // Speeds up animation for test. |
1551 test_api_for_secondary.SetAnimationDuration(1); | 1551 test_api_for_secondary.SetAnimationDuration(1); |
1552 | 1552 |
1553 AddButtonsUntilOverflow(); | 1553 AddButtonsUntilOverflow(); |
1554 | 1554 |
1555 // Test #1: Test drag insertion bounds of primary shelf. | 1555 // Test #1: Test drag insertion bounds of primary shelf. |
1556 // Show overflow bubble. | 1556 // Show overflow bubble. |
1557 test_api_->ShowOverflowBubble(); | 1557 test_api_->ShowOverflowBubble(); |
(...skipping 1457 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3015 EXPECT_EQ(views::InkDropState::ACTIVATED, | 3015 EXPECT_EQ(views::InkDropState::ACTIVATED, |
3016 overflow_button_ink_drop_->GetTargetInkDropState()); | 3016 overflow_button_ink_drop_->GetTargetInkDropState()); |
3017 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), | 3017 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), |
3018 IsEmpty()); | 3018 IsEmpty()); |
3019 | 3019 |
3020 ASSERT_TRUE(test_api_->IsShowingOverflowBubble()); | 3020 ASSERT_TRUE(test_api_->IsShowingOverflowBubble()); |
3021 } | 3021 } |
3022 | 3022 |
3023 } // namespace test | 3023 } // namespace test |
3024 } // namespace ash | 3024 } // namespace ash |
OLD | NEW |