Chromium Code Reviews| 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/common/shelf/shelf_view.h" | 5 #include "ash/common/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 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 350 test_api_->RunMessageLoopUntilAnimationsDone(); | 350 test_api_->RunMessageLoopUntilAnimationsDone(); |
| 351 return id; | 351 return id; |
| 352 } | 352 } |
| 353 | 353 |
| 354 ShelfID AddPanel() { | 354 ShelfID AddPanel() { |
| 355 ShelfID id = AddPanelNoWait(); | 355 ShelfID id = AddPanelNoWait(); |
| 356 test_api_->RunMessageLoopUntilAnimationsDone(); | 356 test_api_->RunMessageLoopUntilAnimationsDone(); |
| 357 return id; | 357 return id; |
| 358 } | 358 } |
| 359 | 359 |
| 360 ShelfID AddPlatformAppNoWait() { | 360 ShelfID AddAppNoWait() { |
|
Mr4D (OOO till 08-26)
2016/11/23 23:11:51
I suppose these names too...
msw
2016/11/24 00:00:55
Ditto.
| |
| 361 ShelfItem item; | 361 ShelfItem item; |
| 362 item.type = TYPE_PLATFORM_APP; | 362 item.type = TYPE_APP; |
| 363 item.status = STATUS_RUNNING; | 363 item.status = STATUS_RUNNING; |
| 364 | 364 |
| 365 ShelfID id = model_->next_id(); | 365 ShelfID id = model_->next_id(); |
| 366 model_->Add(item); | 366 model_->Add(item); |
| 367 CreateAndSetShelfItemDelegateForID(id); | 367 CreateAndSetShelfItemDelegateForID(id); |
| 368 return id; | 368 return id; |
| 369 } | 369 } |
| 370 | 370 |
| 371 ShelfID AddPanelNoWait() { | 371 ShelfID AddPanelNoWait() { |
| 372 ShelfItem item; | 372 ShelfItem item; |
| 373 item.type = TYPE_APP_PANEL; | 373 item.type = TYPE_APP_PANEL; |
| 374 item.status = STATUS_RUNNING; | 374 item.status = STATUS_RUNNING; |
| 375 | 375 |
| 376 ShelfID id = model_->next_id(); | 376 ShelfID id = model_->next_id(); |
| 377 model_->Add(item); | 377 model_->Add(item); |
| 378 CreateAndSetShelfItemDelegateForID(id); | 378 CreateAndSetShelfItemDelegateForID(id); |
| 379 return id; | 379 return id; |
| 380 } | 380 } |
| 381 | 381 |
| 382 ShelfID AddPlatformApp() { | 382 ShelfID AddApp() { |
| 383 ShelfID id = AddPlatformAppNoWait(); | 383 ShelfID id = AddAppNoWait(); |
| 384 test_api_->RunMessageLoopUntilAnimationsDone(); | 384 test_api_->RunMessageLoopUntilAnimationsDone(); |
| 385 return id; | 385 return id; |
| 386 } | 386 } |
| 387 | 387 |
| 388 void SetShelfItemTypeToAppShortcut(ShelfID id) { | 388 void SetShelfItemTypeToAppShortcut(ShelfID id) { |
| 389 int index = model_->ItemIndexByID(id); | 389 int index = model_->ItemIndexByID(id); |
| 390 DCHECK_GE(index, 0); | 390 DCHECK_GE(index, 0); |
| 391 | 391 |
| 392 ShelfItem item = model_->items()[index]; | 392 ShelfItem item = model_->items()[index]; |
| 393 | 393 |
| 394 if (item.type == TYPE_PLATFORM_APP || item.type == TYPE_WINDOWED_APP) { | 394 if (item.type == TYPE_APP) { |
| 395 item.type = TYPE_APP_SHORTCUT; | 395 item.type = TYPE_APP_SHORTCUT; |
| 396 model_->Set(index, item); | 396 model_->Set(index, item); |
| 397 } | 397 } |
| 398 test_api_->RunMessageLoopUntilAnimationsDone(); | 398 test_api_->RunMessageLoopUntilAnimationsDone(); |
| 399 } | 399 } |
| 400 | 400 |
| 401 void RemoveByID(ShelfID id) { | 401 void RemoveByID(ShelfID id) { |
| 402 model_->RemoveItemAt(model_->ItemIndexByID(id)); | 402 model_->RemoveItemAt(model_->ItemIndexByID(id)); |
| 403 test_api_->RunMessageLoopUntilAnimationsDone(); | 403 test_api_->RunMessageLoopUntilAnimationsDone(); |
| 404 } | 404 } |
| (...skipping 324 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 729 | 729 |
| 730 private: | 730 private: |
| 731 ScopedTextDirectionChange text_direction_change_; | 731 ScopedTextDirectionChange text_direction_change_; |
| 732 | 732 |
| 733 DISALLOW_COPY_AND_ASSIGN(ShelfViewTextDirectionTest); | 733 DISALLOW_COPY_AND_ASSIGN(ShelfViewTextDirectionTest); |
| 734 }; | 734 }; |
| 735 | 735 |
| 736 // Checks that the ideal item icon bounds match the view's bounds in the screen | 736 // Checks that the ideal item icon bounds match the view's bounds in the screen |
| 737 // in both LTR and RTL. | 737 // in both LTR and RTL. |
| 738 TEST_P(ShelfViewTextDirectionTest, IdealBoundsOfItemIcon) { | 738 TEST_P(ShelfViewTextDirectionTest, IdealBoundsOfItemIcon) { |
| 739 ShelfID id = AddPlatformApp(); | 739 ShelfID id = AddApp(); |
| 740 ShelfButton* button = GetButtonByID(id); | 740 ShelfButton* button = GetButtonByID(id); |
| 741 gfx::Rect item_bounds = button->GetBoundsInScreen(); | 741 gfx::Rect item_bounds = button->GetBoundsInScreen(); |
| 742 gfx::Point icon_offset = button->GetIconBounds().origin(); | 742 gfx::Point icon_offset = button->GetIconBounds().origin(); |
| 743 item_bounds.Offset(icon_offset.OffsetFromOrigin()); | 743 item_bounds.Offset(icon_offset.OffsetFromOrigin()); |
| 744 gfx::Rect ideal_bounds = shelf_view_->GetIdealBoundsOfItemIcon(id); | 744 gfx::Rect ideal_bounds = shelf_view_->GetIdealBoundsOfItemIcon(id); |
| 745 gfx::Point screen_origin; | 745 gfx::Point screen_origin; |
| 746 views::View::ConvertPointToScreen(shelf_view_, &screen_origin); | 746 views::View::ConvertPointToScreen(shelf_view_, &screen_origin); |
| 747 ideal_bounds.Offset(screen_origin.x(), screen_origin.y()); | 747 ideal_bounds.Offset(screen_origin.x(), screen_origin.y()); |
| 748 EXPECT_EQ(item_bounds.x(), ideal_bounds.x()); | 748 EXPECT_EQ(item_bounds.x(), ideal_bounds.x()); |
| 749 EXPECT_EQ(item_bounds.y(), ideal_bounds.y()); | 749 EXPECT_EQ(item_bounds.y(), ideal_bounds.y()); |
| 750 } | 750 } |
| 751 | 751 |
| 752 // Check that items in the overflow area are returning the overflow button as | 752 // Check that items in the overflow area are returning the overflow button as |
| 753 // ideal bounds. | 753 // ideal bounds. |
| 754 TEST_F(ShelfViewTest, OverflowButtonBounds) { | 754 TEST_F(ShelfViewTest, OverflowButtonBounds) { |
| 755 ShelfID first_id = AddPlatformApp(); | 755 ShelfID first_id = AddApp(); |
| 756 ShelfID overflow_id = AddPlatformApp(); | 756 ShelfID overflow_id = AddApp(); |
| 757 int items_added = 0; | 757 int items_added = 0; |
| 758 while (!test_api_->IsOverflowButtonVisible()) { | 758 while (!test_api_->IsOverflowButtonVisible()) { |
| 759 // Added button is visible after animation while in this loop. | 759 // Added button is visible after animation while in this loop. |
| 760 EXPECT_TRUE(GetButtonByID(overflow_id)->visible()); | 760 EXPECT_TRUE(GetButtonByID(overflow_id)->visible()); |
| 761 overflow_id = AddPlatformApp(); | 761 overflow_id = AddApp(); |
| 762 ++items_added; | 762 ++items_added; |
| 763 ASSERT_LT(items_added, 10000); | 763 ASSERT_LT(items_added, 10000); |
| 764 } | 764 } |
| 765 ShelfID last_id = AddPlatformApp(); | 765 ShelfID last_id = AddApp(); |
| 766 | 766 |
| 767 gfx::Rect first_bounds = shelf_view_->GetIdealBoundsOfItemIcon(first_id); | 767 gfx::Rect first_bounds = shelf_view_->GetIdealBoundsOfItemIcon(first_id); |
| 768 gfx::Rect overflow_bounds = | 768 gfx::Rect overflow_bounds = |
| 769 shelf_view_->GetIdealBoundsOfItemIcon(overflow_id); | 769 shelf_view_->GetIdealBoundsOfItemIcon(overflow_id); |
| 770 gfx::Rect last_bounds = shelf_view_->GetIdealBoundsOfItemIcon(last_id); | 770 gfx::Rect last_bounds = shelf_view_->GetIdealBoundsOfItemIcon(last_id); |
| 771 | 771 |
| 772 // Check that all items have the same size and that the overflow items are | 772 // Check that all items have the same size and that the overflow items are |
| 773 // identical whereas the first one does not match either of them. | 773 // identical whereas the first one does not match either of them. |
| 774 EXPECT_EQ(first_bounds.size().ToString(), last_bounds.size().ToString()); | 774 EXPECT_EQ(first_bounds.size().ToString(), last_bounds.size().ToString()); |
| 775 EXPECT_NE(first_bounds.ToString(), last_bounds.ToString()); | 775 EXPECT_NE(first_bounds.ToString(), last_bounds.ToString()); |
| 776 EXPECT_EQ(overflow_bounds.ToString(), last_bounds.ToString()); | 776 EXPECT_EQ(overflow_bounds.ToString(), last_bounds.ToString()); |
| 777 } | 777 } |
| 778 | 778 |
| 779 // Checks that shelf view contents are considered in the correct drag group. | 779 // Checks that shelf view contents are considered in the correct drag group. |
| 780 TEST_F(ShelfViewTest, EnforceDragType) { | 780 TEST_F(ShelfViewTest, EnforceDragType) { |
| 781 EXPECT_TRUE(test_api_->SameDragType(TYPE_PLATFORM_APP, TYPE_PLATFORM_APP)); | 781 EXPECT_TRUE(test_api_->SameDragType(TYPE_APP, TYPE_APP)); |
| 782 EXPECT_FALSE(test_api_->SameDragType(TYPE_PLATFORM_APP, TYPE_APP_SHORTCUT)); | 782 EXPECT_FALSE(test_api_->SameDragType(TYPE_APP, TYPE_APP_SHORTCUT)); |
| 783 EXPECT_FALSE( | 783 EXPECT_FALSE(test_api_->SameDragType(TYPE_APP, TYPE_BROWSER_SHORTCUT)); |
| 784 test_api_->SameDragType(TYPE_PLATFORM_APP, TYPE_BROWSER_SHORTCUT)); | 784 EXPECT_FALSE(test_api_->SameDragType(TYPE_APP, TYPE_APP_LIST)); |
| 785 EXPECT_FALSE(test_api_->SameDragType(TYPE_PLATFORM_APP, TYPE_WINDOWED_APP)); | 785 EXPECT_FALSE(test_api_->SameDragType(TYPE_APP, TYPE_APP_PANEL)); |
| 786 EXPECT_FALSE(test_api_->SameDragType(TYPE_PLATFORM_APP, TYPE_APP_LIST)); | |
| 787 EXPECT_FALSE(test_api_->SameDragType(TYPE_PLATFORM_APP, TYPE_APP_PANEL)); | |
| 788 | 786 |
| 789 EXPECT_TRUE(test_api_->SameDragType(TYPE_APP_SHORTCUT, TYPE_APP_SHORTCUT)); | 787 EXPECT_TRUE(test_api_->SameDragType(TYPE_APP_SHORTCUT, TYPE_APP_SHORTCUT)); |
| 790 EXPECT_TRUE( | 788 EXPECT_TRUE( |
| 791 test_api_->SameDragType(TYPE_APP_SHORTCUT, TYPE_BROWSER_SHORTCUT)); | 789 test_api_->SameDragType(TYPE_APP_SHORTCUT, TYPE_BROWSER_SHORTCUT)); |
| 792 EXPECT_FALSE(test_api_->SameDragType(TYPE_APP_SHORTCUT, TYPE_WINDOWED_APP)); | |
| 793 EXPECT_FALSE(test_api_->SameDragType(TYPE_APP_SHORTCUT, TYPE_APP_LIST)); | 790 EXPECT_FALSE(test_api_->SameDragType(TYPE_APP_SHORTCUT, TYPE_APP_LIST)); |
| 794 EXPECT_FALSE(test_api_->SameDragType(TYPE_APP_SHORTCUT, TYPE_APP_PANEL)); | 791 EXPECT_FALSE(test_api_->SameDragType(TYPE_APP_SHORTCUT, TYPE_APP_PANEL)); |
| 795 | 792 |
| 796 EXPECT_TRUE( | 793 EXPECT_TRUE( |
| 797 test_api_->SameDragType(TYPE_BROWSER_SHORTCUT, TYPE_BROWSER_SHORTCUT)); | 794 test_api_->SameDragType(TYPE_BROWSER_SHORTCUT, TYPE_BROWSER_SHORTCUT)); |
| 798 EXPECT_FALSE( | |
| 799 test_api_->SameDragType(TYPE_BROWSER_SHORTCUT, TYPE_WINDOWED_APP)); | |
| 800 EXPECT_FALSE(test_api_->SameDragType(TYPE_BROWSER_SHORTCUT, TYPE_APP_LIST)); | 795 EXPECT_FALSE(test_api_->SameDragType(TYPE_BROWSER_SHORTCUT, TYPE_APP_LIST)); |
| 801 EXPECT_FALSE(test_api_->SameDragType(TYPE_BROWSER_SHORTCUT, TYPE_APP_PANEL)); | 796 EXPECT_FALSE(test_api_->SameDragType(TYPE_BROWSER_SHORTCUT, TYPE_APP_PANEL)); |
| 802 | 797 |
| 803 EXPECT_TRUE(test_api_->SameDragType(TYPE_WINDOWED_APP, TYPE_WINDOWED_APP)); | |
| 804 EXPECT_FALSE(test_api_->SameDragType(TYPE_WINDOWED_APP, TYPE_APP_LIST)); | |
| 805 EXPECT_FALSE(test_api_->SameDragType(TYPE_WINDOWED_APP, TYPE_APP_PANEL)); | |
| 806 | |
| 807 EXPECT_TRUE(test_api_->SameDragType(TYPE_APP_LIST, TYPE_APP_LIST)); | 798 EXPECT_TRUE(test_api_->SameDragType(TYPE_APP_LIST, TYPE_APP_LIST)); |
| 808 EXPECT_FALSE(test_api_->SameDragType(TYPE_APP_LIST, TYPE_APP_PANEL)); | 799 EXPECT_FALSE(test_api_->SameDragType(TYPE_APP_LIST, TYPE_APP_PANEL)); |
| 809 | 800 |
| 810 EXPECT_TRUE(test_api_->SameDragType(TYPE_APP_PANEL, TYPE_APP_PANEL)); | 801 EXPECT_TRUE(test_api_->SameDragType(TYPE_APP_PANEL, TYPE_APP_PANEL)); |
| 811 } | 802 } |
| 812 | 803 |
| 813 // Adds platform app button until overflow and verifies that the last added | 804 // Adds platform app button until overflow and verifies that the last added |
| 814 // platform app button is hidden. | 805 // platform app button is hidden. |
| 815 TEST_F(ShelfViewTest, AddBrowserUntilOverflow) { | 806 TEST_F(ShelfViewTest, AddBrowserUntilOverflow) { |
| 816 // All buttons should be visible. | 807 // All buttons should be visible. |
| 817 ASSERT_EQ(test_api_->GetButtonCount(), test_api_->GetLastVisibleIndex() + 1); | 808 ASSERT_EQ(test_api_->GetButtonCount(), test_api_->GetLastVisibleIndex() + 1); |
| 818 | 809 |
| 819 // Add platform app button until overflow. | 810 // Add platform app button until overflow. |
| 820 int items_added = 0; | 811 int items_added = 0; |
| 821 ShelfID last_added = AddPlatformApp(); | 812 ShelfID last_added = AddApp(); |
| 822 while (!test_api_->IsOverflowButtonVisible()) { | 813 while (!test_api_->IsOverflowButtonVisible()) { |
| 823 // Added button is visible after animation while in this loop. | 814 // Added button is visible after animation while in this loop. |
| 824 EXPECT_TRUE(GetButtonByID(last_added)->visible()); | 815 EXPECT_TRUE(GetButtonByID(last_added)->visible()); |
| 825 | 816 |
| 826 last_added = AddPlatformApp(); | 817 last_added = AddApp(); |
| 827 ++items_added; | 818 ++items_added; |
| 828 ASSERT_LT(items_added, 10000); | 819 ASSERT_LT(items_added, 10000); |
| 829 } | 820 } |
| 830 | 821 |
| 831 // The last added button should be invisible. | 822 // The last added button should be invisible. |
| 832 EXPECT_FALSE(GetButtonByID(last_added)->visible()); | 823 EXPECT_FALSE(GetButtonByID(last_added)->visible()); |
| 833 } | 824 } |
| 834 | 825 |
| 835 // Adds one platform app button then adds app shortcut until overflow. Verifies | 826 // Adds one platform app button then adds app shortcut until overflow. Verifies |
| 836 // that the browser button gets hidden on overflow and last added app shortcut | 827 // that the browser button gets hidden on overflow and last added app shortcut |
| 837 // is still visible. | 828 // is still visible. |
| 838 TEST_F(ShelfViewTest, AddAppShortcutWithBrowserButtonUntilOverflow) { | 829 TEST_F(ShelfViewTest, AddAppShortcutWithBrowserButtonUntilOverflow) { |
| 839 // All buttons should be visible. | 830 // All buttons should be visible. |
| 840 ASSERT_EQ(test_api_->GetButtonCount(), test_api_->GetLastVisibleIndex() + 1); | 831 ASSERT_EQ(test_api_->GetButtonCount(), test_api_->GetLastVisibleIndex() + 1); |
| 841 | 832 |
| 842 ShelfID browser_button_id = AddPlatformApp(); | 833 ShelfID browser_button_id = AddApp(); |
| 843 | 834 |
| 844 // Add app shortcut until overflow. | 835 // Add app shortcut until overflow. |
| 845 int items_added = 0; | 836 int items_added = 0; |
| 846 ShelfID last_added = AddAppShortcut(); | 837 ShelfID last_added = AddAppShortcut(); |
| 847 while (!test_api_->IsOverflowButtonVisible()) { | 838 while (!test_api_->IsOverflowButtonVisible()) { |
| 848 // Added button is visible after animation while in this loop. | 839 // Added button is visible after animation while in this loop. |
| 849 EXPECT_TRUE(GetButtonByID(last_added)->visible()); | 840 EXPECT_TRUE(GetButtonByID(last_added)->visible()); |
| 850 | 841 |
| 851 last_added = AddAppShortcut(); | 842 last_added = AddAppShortcut(); |
| 852 ++items_added; | 843 ++items_added; |
| 853 ASSERT_LT(items_added, 10000); | 844 ASSERT_LT(items_added, 10000); |
| 854 } | 845 } |
| 855 | 846 |
| 856 // And the platform app button is invisible. | 847 // And the platform app button is invisible. |
| 857 EXPECT_FALSE(GetButtonByID(browser_button_id)->visible()); | 848 EXPECT_FALSE(GetButtonByID(browser_button_id)->visible()); |
| 858 } | 849 } |
| 859 | 850 |
| 860 TEST_F(ShelfViewTest, AddPanelHidesPlatformAppButton) { | 851 TEST_F(ShelfViewTest, AddPanelHidesPlatformAppButton) { |
| 861 // All buttons should be visible. | 852 // All buttons should be visible. |
| 862 ASSERT_EQ(test_api_->GetButtonCount(), test_api_->GetLastVisibleIndex() + 1); | 853 ASSERT_EQ(test_api_->GetButtonCount(), test_api_->GetLastVisibleIndex() + 1); |
| 863 | 854 |
| 864 // Add platform app button until overflow, remember last visible platform app | 855 // Add platform app button until overflow, remember last visible platform app |
| 865 // button. | 856 // button. |
| 866 int items_added = 0; | 857 int items_added = 0; |
| 867 ShelfID first_added = AddPlatformApp(); | 858 ShelfID first_added = AddApp(); |
| 868 EXPECT_TRUE(GetButtonByID(first_added)->visible()); | 859 EXPECT_TRUE(GetButtonByID(first_added)->visible()); |
| 869 while (true) { | 860 while (true) { |
| 870 ShelfID added = AddPlatformApp(); | 861 ShelfID added = AddApp(); |
| 871 if (test_api_->IsOverflowButtonVisible()) { | 862 if (test_api_->IsOverflowButtonVisible()) { |
| 872 EXPECT_FALSE(GetButtonByID(added)->visible()); | 863 EXPECT_FALSE(GetButtonByID(added)->visible()); |
| 873 RemoveByID(added); | 864 RemoveByID(added); |
| 874 break; | 865 break; |
| 875 } | 866 } |
| 876 ++items_added; | 867 ++items_added; |
| 877 ASSERT_LT(items_added, 10000); | 868 ASSERT_LT(items_added, 10000); |
| 878 } | 869 } |
| 879 | 870 |
| 880 ShelfID panel = AddPanel(); | 871 ShelfID panel = AddPanel(); |
| 881 EXPECT_TRUE(test_api_->IsOverflowButtonVisible()); | 872 EXPECT_TRUE(test_api_->IsOverflowButtonVisible()); |
| 882 | 873 |
| 883 RemoveByID(panel); | 874 RemoveByID(panel); |
| 884 EXPECT_FALSE(test_api_->IsOverflowButtonVisible()); | 875 EXPECT_FALSE(test_api_->IsOverflowButtonVisible()); |
| 885 } | 876 } |
| 886 | 877 |
| 887 // When there are more panels then platform app buttons we should hide panels | 878 // When there are more panels then platform app buttons we should hide panels |
| 888 // rather than platform apps. | 879 // rather than platform apps. |
| 889 TEST_F(ShelfViewTest, PlatformAppHidesExcessPanels) { | 880 TEST_F(ShelfViewTest, PlatformAppHidesExcessPanels) { |
| 890 // All buttons should be visible. | 881 // All buttons should be visible. |
| 891 ASSERT_EQ(test_api_->GetButtonCount(), test_api_->GetLastVisibleIndex() + 1); | 882 ASSERT_EQ(test_api_->GetButtonCount(), test_api_->GetLastVisibleIndex() + 1); |
| 892 | 883 |
| 893 // Add platform app button. | 884 // Add platform app button. |
| 894 ShelfID platform_app = AddPlatformApp(); | 885 ShelfID platform_app = AddApp(); |
| 895 ShelfID first_panel = AddPanel(); | 886 ShelfID first_panel = AddPanel(); |
| 896 | 887 |
| 897 EXPECT_TRUE(GetButtonByID(platform_app)->visible()); | 888 EXPECT_TRUE(GetButtonByID(platform_app)->visible()); |
| 898 EXPECT_TRUE(GetButtonByID(first_panel)->visible()); | 889 EXPECT_TRUE(GetButtonByID(first_panel)->visible()); |
| 899 | 890 |
| 900 // Add panels until there is an overflow. | 891 // Add panels until there is an overflow. |
| 901 ShelfID last_panel = first_panel; | 892 ShelfID last_panel = first_panel; |
| 902 int items_added = 0; | 893 int items_added = 0; |
| 903 while (!test_api_->IsOverflowButtonVisible()) { | 894 while (!test_api_->IsOverflowButtonVisible()) { |
| 904 last_panel = AddPanel(); | 895 last_panel = AddPanel(); |
| 905 ++items_added; | 896 ++items_added; |
| 906 ASSERT_LT(items_added, 10000); | 897 ASSERT_LT(items_added, 10000); |
| 907 } | 898 } |
| 908 | 899 |
| 909 // The first panel should now be hidden by the new platform apps needing | 900 // The first panel should now be hidden by the new platform apps needing |
| 910 // space. | 901 // space. |
| 911 EXPECT_FALSE(GetButtonByID(first_panel)->visible()); | 902 EXPECT_FALSE(GetButtonByID(first_panel)->visible()); |
| 912 EXPECT_TRUE(GetButtonByID(last_panel)->visible()); | 903 EXPECT_TRUE(GetButtonByID(last_panel)->visible()); |
| 913 EXPECT_TRUE(GetButtonByID(platform_app)->visible()); | 904 EXPECT_TRUE(GetButtonByID(platform_app)->visible()); |
| 914 | 905 |
| 915 // Adding platform apps should eventually begin to hide platform apps. We will | 906 // Adding platform apps should eventually begin to hide platform apps. We will |
| 916 // add platform apps until either the last panel or platform app is hidden. | 907 // add platform apps until either the last panel or platform app is hidden. |
| 917 items_added = 0; | 908 items_added = 0; |
| 918 while (GetButtonByID(platform_app)->visible() && | 909 while (GetButtonByID(platform_app)->visible() && |
| 919 GetButtonByID(last_panel)->visible()) { | 910 GetButtonByID(last_panel)->visible()) { |
| 920 platform_app = AddPlatformApp(); | 911 platform_app = AddApp(); |
| 921 ++items_added; | 912 ++items_added; |
| 922 ASSERT_LT(items_added, 10000); | 913 ASSERT_LT(items_added, 10000); |
| 923 } | 914 } |
| 924 EXPECT_TRUE(GetButtonByID(last_panel)->visible()); | 915 EXPECT_TRUE(GetButtonByID(last_panel)->visible()); |
| 925 EXPECT_FALSE(GetButtonByID(platform_app)->visible()); | 916 EXPECT_FALSE(GetButtonByID(platform_app)->visible()); |
| 926 } | 917 } |
| 927 | 918 |
| 928 // Making sure that no buttons on the shelf will ever overlap after adding many | 919 // Making sure that no buttons on the shelf will ever overlap after adding many |
| 929 // of them. | 920 // of them. |
| 930 TEST_F(ShelfViewTest, AssertNoButtonsOverlap) { | 921 TEST_F(ShelfViewTest, AssertNoButtonsOverlap) { |
| 931 std::vector<ShelfID> button_ids; | 922 std::vector<ShelfID> button_ids; |
| 932 // Add app icons until the overflow button is visible. | 923 // Add app icons until the overflow button is visible. |
| 933 while (!test_api_->IsOverflowButtonVisible()) { | 924 while (!test_api_->IsOverflowButtonVisible()) { |
| 934 ShelfID id = AddPlatformApp(); | 925 ShelfID id = AddApp(); |
| 935 button_ids.push_back(id); | 926 button_ids.push_back(id); |
| 936 } | 927 } |
| 937 ASSERT_LT(button_ids.size(), 10000U); | 928 ASSERT_LT(button_ids.size(), 10000U); |
| 938 ASSERT_GT(button_ids.size(), 2U); | 929 ASSERT_GT(button_ids.size(), 2U); |
| 939 | 930 |
| 940 // Remove 2 icons to make more room for panel icons, the overflow button | 931 // Remove 2 icons to make more room for panel icons, the overflow button |
| 941 // should go away. | 932 // should go away. |
| 942 for (int i = 0; i < 2; ++i) { | 933 for (int i = 0; i < 2; ++i) { |
| 943 ShelfID id = button_ids.back(); | 934 ShelfID id = button_ids.back(); |
| 944 RemoveByID(id); | 935 RemoveByID(id); |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1011 | 1002 |
| 1012 // Adds button until overflow then removes first added one. Verifies that | 1003 // Adds button until overflow then removes first added one. Verifies that |
| 1013 // the last added one changes from invisible to visible and overflow | 1004 // the last added one changes from invisible to visible and overflow |
| 1014 // chevron is gone. | 1005 // chevron is gone. |
| 1015 TEST_F(ShelfViewTest, RemoveButtonRevealsOverflowed) { | 1006 TEST_F(ShelfViewTest, RemoveButtonRevealsOverflowed) { |
| 1016 // All buttons should be visible. | 1007 // All buttons should be visible. |
| 1017 ASSERT_EQ(test_api_->GetButtonCount(), test_api_->GetLastVisibleIndex() + 1); | 1008 ASSERT_EQ(test_api_->GetButtonCount(), test_api_->GetLastVisibleIndex() + 1); |
| 1018 | 1009 |
| 1019 // Add platform app buttons until overflow. | 1010 // Add platform app buttons until overflow. |
| 1020 int items_added = 0; | 1011 int items_added = 0; |
| 1021 ShelfID first_added = AddPlatformApp(); | 1012 ShelfID first_added = AddApp(); |
| 1022 ShelfID last_added = first_added; | 1013 ShelfID last_added = first_added; |
| 1023 while (!test_api_->IsOverflowButtonVisible()) { | 1014 while (!test_api_->IsOverflowButtonVisible()) { |
| 1024 last_added = AddPlatformApp(); | 1015 last_added = AddApp(); |
| 1025 ++items_added; | 1016 ++items_added; |
| 1026 ASSERT_LT(items_added, 10000); | 1017 ASSERT_LT(items_added, 10000); |
| 1027 } | 1018 } |
| 1028 | 1019 |
| 1029 // Expect add more than 1 button. First added is visible and last is not. | 1020 // Expect add more than 1 button. First added is visible and last is not. |
| 1030 EXPECT_NE(first_added, last_added); | 1021 EXPECT_NE(first_added, last_added); |
| 1031 EXPECT_TRUE(GetButtonByID(first_added)->visible()); | 1022 EXPECT_TRUE(GetButtonByID(first_added)->visible()); |
| 1032 EXPECT_FALSE(GetButtonByID(last_added)->visible()); | 1023 EXPECT_FALSE(GetButtonByID(last_added)->visible()); |
| 1033 | 1024 |
| 1034 // Remove first added. | 1025 // Remove first added. |
| 1035 RemoveByID(first_added); | 1026 RemoveByID(first_added); |
| 1036 | 1027 |
| 1037 // Last added button becomes visible and overflow chevron is gone. | 1028 // Last added button becomes visible and overflow chevron is gone. |
| 1038 EXPECT_TRUE(GetButtonByID(last_added)->visible()); | 1029 EXPECT_TRUE(GetButtonByID(last_added)->visible()); |
| 1039 EXPECT_EQ(1.0f, GetButtonByID(last_added)->layer()->opacity()); | 1030 EXPECT_EQ(1.0f, GetButtonByID(last_added)->layer()->opacity()); |
| 1040 EXPECT_FALSE(test_api_->IsOverflowButtonVisible()); | 1031 EXPECT_FALSE(test_api_->IsOverflowButtonVisible()); |
| 1041 } | 1032 } |
| 1042 | 1033 |
| 1043 // Verifies that remove last overflowed button should hide overflow chevron. | 1034 // Verifies that remove last overflowed button should hide overflow chevron. |
| 1044 TEST_F(ShelfViewTest, RemoveLastOverflowed) { | 1035 TEST_F(ShelfViewTest, RemoveLastOverflowed) { |
| 1045 // All buttons should be visible. | 1036 // All buttons should be visible. |
| 1046 ASSERT_EQ(test_api_->GetButtonCount(), test_api_->GetLastVisibleIndex() + 1); | 1037 ASSERT_EQ(test_api_->GetButtonCount(), test_api_->GetLastVisibleIndex() + 1); |
| 1047 | 1038 |
| 1048 // Add platform app button until overflow. | 1039 // Add platform app button until overflow. |
| 1049 int items_added = 0; | 1040 int items_added = 0; |
| 1050 ShelfID last_added = AddPlatformApp(); | 1041 ShelfID last_added = AddApp(); |
| 1051 while (!test_api_->IsOverflowButtonVisible()) { | 1042 while (!test_api_->IsOverflowButtonVisible()) { |
| 1052 last_added = AddPlatformApp(); | 1043 last_added = AddApp(); |
| 1053 ++items_added; | 1044 ++items_added; |
| 1054 ASSERT_LT(items_added, 10000); | 1045 ASSERT_LT(items_added, 10000); |
| 1055 } | 1046 } |
| 1056 | 1047 |
| 1057 RemoveByID(last_added); | 1048 RemoveByID(last_added); |
| 1058 EXPECT_FALSE(test_api_->IsOverflowButtonVisible()); | 1049 EXPECT_FALSE(test_api_->IsOverflowButtonVisible()); |
| 1059 } | 1050 } |
| 1060 | 1051 |
| 1061 // Adds platform app button without waiting for animation to finish and verifies | 1052 // Adds platform app button without waiting for animation to finish and verifies |
| 1062 // that all added buttons are visible. | 1053 // that all added buttons are visible. |
| 1063 TEST_F(ShelfViewTest, AddButtonQuickly) { | 1054 TEST_F(ShelfViewTest, AddButtonQuickly) { |
| 1064 // All buttons should be visible. | 1055 // All buttons should be visible. |
| 1065 ASSERT_EQ(test_api_->GetButtonCount(), test_api_->GetLastVisibleIndex() + 1); | 1056 ASSERT_EQ(test_api_->GetButtonCount(), test_api_->GetLastVisibleIndex() + 1); |
| 1066 | 1057 |
| 1067 // Add a few platform buttons quickly without wait for animation. | 1058 // Add a few platform buttons quickly without wait for animation. |
| 1068 int added_count = 0; | 1059 int added_count = 0; |
| 1069 while (!test_api_->IsOverflowButtonVisible()) { | 1060 while (!test_api_->IsOverflowButtonVisible()) { |
| 1070 AddPlatformAppNoWait(); | 1061 AddAppNoWait(); |
| 1071 ++added_count; | 1062 ++added_count; |
| 1072 ASSERT_LT(added_count, 10000); | 1063 ASSERT_LT(added_count, 10000); |
| 1073 } | 1064 } |
| 1074 | 1065 |
| 1075 // ShelfView should be big enough to hold at least 3 new buttons. | 1066 // ShelfView should be big enough to hold at least 3 new buttons. |
| 1076 ASSERT_GE(added_count, 3); | 1067 ASSERT_GE(added_count, 3); |
| 1077 | 1068 |
| 1078 // Wait for the last animation to finish. | 1069 // Wait for the last animation to finish. |
| 1079 test_api_->RunMessageLoopUntilAnimationsDone(); | 1070 test_api_->RunMessageLoopUntilAnimationsDone(); |
| 1080 | 1071 |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1278 | 1269 |
| 1279 EXPECT_TRUE(selection_tracker->WasSelected()); | 1270 EXPECT_TRUE(selection_tracker->WasSelected()); |
| 1280 } | 1271 } |
| 1281 | 1272 |
| 1282 // Confirm that item status changes are reflected in the buttons. | 1273 // Confirm that item status changes are reflected in the buttons. |
| 1283 TEST_F(ShelfViewTest, ShelfItemStatus) { | 1274 TEST_F(ShelfViewTest, ShelfItemStatus) { |
| 1284 // All buttons should be visible. | 1275 // All buttons should be visible. |
| 1285 ASSERT_EQ(test_api_->GetButtonCount(), test_api_->GetLastVisibleIndex() + 1); | 1276 ASSERT_EQ(test_api_->GetButtonCount(), test_api_->GetLastVisibleIndex() + 1); |
| 1286 | 1277 |
| 1287 // Add platform app button. | 1278 // Add platform app button. |
| 1288 ShelfID last_added = AddPlatformApp(); | 1279 ShelfID last_added = AddApp(); |
| 1289 ShelfItem item = GetItemByID(last_added); | 1280 ShelfItem item = GetItemByID(last_added); |
| 1290 int index = model_->ItemIndexByID(last_added); | 1281 int index = model_->ItemIndexByID(last_added); |
| 1291 ShelfButton* button = GetButtonByID(last_added); | 1282 ShelfButton* button = GetButtonByID(last_added); |
| 1292 ASSERT_EQ(ShelfButton::STATE_RUNNING, button->state()); | 1283 ASSERT_EQ(ShelfButton::STATE_RUNNING, button->state()); |
| 1293 item.status = STATUS_ACTIVE; | 1284 item.status = STATUS_ACTIVE; |
| 1294 model_->Set(index, item); | 1285 model_->Set(index, item); |
| 1295 ASSERT_EQ(ShelfButton::STATE_ACTIVE, button->state()); | 1286 ASSERT_EQ(ShelfButton::STATE_ACTIVE, button->state()); |
| 1296 item.status = STATUS_ATTENTION; | 1287 item.status = STATUS_ATTENTION; |
| 1297 model_->Set(index, item); | 1288 model_->Set(index, item); |
| 1298 ASSERT_EQ(ShelfButton::STATE_ATTENTION, button->state()); | 1289 ASSERT_EQ(ShelfButton::STATE_ATTENTION, button->state()); |
| 1299 } | 1290 } |
| 1300 | 1291 |
| 1301 // Confirm that item status changes are reflected in the buttons | 1292 // Confirm that item status changes are reflected in the buttons |
| 1302 // for platform apps. | 1293 // for platform apps. |
| 1303 TEST_F(ShelfViewTest, ShelfItemStatusPlatformApp) { | 1294 TEST_F(ShelfViewTest, ShelfItemStatusPlatformApp) { |
| 1304 // All buttons should be visible. | 1295 // All buttons should be visible. |
| 1305 ASSERT_EQ(test_api_->GetButtonCount(), test_api_->GetLastVisibleIndex() + 1); | 1296 ASSERT_EQ(test_api_->GetButtonCount(), test_api_->GetLastVisibleIndex() + 1); |
| 1306 | 1297 |
| 1307 // Add platform app button. | 1298 // Add platform app button. |
| 1308 ShelfID last_added = AddPlatformApp(); | 1299 ShelfID last_added = AddApp(); |
| 1309 ShelfItem item = GetItemByID(last_added); | 1300 ShelfItem item = GetItemByID(last_added); |
| 1310 int index = model_->ItemIndexByID(last_added); | 1301 int index = model_->ItemIndexByID(last_added); |
| 1311 ShelfButton* button = GetButtonByID(last_added); | 1302 ShelfButton* button = GetButtonByID(last_added); |
| 1312 ASSERT_EQ(ShelfButton::STATE_RUNNING, button->state()); | 1303 ASSERT_EQ(ShelfButton::STATE_RUNNING, button->state()); |
| 1313 item.status = STATUS_ACTIVE; | 1304 item.status = STATUS_ACTIVE; |
| 1314 model_->Set(index, item); | 1305 model_->Set(index, item); |
| 1315 ASSERT_EQ(ShelfButton::STATE_ACTIVE, button->state()); | 1306 ASSERT_EQ(ShelfButton::STATE_ACTIVE, button->state()); |
| 1316 item.status = STATUS_ATTENTION; | 1307 item.status = STATUS_ATTENTION; |
| 1317 model_->Set(index, item); | 1308 model_->Set(index, item); |
| 1318 ASSERT_EQ(ShelfButton::STATE_ATTENTION, button->state()); | 1309 ASSERT_EQ(ShelfButton::STATE_ATTENTION, button->state()); |
| 1319 } | 1310 } |
| 1320 | 1311 |
| 1321 // Confirm that shelf item bounds are correctly updated on shelf changes. | 1312 // Confirm that shelf item bounds are correctly updated on shelf changes. |
| 1322 TEST_F(ShelfViewTest, ShelfItemBoundsCheck) { | 1313 TEST_F(ShelfViewTest, ShelfItemBoundsCheck) { |
| 1323 VerifyShelfItemBoundsAreValid(); | 1314 VerifyShelfItemBoundsAreValid(); |
| 1324 shelf_view_->wm_shelf()->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 1315 shelf_view_->wm_shelf()->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
| 1325 test_api_->RunMessageLoopUntilAnimationsDone(); | 1316 test_api_->RunMessageLoopUntilAnimationsDone(); |
| 1326 VerifyShelfItemBoundsAreValid(); | 1317 VerifyShelfItemBoundsAreValid(); |
| 1327 shelf_view_->wm_shelf()->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | 1318 shelf_view_->wm_shelf()->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
| 1328 test_api_->RunMessageLoopUntilAnimationsDone(); | 1319 test_api_->RunMessageLoopUntilAnimationsDone(); |
| 1329 VerifyShelfItemBoundsAreValid(); | 1320 VerifyShelfItemBoundsAreValid(); |
| 1330 } | 1321 } |
| 1331 | 1322 |
| 1332 TEST_F(ShelfViewTest, ShelfTooltipTest) { | 1323 TEST_F(ShelfViewTest, ShelfTooltipTest) { |
| 1333 ASSERT_EQ(test_api_->GetLastVisibleIndex() + 1, test_api_->GetButtonCount()); | 1324 ASSERT_EQ(test_api_->GetLastVisibleIndex() + 1, test_api_->GetButtonCount()); |
| 1334 | 1325 |
| 1335 // Prepare some items to the shelf. | 1326 // Prepare some items to the shelf. |
| 1336 ShelfID app_button_id = AddAppShortcut(); | 1327 ShelfID app_button_id = AddAppShortcut(); |
| 1337 ShelfID platform_button_id = AddPlatformApp(); | 1328 ShelfID platform_button_id = AddApp(); |
| 1338 | 1329 |
| 1339 ShelfButton* app_button = GetButtonByID(app_button_id); | 1330 ShelfButton* app_button = GetButtonByID(app_button_id); |
| 1340 ShelfButton* platform_button = GetButtonByID(platform_button_id); | 1331 ShelfButton* platform_button = GetButtonByID(platform_button_id); |
| 1341 | 1332 |
| 1342 ShelfTooltipManager* tooltip_manager = test_api_->tooltip_manager(); | 1333 ShelfTooltipManager* tooltip_manager = test_api_->tooltip_manager(); |
| 1343 EXPECT_TRUE(test_api_->shelf_view()->GetWidget()->GetNativeWindow()); | 1334 EXPECT_TRUE(test_api_->shelf_view()->GetWidget()->GetNativeWindow()); |
| 1344 ui::test::EventGenerator& generator = GetEventGenerator(); | 1335 ui::test::EventGenerator& generator = GetEventGenerator(); |
| 1345 | 1336 |
| 1346 generator.MoveMouseTo(app_button->GetBoundsInScreen().CenterPoint()); | 1337 generator.MoveMouseTo(app_button->GetBoundsInScreen().CenterPoint()); |
| 1347 // There's a delay to show the tooltip, so it's not visible yet. | 1338 // There's a delay to show the tooltip, so it's not visible yet. |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1409 tooltip_manager->ShowTooltip(app_button); | 1400 tooltip_manager->ShowTooltip(app_button); |
| 1410 EXPECT_TRUE(tooltip_manager->IsVisible()); | 1401 EXPECT_TRUE(tooltip_manager->IsVisible()); |
| 1411 | 1402 |
| 1412 // Changing shelf alignment hides the tooltip. | 1403 // Changing shelf alignment hides the tooltip. |
| 1413 GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_LEFT); | 1404 GetPrimaryShelf()->SetAlignment(SHELF_ALIGNMENT_LEFT); |
| 1414 EXPECT_FALSE(tooltip_manager->IsVisible()); | 1405 EXPECT_FALSE(tooltip_manager->IsVisible()); |
| 1415 } | 1406 } |
| 1416 | 1407 |
| 1417 TEST_F(ShelfViewTest, ShouldHideTooltipTest) { | 1408 TEST_F(ShelfViewTest, ShouldHideTooltipTest) { |
| 1418 ShelfID app_button_id = AddAppShortcut(); | 1409 ShelfID app_button_id = AddAppShortcut(); |
| 1419 ShelfID platform_button_id = AddPlatformApp(); | 1410 ShelfID platform_button_id = AddApp(); |
| 1420 | 1411 |
| 1421 // The tooltip shouldn't hide if the mouse is on normal buttons. | 1412 // The tooltip shouldn't hide if the mouse is on normal buttons. |
| 1422 for (int i = 0; i < test_api_->GetButtonCount(); i++) { | 1413 for (int i = 0; i < test_api_->GetButtonCount(); i++) { |
| 1423 ShelfButton* button = test_api_->GetButton(i); | 1414 ShelfButton* button = test_api_->GetButton(i); |
| 1424 if (!button) | 1415 if (!button) |
| 1425 continue; | 1416 continue; |
| 1426 | 1417 |
| 1427 EXPECT_FALSE(shelf_view_->ShouldHideTooltip( | 1418 EXPECT_FALSE(shelf_view_->ShouldHideTooltip( |
| 1428 button->GetMirroredBounds().CenterPoint())) | 1419 button->GetMirroredBounds().CenterPoint())) |
| 1429 << "ShelfView tries to hide on button " << i; | 1420 << "ShelfView tries to hide on button " << i; |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1529 // Resizing shelf view while an add animation without fade-in is running, | 1520 // Resizing shelf view while an add animation without fade-in is running, |
| 1530 // which happens when overflow happens. App list button should end up in its | 1521 // which happens when overflow happens. App list button should end up in its |
| 1531 // new ideal bounds. | 1522 // new ideal bounds. |
| 1532 TEST_F(ShelfViewTest, ResizeDuringOverflowAddAnimation) { | 1523 TEST_F(ShelfViewTest, ResizeDuringOverflowAddAnimation) { |
| 1533 // All buttons should be visible. | 1524 // All buttons should be visible. |
| 1534 ASSERT_EQ(test_api_->GetButtonCount(), test_api_->GetLastVisibleIndex() + 1); | 1525 ASSERT_EQ(test_api_->GetButtonCount(), test_api_->GetLastVisibleIndex() + 1); |
| 1535 | 1526 |
| 1536 // Add buttons until overflow. Let the non-overflow add animations finish but | 1527 // Add buttons until overflow. Let the non-overflow add animations finish but |
| 1537 // leave the last running. | 1528 // leave the last running. |
| 1538 int items_added = 0; | 1529 int items_added = 0; |
| 1539 AddPlatformAppNoWait(); | 1530 AddAppNoWait(); |
| 1540 while (!test_api_->IsOverflowButtonVisible()) { | 1531 while (!test_api_->IsOverflowButtonVisible()) { |
| 1541 test_api_->RunMessageLoopUntilAnimationsDone(); | 1532 test_api_->RunMessageLoopUntilAnimationsDone(); |
| 1542 AddPlatformAppNoWait(); | 1533 AddAppNoWait(); |
| 1543 ++items_added; | 1534 ++items_added; |
| 1544 ASSERT_LT(items_added, 10000); | 1535 ASSERT_LT(items_added, 10000); |
| 1545 } | 1536 } |
| 1546 | 1537 |
| 1547 // Resize shelf view with that animation running and stay overflown. | 1538 // Resize shelf view with that animation running and stay overflown. |
| 1548 gfx::Rect bounds = shelf_view_->bounds(); | 1539 gfx::Rect bounds = shelf_view_->bounds(); |
| 1549 bounds.set_width(bounds.width() - GetShelfConstant(SHELF_SIZE)); | 1540 bounds.set_width(bounds.width() - GetShelfConstant(SHELF_SIZE)); |
| 1550 shelf_view_->SetBoundsRect(bounds); | 1541 shelf_view_->SetBoundsRect(bounds); |
| 1551 ASSERT_TRUE(test_api_->IsOverflowButtonVisible()); | 1542 ASSERT_TRUE(test_api_->IsOverflowButtonVisible()); |
| 1552 | 1543 |
| (...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1785 TestDraggingAnItemFromOverflowToShelf(false); | 1776 TestDraggingAnItemFromOverflowToShelf(false); |
| 1786 TestDraggingAnItemFromOverflowToShelf(true); | 1777 TestDraggingAnItemFromOverflowToShelf(true); |
| 1787 } | 1778 } |
| 1788 | 1779 |
| 1789 // Checks creating app shortcut for an opened platform app in overflow bubble | 1780 // Checks creating app shortcut for an opened platform app in overflow bubble |
| 1790 // should be invisible to the shelf. See crbug.com/605793. | 1781 // should be invisible to the shelf. See crbug.com/605793. |
| 1791 TEST_F(ShelfViewTest, CheckOverflowStatusPinOpenedAppToShelf) { | 1782 TEST_F(ShelfViewTest, CheckOverflowStatusPinOpenedAppToShelf) { |
| 1792 AddButtonsUntilOverflow(); | 1783 AddButtonsUntilOverflow(); |
| 1793 | 1784 |
| 1794 // Add a running Platform app. | 1785 // Add a running Platform app. |
| 1795 ShelfID platform_app_id = AddPlatformApp(); | 1786 ShelfID platform_app_id = AddApp(); |
| 1796 EXPECT_FALSE(GetButtonByID(platform_app_id)->visible()); | 1787 EXPECT_FALSE(GetButtonByID(platform_app_id)->visible()); |
| 1797 | 1788 |
| 1798 // Make the added running platform app to be an app shortcut. | 1789 // Make the added running platform app to be an app shortcut. |
| 1799 // This app shortcut should be a swapped view in overflow bubble, which is | 1790 // This app shortcut should be a swapped view in overflow bubble, which is |
| 1800 // invisible. | 1791 // invisible. |
| 1801 SetShelfItemTypeToAppShortcut(platform_app_id); | 1792 SetShelfItemTypeToAppShortcut(platform_app_id); |
| 1802 EXPECT_FALSE(GetButtonByID(platform_app_id)->visible()); | 1793 EXPECT_FALSE(GetButtonByID(platform_app_id)->visible()); |
| 1803 } | 1794 } |
| 1804 | 1795 |
| 1805 // Tests that the AppListButton renders as active in response to touches. | 1796 // Tests that the AppListButton renders as active in response to touches. |
| (...skipping 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3160 IsEmpty()); | 3151 IsEmpty()); |
| 3161 | 3152 |
| 3162 ASSERT_TRUE(test_api_->IsShowingOverflowBubble()); | 3153 ASSERT_TRUE(test_api_->IsShowingOverflowBubble()); |
| 3163 } | 3154 } |
| 3164 } | 3155 } |
| 3165 | 3156 |
| 3166 #endif // !defined(OS_WIN) | 3157 #endif // !defined(OS_WIN) |
| 3167 | 3158 |
| 3168 } // namespace test | 3159 } // namespace test |
| 3169 } // namespace ash | 3160 } // namespace ash |
| OLD | NEW |