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

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

Issue 302653008: Moving default minimize location to the app launcher item. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Changed some comments Created 6 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 | Annotate | Revision Log
« no previous file with comments | « ash/shelf/shelf_view.cc ('k') | ash/wm/window_animations.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <vector> 8 #include <vector>
9 9
10 #include "ash/ash_switches.h" 10 #include "ash/ash_switches.h"
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 gfx::Point icon_offset = button->GetIconBounds().origin(); 631 gfx::Point icon_offset = button->GetIconBounds().origin();
632 item_bounds.Offset(icon_offset.OffsetFromOrigin()); 632 item_bounds.Offset(icon_offset.OffsetFromOrigin());
633 gfx::Rect ideal_bounds = shelf_view_->GetIdealBoundsOfItemIcon(id); 633 gfx::Rect ideal_bounds = shelf_view_->GetIdealBoundsOfItemIcon(id);
634 gfx::Point screen_origin; 634 gfx::Point screen_origin;
635 views::View::ConvertPointToScreen(shelf_view_, &screen_origin); 635 views::View::ConvertPointToScreen(shelf_view_, &screen_origin);
636 ideal_bounds.Offset(screen_origin.x(), screen_origin.y()); 636 ideal_bounds.Offset(screen_origin.x(), screen_origin.y());
637 EXPECT_EQ(item_bounds.x(), ideal_bounds.x()); 637 EXPECT_EQ(item_bounds.x(), ideal_bounds.x());
638 EXPECT_EQ(item_bounds.y(), ideal_bounds.y()); 638 EXPECT_EQ(item_bounds.y(), ideal_bounds.y());
639 } 639 }
640 640
641 // Check that items in the overflow area are returning the overflow button as
642 // ideal bounds.
643 TEST_F(ShelfViewTest, OverflowButtonBounds) {
644 ShelfID first_id = AddPlatformApp();
645 ShelfID overflow_id = AddPlatformApp();
646 int items_added = 0;
647 while (!test_api_->IsOverflowButtonVisible()) {
648 // Added button is visible after animation while in this loop.
649 EXPECT_TRUE(GetButtonByID(overflow_id)->visible());
650 overflow_id = AddPlatformApp();
651 ++items_added;
652 ASSERT_LT(items_added, 10000);
653 }
654 ShelfID last_id = AddPlatformApp();
655
656 gfx::Rect first_bounds = shelf_view_->GetIdealBoundsOfItemIcon(first_id);
657 gfx::Rect overflow_bounds =
658 shelf_view_->GetIdealBoundsOfItemIcon(overflow_id);
659 gfx::Rect last_bounds = shelf_view_->GetIdealBoundsOfItemIcon(last_id);
660
661 // Check that all items have the same size and that the overflow items are
662 // identical whereas the first one does not match either of them.
663 EXPECT_EQ(first_bounds.size().ToString(), last_bounds.size().ToString());
664 EXPECT_NE(first_bounds.ToString(), last_bounds.ToString());
665 EXPECT_EQ(overflow_bounds.ToString(), last_bounds.ToString());
666 }
667
641 // Checks that shelf view contents are considered in the correct drag group. 668 // Checks that shelf view contents are considered in the correct drag group.
642 TEST_F(ShelfViewTest, EnforceDragType) { 669 TEST_F(ShelfViewTest, EnforceDragType) {
643 EXPECT_TRUE(test_api_->SameDragType(TYPE_PLATFORM_APP, TYPE_PLATFORM_APP)); 670 EXPECT_TRUE(test_api_->SameDragType(TYPE_PLATFORM_APP, TYPE_PLATFORM_APP));
644 EXPECT_FALSE(test_api_->SameDragType(TYPE_PLATFORM_APP, TYPE_APP_SHORTCUT)); 671 EXPECT_FALSE(test_api_->SameDragType(TYPE_PLATFORM_APP, TYPE_APP_SHORTCUT));
645 EXPECT_FALSE(test_api_->SameDragType(TYPE_PLATFORM_APP, 672 EXPECT_FALSE(test_api_->SameDragType(TYPE_PLATFORM_APP,
646 TYPE_BROWSER_SHORTCUT)); 673 TYPE_BROWSER_SHORTCUT));
647 EXPECT_FALSE(test_api_->SameDragType(TYPE_PLATFORM_APP, TYPE_WINDOWED_APP)); 674 EXPECT_FALSE(test_api_->SameDragType(TYPE_PLATFORM_APP, TYPE_WINDOWED_APP));
648 EXPECT_FALSE(test_api_->SameDragType(TYPE_PLATFORM_APP, TYPE_APP_LIST)); 675 EXPECT_FALSE(test_api_->SameDragType(TYPE_PLATFORM_APP, TYPE_APP_LIST));
649 EXPECT_FALSE(test_api_->SameDragType(TYPE_PLATFORM_APP, TYPE_APP_PANEL)); 676 EXPECT_FALSE(test_api_->SameDragType(TYPE_PLATFORM_APP, TYPE_APP_PANEL));
650 677
(...skipping 916 matching lines...) Expand 10 before | Expand all | Expand 10 after
1567 test_api_->RunMessageLoopUntilAnimationsDone(); 1594 test_api_->RunMessageLoopUntilAnimationsDone();
1568 CheckAllItemsAreInBounds(); 1595 CheckAllItemsAreInBounds();
1569 } 1596 }
1570 1597
1571 INSTANTIATE_TEST_CASE_P(LtrRtl, ShelfViewTextDirectionTest, testing::Bool()); 1598 INSTANTIATE_TEST_CASE_P(LtrRtl, ShelfViewTextDirectionTest, testing::Bool());
1572 INSTANTIATE_TEST_CASE_P(VisibleBounds, ShelfViewVisibleBoundsTest, 1599 INSTANTIATE_TEST_CASE_P(VisibleBounds, ShelfViewVisibleBoundsTest,
1573 testing::Bool()); 1600 testing::Bool());
1574 1601
1575 } // namespace test 1602 } // namespace test
1576 } // namespace ash 1603 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_view.cc ('k') | ash/wm/window_animations.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698