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

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

Issue 229453005: Shelf Cleanup AlternateShelfLayout P1 Attempt 3 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 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 | Annotate | Revision Log
« no previous file with comments | « ash/shelf/shelf_view.cc ('k') | ash/system/chromeos/session/logout_button_tray.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 252 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 virtual ~ShelfViewTest() {} 263 virtual ~ShelfViewTest() {}
264 264
265 virtual void SetUp() OVERRIDE { 265 virtual void SetUp() OVERRIDE {
266 AshTestBase::SetUp(); 266 AshTestBase::SetUp();
267 test::ShellTestApi test_api(Shell::GetInstance()); 267 test::ShellTestApi test_api(Shell::GetInstance());
268 model_ = test_api.shelf_model(); 268 model_ = test_api.shelf_model();
269 Shelf* shelf = Shelf::ForPrimaryDisplay(); 269 Shelf* shelf = Shelf::ForPrimaryDisplay();
270 shelf_view_ = ShelfTestAPI(shelf).shelf_view(); 270 shelf_view_ = ShelfTestAPI(shelf).shelf_view();
271 271
272 // The bounds should be big enough for 4 buttons + overflow chevron. 272 // The bounds should be big enough for 4 buttons + overflow chevron.
273 shelf_view_->SetBounds( 273 shelf_view_->SetBounds(0, 0, 500, kShelfSize);
274 0, 0, 500, ShelfLayoutManager::GetPreferredShelfSize());
275 274
276 test_api_.reset(new ShelfViewTestAPI(shelf_view_)); 275 test_api_.reset(new ShelfViewTestAPI(shelf_view_));
277 test_api_->SetAnimationDuration(1); // Speeds up animation for test. 276 test_api_->SetAnimationDuration(1); // Speeds up animation for test.
278 277
279 item_manager_ = Shell::GetInstance()->shelf_item_delegate_manager(); 278 item_manager_ = Shell::GetInstance()->shelf_item_delegate_manager();
280 DCHECK(item_manager_); 279 DCHECK(item_manager_);
281 280
282 // Add browser shortcut shelf item at index 0 for test. 281 // Add browser shortcut shelf item at index 0 for test.
283 AddBrowserShortcut(); 282 AddBrowserShortcut();
284 } 283 }
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 ShelfView* shelf_view_; 570 ShelfView* shelf_view_;
572 int browser_index_; 571 int browser_index_;
573 ShelfItemDelegateManager* item_manager_; 572 ShelfItemDelegateManager* item_manager_;
574 573
575 scoped_ptr<ShelfViewTestAPI> test_api_; 574 scoped_ptr<ShelfViewTestAPI> test_api_;
576 575
577 private: 576 private:
578 DISALLOW_COPY_AND_ASSIGN(ShelfViewTest); 577 DISALLOW_COPY_AND_ASSIGN(ShelfViewTest);
579 }; 578 };
580 579
581 class ShelfViewLegacyShelfLayoutTest : public ShelfViewTest {
582 public:
583 ShelfViewLegacyShelfLayoutTest() : ShelfViewTest() {
584 browser_index_ = 0;
585 }
586
587 virtual ~ShelfViewLegacyShelfLayoutTest() {}
588
589 virtual void SetUp() OVERRIDE {
590 CommandLine::ForCurrentProcess()->AppendSwitch(
591 ash::switches::kAshDisableAlternateShelfLayout);
592 ShelfViewTest::SetUp();
593 }
594
595 private:
596 DISALLOW_COPY_AND_ASSIGN(ShelfViewLegacyShelfLayoutTest);
597 };
598
599 class ScopedTextDirectionChange { 580 class ScopedTextDirectionChange {
600 public: 581 public:
601 ScopedTextDirectionChange(bool is_rtl) 582 ScopedTextDirectionChange(bool is_rtl)
602 : is_rtl_(is_rtl) { 583 : is_rtl_(is_rtl) {
603 original_locale_ = l10n_util::GetApplicationLocale(std::string()); 584 original_locale_ = l10n_util::GetApplicationLocale(std::string());
604 if (is_rtl_) 585 if (is_rtl_)
605 base::i18n::SetICUDefaultLocale("he"); 586 base::i18n::SetICUDefaultLocale("he");
606 CheckTextDirectionIsCorrect(); 587 CheckTextDirectionIsCorrect();
607 } 588 }
608 589
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
734 715
735 last_added = AddAppShortcut(); 716 last_added = AddAppShortcut();
736 ++items_added; 717 ++items_added;
737 ASSERT_LT(items_added, 10000); 718 ASSERT_LT(items_added, 10000);
738 } 719 }
739 720
740 // And the platform app button is invisible. 721 // And the platform app button is invisible.
741 EXPECT_FALSE(GetButtonByID(browser_button_id)->visible()); 722 EXPECT_FALSE(GetButtonByID(browser_button_id)->visible());
742 } 723 }
743 724
744 TEST_F(ShelfViewLegacyShelfLayoutTest,
745 AddAppShortcutWithBrowserButtonUntilOverflow) {
746 // All buttons should be visible.
747 ASSERT_EQ(test_api_->GetButtonCount(),
748 test_api_->GetLastVisibleIndex() + 1);
749
750
751 ShelfID browser_button_id = AddPlatformApp();
752
753 // Add app shortcut until overflow.
754 int items_added = 0;
755 ShelfID last_added = AddAppShortcut();
756 while (!test_api_->IsOverflowButtonVisible()) {
757 // Added button is visible after animation while in this loop.
758 EXPECT_TRUE(GetButtonByID(last_added)->visible());
759
760 last_added = AddAppShortcut();
761 ++items_added;
762 ASSERT_LT(items_added, 10000);
763 }
764
765 // The last added app short button should be visible.
766 EXPECT_TRUE(GetButtonByID(last_added)->visible());
767 // And the platform app button is invisible.
768 EXPECT_FALSE(GetButtonByID(browser_button_id)->visible());
769 }
770
771 TEST_F(ShelfViewTest, AddPanelHidesPlatformAppButton) { 725 TEST_F(ShelfViewTest, AddPanelHidesPlatformAppButton) {
772 // All buttons should be visible. 726 // All buttons should be visible.
773 ASSERT_EQ(test_api_->GetButtonCount(), 727 ASSERT_EQ(test_api_->GetButtonCount(),
774 test_api_->GetLastVisibleIndex() + 1); 728 test_api_->GetLastVisibleIndex() + 1);
775 729
776 // Add platform app button until overflow, remember last visible platform app 730 // Add platform app button until overflow, remember last visible platform app
777 // button. 731 // button.
778 int items_added = 0; 732 int items_added = 0;
779 ShelfID first_added = AddPlatformApp(); 733 ShelfID first_added = AddPlatformApp();
780 EXPECT_TRUE(GetButtonByID(first_added)->visible()); 734 EXPECT_TRUE(GetButtonByID(first_added)->visible());
781 while (true) { 735 while (true) {
782 ShelfID added = AddPlatformApp(); 736 ShelfID added = AddPlatformApp();
783 if (test_api_->IsOverflowButtonVisible()) { 737 if (test_api_->IsOverflowButtonVisible()) {
784 EXPECT_FALSE(GetButtonByID(added)->visible()); 738 EXPECT_FALSE(GetButtonByID(added)->visible());
785 RemoveByID(added); 739 RemoveByID(added);
786 break; 740 break;
787 } 741 }
788 ++items_added; 742 ++items_added;
789 ASSERT_LT(items_added, 10000); 743 ASSERT_LT(items_added, 10000);
790 } 744 }
791 745
792 ShelfID panel = AddPanel(); 746 ShelfID panel = AddPanel();
793 EXPECT_TRUE(test_api_->IsOverflowButtonVisible()); 747 EXPECT_TRUE(test_api_->IsOverflowButtonVisible());
794 748
795 RemoveByID(panel); 749 RemoveByID(panel);
796 EXPECT_FALSE(test_api_->IsOverflowButtonVisible()); 750 EXPECT_FALSE(test_api_->IsOverflowButtonVisible());
797 } 751 }
798 752
799 TEST_F(ShelfViewLegacyShelfLayoutTest, AddPanelHidesPlatformAppButton) {
800 // All buttons should be visible.
801 ASSERT_EQ(test_api_->GetButtonCount(),
802 test_api_->GetLastVisibleIndex() + 1);
803
804 // Add platform app button until overflow, remember last visible platform app
805 // button.
806 int items_added = 0;
807 ShelfID first_added = AddPlatformApp();
808 EXPECT_TRUE(GetButtonByID(first_added)->visible());
809 ShelfID last_visible = first_added;
810 while (true) {
811 ShelfID added = AddPlatformApp();
812 if (test_api_->IsOverflowButtonVisible()) {
813 EXPECT_FALSE(GetButtonByID(added)->visible());
814 break;
815 }
816 last_visible = added;
817 ++items_added;
818 ASSERT_LT(items_added, 10000);
819 }
820
821 ShelfID panel = AddPanel();
822 EXPECT_TRUE(GetButtonByID(panel)->visible());
823 EXPECT_FALSE(GetButtonByID(last_visible)->visible());
824
825 RemoveByID(panel);
826 EXPECT_TRUE(GetButtonByID(last_visible)->visible());
827 }
828
829 // When there are more panels then platform app buttons we should hide panels 753 // When there are more panels then platform app buttons we should hide panels
830 // rather than platform apps. 754 // rather than platform apps.
831 TEST_F(ShelfViewTest, PlatformAppHidesExcessPanels) { 755 TEST_F(ShelfViewTest, PlatformAppHidesExcessPanels) {
832 // All buttons should be visible. 756 // All buttons should be visible.
833 ASSERT_EQ(test_api_->GetButtonCount(), 757 ASSERT_EQ(test_api_->GetButtonCount(),
834 test_api_->GetLastVisibleIndex() + 1); 758 test_api_->GetLastVisibleIndex() + 1);
835 759
836 // Add platform app button. 760 // Add platform app button.
837 ShelfID platform_app = AddPlatformApp(); 761 ShelfID platform_app = AddPlatformApp();
838 ShelfID first_panel = AddPanel(); 762 ShelfID first_panel = AddPanel();
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
1005 // the order. 929 // the order.
1006 dragged_button = SimulateDrag(ShelfButtonHost::MOUSE, 1, 3); 930 dragged_button = SimulateDrag(ShelfButtonHost::MOUSE, 1, 3);
1007 new_id = AddPanel(); 931 new_id = AddPanel();
1008 id_map.insert(id_map.begin() + 7, 932 id_map.insert(id_map.begin() + 7,
1009 std::make_pair(new_id, GetButtonByID(new_id))); 933 std::make_pair(new_id, GetButtonByID(new_id)));
1010 ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map)); 934 ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
1011 button_host->PointerReleasedOnButton( 935 button_host->PointerReleasedOnButton(
1012 dragged_button, ShelfButtonHost::MOUSE, false); 936 dragged_button, ShelfButtonHost::MOUSE, false);
1013 } 937 }
1014 938
1015 TEST_F(ShelfViewLegacyShelfLayoutTest, ModelChangesWhileDragging) {
1016 ShelfButtonHost* button_host = shelf_view_;
1017
1018 std::vector<std::pair<ShelfID, views::View*> > id_map;
1019 SetupForDragTest(&id_map);
1020
1021 // Dragging browser shortcut at index 0.
1022 EXPECT_TRUE(model_->items()[0].type == TYPE_BROWSER_SHORTCUT);
1023 views::View* dragged_button = SimulateDrag(ShelfButtonHost::MOUSE, 0, 2);
1024 std::rotate(id_map.begin(),
1025 id_map.begin() + 1,
1026 id_map.begin() + 3);
1027 ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
1028 button_host->PointerReleasedOnButton(
1029 dragged_button, ShelfButtonHost::MOUSE, false);
1030 EXPECT_TRUE(model_->items()[2].type == TYPE_BROWSER_SHORTCUT);
1031
1032 // Dragging changes model order.
1033 dragged_button = SimulateDrag(ShelfButtonHost::MOUSE, 0, 2);
1034 std::rotate(id_map.begin(),
1035 id_map.begin() + 1,
1036 id_map.begin() + 3);
1037 ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
1038
1039 // Cancelling the drag operation restores previous order.
1040 button_host->PointerReleasedOnButton(
1041 dragged_button, ShelfButtonHost::MOUSE, true);
1042 std::rotate(id_map.begin(),
1043 id_map.begin() + 2,
1044 id_map.begin() + 3);
1045 ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
1046
1047 // Deleting an item keeps the remaining intact.
1048 dragged_button = SimulateDrag(ShelfButtonHost::MOUSE, 0, 2);
1049 model_->RemoveItemAt(1);
1050 id_map.erase(id_map.begin() + 1);
1051 ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
1052 button_host->PointerReleasedOnButton(
1053 dragged_button, ShelfButtonHost::MOUSE, false);
1054
1055 // Adding a shelf item cancels the drag and respects the order.
1056 dragged_button = SimulateDrag(ShelfButtonHost::MOUSE, 0, 2);
1057 ShelfID new_id = AddAppShortcut();
1058 id_map.insert(id_map.begin() + 5,
1059 std::make_pair(new_id, GetButtonByID(new_id)));
1060 ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
1061 button_host->PointerReleasedOnButton(
1062 dragged_button, ShelfButtonHost::MOUSE, false);
1063
1064 // Adding a shelf item at the end (i.e. a panel) canels drag and respects
1065 // the order.
1066 dragged_button = SimulateDrag(ShelfButtonHost::MOUSE, 0, 2);
1067 new_id = AddPanel();
1068 id_map.insert(id_map.begin() + 7,
1069 std::make_pair(new_id, GetButtonByID(new_id)));
1070 ASSERT_NO_FATAL_FAILURE(CheckModelIDs(id_map));
1071 button_host->PointerReleasedOnButton(
1072 dragged_button, ShelfButtonHost::MOUSE, false);
1073 }
1074
1075 // Check that 2nd drag from the other pointer would be ignored. 939 // Check that 2nd drag from the other pointer would be ignored.
1076 TEST_F(ShelfViewTest, SimultaneousDrag) { 940 TEST_F(ShelfViewTest, SimultaneousDrag) {
1077 ShelfButtonHost* button_host = shelf_view_; 941 ShelfButtonHost* button_host = shelf_view_;
1078 942
1079 std::vector<std::pair<ShelfID, views::View*> > id_map; 943 std::vector<std::pair<ShelfID, views::View*> > id_map;
1080 SetupForDragTest(&id_map); 944 SetupForDragTest(&id_map);
1081 945
1082 // Start a mouse drag. 946 // Start a mouse drag.
1083 views::View* dragged_button_mouse = 947 views::View* dragged_button_mouse =
1084 SimulateDrag(ShelfButtonHost::MOUSE, 1, 3); 948 SimulateDrag(ShelfButtonHost::MOUSE, 1, 3);
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1152 ShelfButton* button = GetButtonByID(last_added); 1016 ShelfButton* button = GetButtonByID(last_added);
1153 ASSERT_EQ(ShelfButton::STATE_RUNNING, button->state()); 1017 ASSERT_EQ(ShelfButton::STATE_RUNNING, button->state());
1154 item.status = STATUS_ACTIVE; 1018 item.status = STATUS_ACTIVE;
1155 model_->Set(index, item); 1019 model_->Set(index, item);
1156 ASSERT_EQ(ShelfButton::STATE_ACTIVE, button->state()); 1020 ASSERT_EQ(ShelfButton::STATE_ACTIVE, button->state());
1157 item.status = STATUS_ATTENTION; 1021 item.status = STATUS_ATTENTION;
1158 model_->Set(index, item); 1022 model_->Set(index, item);
1159 ASSERT_EQ(ShelfButton::STATE_ATTENTION, button->state()); 1023 ASSERT_EQ(ShelfButton::STATE_ATTENTION, button->state());
1160 } 1024 }
1161 1025
1162 TEST_F(ShelfViewLegacyShelfLayoutTest,
1163 ShelfItemPositionReflectedOnStateChanged) {
1164 // All buttons should be visible.
1165 ASSERT_EQ(test_api_->GetButtonCount(),
1166 test_api_->GetLastVisibleIndex() + 1);
1167
1168 // Add 2 items to the shelf.
1169 ShelfID item1_id = AddPlatformApp();
1170 ShelfID item2_id = AddPlatformAppNoWait();
1171 ShelfButton* item1_button = GetButtonByID(item1_id);
1172 ShelfButton* item2_button = GetButtonByID(item2_id);
1173
1174 ShelfButton::State state_mask = static_cast<ShelfButton::State>(
1175 ShelfButton::STATE_NORMAL | ShelfButton::STATE_HOVERED |
1176 ShelfButton::STATE_RUNNING | ShelfButton::STATE_ACTIVE |
1177 ShelfButton::STATE_ATTENTION | ShelfButton::STATE_FOCUSED);
1178
1179 // Clear the button states.
1180 item1_button->ClearState(state_mask);
1181 item2_button->ClearState(state_mask);
1182
1183 // Since default alignment in tests is bottom, state is reflected in y-axis.
1184 ASSERT_EQ(item1_button->GetIconBounds().y(),
1185 item2_button->GetIconBounds().y());
1186 item1_button->AddState(ShelfButton::STATE_HOVERED);
1187 ASSERT_NE(item1_button->GetIconBounds().y(),
1188 item2_button->GetIconBounds().y());
1189 item1_button->ClearState(ShelfButton::STATE_HOVERED);
1190 }
1191
1192 // Confirm that item status changes are reflected in the buttons 1026 // Confirm that item status changes are reflected in the buttons
1193 // for platform apps. 1027 // for platform apps.
1194 TEST_F(ShelfViewTest, ShelfItemStatusPlatformApp) { 1028 TEST_F(ShelfViewTest, ShelfItemStatusPlatformApp) {
1195 // All buttons should be visible. 1029 // All buttons should be visible.
1196 ASSERT_EQ(test_api_->GetButtonCount(), 1030 ASSERT_EQ(test_api_->GetButtonCount(),
1197 test_api_->GetLastVisibleIndex() + 1); 1031 test_api_->GetLastVisibleIndex() + 1);
1198 1032
1199 // Add platform app button. 1033 // Add platform app button.
1200 ShelfID last_added = AddPlatformApp(); 1034 ShelfID last_added = AddPlatformApp();
1201 ShelfItem item = GetItemByID(last_added); 1035 ShelfItem item = GetItemByID(last_added);
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
1439 AddPlatformAppNoWait(); 1273 AddPlatformAppNoWait();
1440 while (!test_api_->IsOverflowButtonVisible()) { 1274 while (!test_api_->IsOverflowButtonVisible()) {
1441 test_api_->RunMessageLoopUntilAnimationsDone(); 1275 test_api_->RunMessageLoopUntilAnimationsDone();
1442 AddPlatformAppNoWait(); 1276 AddPlatformAppNoWait();
1443 ++items_added; 1277 ++items_added;
1444 ASSERT_LT(items_added, 10000); 1278 ASSERT_LT(items_added, 10000);
1445 } 1279 }
1446 1280
1447 // Resize shelf view with that animation running and stay overflown. 1281 // Resize shelf view with that animation running and stay overflown.
1448 gfx::Rect bounds = shelf_view_->bounds(); 1282 gfx::Rect bounds = shelf_view_->bounds();
1449 bounds.set_width(bounds.width() - kShelfPreferredSize); 1283 bounds.set_width(bounds.width() - kShelfSize);
1450 shelf_view_->SetBoundsRect(bounds); 1284 shelf_view_->SetBoundsRect(bounds);
1451 ASSERT_TRUE(test_api_->IsOverflowButtonVisible()); 1285 ASSERT_TRUE(test_api_->IsOverflowButtonVisible());
1452 1286
1453 // Finish the animation. 1287 // Finish the animation.
1454 test_api_->RunMessageLoopUntilAnimationsDone(); 1288 test_api_->RunMessageLoopUntilAnimationsDone();
1455 1289
1456 // App list button should ends up in its new ideal bounds. 1290 // App list button should ends up in its new ideal bounds.
1457 const int app_list_button_index = test_api_->GetButtonCount() - 1; 1291 const int app_list_button_index = test_api_->GetButtonCount() - 1;
1458 const gfx::Rect& app_list_ideal_bounds = 1292 const gfx::Rect& app_list_ideal_bounds =
1459 test_api_->GetIdealBoundsByIndex(app_list_button_index); 1293 test_api_->GetIdealBoundsByIndex(app_list_button_index);
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
1511 test_for_overflow_view.RunMessageLoopUntilAnimationsDone(); 1345 test_for_overflow_view.RunMessageLoopUntilAnimationsDone();
1512 EXPECT_EQ(bubble_size.width(), 1346 EXPECT_EQ(bubble_size.width(),
1513 test_for_overflow_view.GetPreferredSize().width()); 1347 test_for_overflow_view.GetPreferredSize().width());
1514 1348
1515 generator.ReleaseLeftButton(); 1349 generator.ReleaseLeftButton();
1516 test_for_overflow_view.RunMessageLoopUntilAnimationsDone(); 1350 test_for_overflow_view.RunMessageLoopUntilAnimationsDone();
1517 EXPECT_EQ(bubble_size.width(), 1351 EXPECT_EQ(bubble_size.width(),
1518 test_for_overflow_view.GetPreferredSize().width()); 1352 test_for_overflow_view.GetPreferredSize().width());
1519 } 1353 }
1520 1354
1521 // Check that the first item in the list follows Fitt's law by including the
1522 // first pixel and being therefore bigger then the others.
1523 TEST_F(ShelfViewLegacyShelfLayoutTest, CheckFittsLaw) {
1524 // All buttons should be visible.
1525 ASSERT_EQ(test_api_->GetButtonCount(),
1526 test_api_->GetLastVisibleIndex() + 1);
1527 gfx::Rect ideal_bounds_0 = test_api_->GetIdealBoundsByIndex(0);
1528 gfx::Rect ideal_bounds_1 = test_api_->GetIdealBoundsByIndex(1);
1529 EXPECT_GT(ideal_bounds_0.width(), ideal_bounds_1.width());
1530 }
1531
1532 // Check the drag insertion bounds of scrolled overflow bubble. 1355 // Check the drag insertion bounds of scrolled overflow bubble.
1533 TEST_F(ShelfViewTest, CheckDragInsertBoundsOfScrolledOverflowBubble) { 1356 TEST_F(ShelfViewTest, CheckDragInsertBoundsOfScrolledOverflowBubble) {
1534 UpdateDisplay("400x300"); 1357 UpdateDisplay("400x300");
1535 1358
1536 EXPECT_EQ(2, model_->item_count()); 1359 EXPECT_EQ(2, model_->item_count());
1537 1360
1538 AddButtonsUntilOverflow(); 1361 AddButtonsUntilOverflow();
1539 1362
1540 // Show overflow bubble. 1363 // Show overflow bubble.
1541 test_api_->ShowOverflowBubble(); 1364 test_api_->ShowOverflowBubble();
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
1585 // win8-aura doesn't support multiple display. 1408 // win8-aura doesn't support multiple display.
1586 if (!SupportsMultipleDisplays()) 1409 if (!SupportsMultipleDisplays())
1587 return; 1410 return;
1588 1411
1589 UpdateDisplay("800x600,800x600"); 1412 UpdateDisplay("800x600,800x600");
1590 Shelf* secondary_shelf = Shelf::ForWindow(Shell::GetAllRootWindows()[1]); 1413 Shelf* secondary_shelf = Shelf::ForWindow(Shell::GetAllRootWindows()[1]);
1591 ShelfView* shelf_view_for_secondary = 1414 ShelfView* shelf_view_for_secondary =
1592 ShelfTestAPI(secondary_shelf).shelf_view(); 1415 ShelfTestAPI(secondary_shelf).shelf_view();
1593 1416
1594 // The bounds should be big enough for 4 buttons + overflow chevron. 1417 // The bounds should be big enough for 4 buttons + overflow chevron.
1595 shelf_view_for_secondary->SetBounds( 1418 shelf_view_for_secondary->SetBounds(0, 0, 500, kShelfSize);
1596 0, 0, 500, ShelfLayoutManager::GetPreferredShelfSize());
1597 1419
1598 ShelfViewTestAPI test_api_for_secondary(shelf_view_for_secondary); 1420 ShelfViewTestAPI test_api_for_secondary(shelf_view_for_secondary);
1599 // Speeds up animation for test. 1421 // Speeds up animation for test.
1600 test_api_for_secondary.SetAnimationDuration(1); 1422 test_api_for_secondary.SetAnimationDuration(1);
1601 1423
1602 AddButtonsUntilOverflow(); 1424 AddButtonsUntilOverflow();
1603 1425
1604 // Test #1: Test drag insertion bounds of primary shelf. 1426 // Test #1: Test drag insertion bounds of primary shelf.
1605 // Show overflow bubble. 1427 // Show overflow bubble.
1606 test_api_->ShowOverflowBubble(); 1428 test_api_->ShowOverflowBubble();
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
1745 test_api_->RunMessageLoopUntilAnimationsDone(); 1567 test_api_->RunMessageLoopUntilAnimationsDone();
1746 CheckAllItemsAreInBounds(); 1568 CheckAllItemsAreInBounds();
1747 } 1569 }
1748 1570
1749 INSTANTIATE_TEST_CASE_P(LtrRtl, ShelfViewTextDirectionTest, testing::Bool()); 1571 INSTANTIATE_TEST_CASE_P(LtrRtl, ShelfViewTextDirectionTest, testing::Bool());
1750 INSTANTIATE_TEST_CASE_P(VisibleBounds, ShelfViewVisibleBoundsTest, 1572 INSTANTIATE_TEST_CASE_P(VisibleBounds, ShelfViewVisibleBoundsTest,
1751 testing::Bool()); 1573 testing::Bool());
1752 1574
1753 } // namespace test 1575 } // namespace test
1754 } // namespace ash 1576 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_view.cc ('k') | ash/system/chromeos/session/logout_button_tray.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698