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

Unified Diff: ash/shelf/shelf_view_unittest.cc

Issue 2518423003: Combine shelf platform and windowed app types. (Closed)
Patch Set: Refinements and cleanup. Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: ash/shelf/shelf_view_unittest.cc
diff --git a/ash/shelf/shelf_view_unittest.cc b/ash/shelf/shelf_view_unittest.cc
index aa0eee74cc1d5f2445de7fde7d90a1cde273e48d..a1aa9346aad390b5bb0c30ac78dc8c6d23338e61 100644
--- a/ash/shelf/shelf_view_unittest.cc
+++ b/ash/shelf/shelf_view_unittest.cc
@@ -357,9 +357,9 @@ class ShelfViewTest : public AshTestBase {
return id;
}
- ShelfID AddPlatformAppNoWait() {
+ 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.
ShelfItem item;
- item.type = TYPE_PLATFORM_APP;
+ item.type = TYPE_APP;
item.status = STATUS_RUNNING;
ShelfID id = model_->next_id();
@@ -379,8 +379,8 @@ class ShelfViewTest : public AshTestBase {
return id;
}
- ShelfID AddPlatformApp() {
- ShelfID id = AddPlatformAppNoWait();
+ ShelfID AddApp() {
+ ShelfID id = AddAppNoWait();
test_api_->RunMessageLoopUntilAnimationsDone();
return id;
}
@@ -391,7 +391,7 @@ class ShelfViewTest : public AshTestBase {
ShelfItem item = model_->items()[index];
- if (item.type == TYPE_PLATFORM_APP || item.type == TYPE_WINDOWED_APP) {
+ if (item.type == TYPE_APP) {
item.type = TYPE_APP_SHORTCUT;
model_->Set(index, item);
}
@@ -736,7 +736,7 @@ class ShelfViewTextDirectionTest : public ShelfViewTest,
// Checks that the ideal item icon bounds match the view's bounds in the screen
// in both LTR and RTL.
TEST_P(ShelfViewTextDirectionTest, IdealBoundsOfItemIcon) {
- ShelfID id = AddPlatformApp();
+ ShelfID id = AddApp();
ShelfButton* button = GetButtonByID(id);
gfx::Rect item_bounds = button->GetBoundsInScreen();
gfx::Point icon_offset = button->GetIconBounds().origin();
@@ -752,17 +752,17 @@ TEST_P(ShelfViewTextDirectionTest, IdealBoundsOfItemIcon) {
// Check that items in the overflow area are returning the overflow button as
// ideal bounds.
TEST_F(ShelfViewTest, OverflowButtonBounds) {
- ShelfID first_id = AddPlatformApp();
- ShelfID overflow_id = AddPlatformApp();
+ ShelfID first_id = AddApp();
+ ShelfID overflow_id = AddApp();
int items_added = 0;
while (!test_api_->IsOverflowButtonVisible()) {
// Added button is visible after animation while in this loop.
EXPECT_TRUE(GetButtonByID(overflow_id)->visible());
- overflow_id = AddPlatformApp();
+ overflow_id = AddApp();
++items_added;
ASSERT_LT(items_added, 10000);
}
- ShelfID last_id = AddPlatformApp();
+ ShelfID last_id = AddApp();
gfx::Rect first_bounds = shelf_view_->GetIdealBoundsOfItemIcon(first_id);
gfx::Rect overflow_bounds =
@@ -778,32 +778,23 @@ TEST_F(ShelfViewTest, OverflowButtonBounds) {
// Checks that shelf view contents are considered in the correct drag group.
TEST_F(ShelfViewTest, EnforceDragType) {
- EXPECT_TRUE(test_api_->SameDragType(TYPE_PLATFORM_APP, TYPE_PLATFORM_APP));
- EXPECT_FALSE(test_api_->SameDragType(TYPE_PLATFORM_APP, TYPE_APP_SHORTCUT));
- EXPECT_FALSE(
- test_api_->SameDragType(TYPE_PLATFORM_APP, TYPE_BROWSER_SHORTCUT));
- EXPECT_FALSE(test_api_->SameDragType(TYPE_PLATFORM_APP, TYPE_WINDOWED_APP));
- EXPECT_FALSE(test_api_->SameDragType(TYPE_PLATFORM_APP, TYPE_APP_LIST));
- EXPECT_FALSE(test_api_->SameDragType(TYPE_PLATFORM_APP, TYPE_APP_PANEL));
+ EXPECT_TRUE(test_api_->SameDragType(TYPE_APP, TYPE_APP));
+ EXPECT_FALSE(test_api_->SameDragType(TYPE_APP, TYPE_APP_SHORTCUT));
+ EXPECT_FALSE(test_api_->SameDragType(TYPE_APP, TYPE_BROWSER_SHORTCUT));
+ EXPECT_FALSE(test_api_->SameDragType(TYPE_APP, TYPE_APP_LIST));
+ EXPECT_FALSE(test_api_->SameDragType(TYPE_APP, TYPE_APP_PANEL));
EXPECT_TRUE(test_api_->SameDragType(TYPE_APP_SHORTCUT, TYPE_APP_SHORTCUT));
EXPECT_TRUE(
test_api_->SameDragType(TYPE_APP_SHORTCUT, TYPE_BROWSER_SHORTCUT));
- EXPECT_FALSE(test_api_->SameDragType(TYPE_APP_SHORTCUT, TYPE_WINDOWED_APP));
EXPECT_FALSE(test_api_->SameDragType(TYPE_APP_SHORTCUT, TYPE_APP_LIST));
EXPECT_FALSE(test_api_->SameDragType(TYPE_APP_SHORTCUT, TYPE_APP_PANEL));
EXPECT_TRUE(
test_api_->SameDragType(TYPE_BROWSER_SHORTCUT, TYPE_BROWSER_SHORTCUT));
- EXPECT_FALSE(
- test_api_->SameDragType(TYPE_BROWSER_SHORTCUT, TYPE_WINDOWED_APP));
EXPECT_FALSE(test_api_->SameDragType(TYPE_BROWSER_SHORTCUT, TYPE_APP_LIST));
EXPECT_FALSE(test_api_->SameDragType(TYPE_BROWSER_SHORTCUT, TYPE_APP_PANEL));
- EXPECT_TRUE(test_api_->SameDragType(TYPE_WINDOWED_APP, TYPE_WINDOWED_APP));
- EXPECT_FALSE(test_api_->SameDragType(TYPE_WINDOWED_APP, TYPE_APP_LIST));
- EXPECT_FALSE(test_api_->SameDragType(TYPE_WINDOWED_APP, TYPE_APP_PANEL));
-
EXPECT_TRUE(test_api_->SameDragType(TYPE_APP_LIST, TYPE_APP_LIST));
EXPECT_FALSE(test_api_->SameDragType(TYPE_APP_LIST, TYPE_APP_PANEL));
@@ -818,12 +809,12 @@ TEST_F(ShelfViewTest, AddBrowserUntilOverflow) {
// Add platform app button until overflow.
int items_added = 0;
- ShelfID last_added = AddPlatformApp();
+ ShelfID last_added = AddApp();
while (!test_api_->IsOverflowButtonVisible()) {
// Added button is visible after animation while in this loop.
EXPECT_TRUE(GetButtonByID(last_added)->visible());
- last_added = AddPlatformApp();
+ last_added = AddApp();
++items_added;
ASSERT_LT(items_added, 10000);
}
@@ -839,7 +830,7 @@ TEST_F(ShelfViewTest, AddAppShortcutWithBrowserButtonUntilOverflow) {
// All buttons should be visible.
ASSERT_EQ(test_api_->GetButtonCount(), test_api_->GetLastVisibleIndex() + 1);
- ShelfID browser_button_id = AddPlatformApp();
+ ShelfID browser_button_id = AddApp();
// Add app shortcut until overflow.
int items_added = 0;
@@ -864,10 +855,10 @@ TEST_F(ShelfViewTest, AddPanelHidesPlatformAppButton) {
// Add platform app button until overflow, remember last visible platform app
// button.
int items_added = 0;
- ShelfID first_added = AddPlatformApp();
+ ShelfID first_added = AddApp();
EXPECT_TRUE(GetButtonByID(first_added)->visible());
while (true) {
- ShelfID added = AddPlatformApp();
+ ShelfID added = AddApp();
if (test_api_->IsOverflowButtonVisible()) {
EXPECT_FALSE(GetButtonByID(added)->visible());
RemoveByID(added);
@@ -891,7 +882,7 @@ TEST_F(ShelfViewTest, PlatformAppHidesExcessPanels) {
ASSERT_EQ(test_api_->GetButtonCount(), test_api_->GetLastVisibleIndex() + 1);
// Add platform app button.
- ShelfID platform_app = AddPlatformApp();
+ ShelfID platform_app = AddApp();
ShelfID first_panel = AddPanel();
EXPECT_TRUE(GetButtonByID(platform_app)->visible());
@@ -917,7 +908,7 @@ TEST_F(ShelfViewTest, PlatformAppHidesExcessPanels) {
items_added = 0;
while (GetButtonByID(platform_app)->visible() &&
GetButtonByID(last_panel)->visible()) {
- platform_app = AddPlatformApp();
+ platform_app = AddApp();
++items_added;
ASSERT_LT(items_added, 10000);
}
@@ -931,7 +922,7 @@ TEST_F(ShelfViewTest, AssertNoButtonsOverlap) {
std::vector<ShelfID> button_ids;
// Add app icons until the overflow button is visible.
while (!test_api_->IsOverflowButtonVisible()) {
- ShelfID id = AddPlatformApp();
+ ShelfID id = AddApp();
button_ids.push_back(id);
}
ASSERT_LT(button_ids.size(), 10000U);
@@ -1018,10 +1009,10 @@ TEST_F(ShelfViewTest, RemoveButtonRevealsOverflowed) {
// Add platform app buttons until overflow.
int items_added = 0;
- ShelfID first_added = AddPlatformApp();
+ ShelfID first_added = AddApp();
ShelfID last_added = first_added;
while (!test_api_->IsOverflowButtonVisible()) {
- last_added = AddPlatformApp();
+ last_added = AddApp();
++items_added;
ASSERT_LT(items_added, 10000);
}
@@ -1047,9 +1038,9 @@ TEST_F(ShelfViewTest, RemoveLastOverflowed) {
// Add platform app button until overflow.
int items_added = 0;
- ShelfID last_added = AddPlatformApp();
+ ShelfID last_added = AddApp();
while (!test_api_->IsOverflowButtonVisible()) {
- last_added = AddPlatformApp();
+ last_added = AddApp();
++items_added;
ASSERT_LT(items_added, 10000);
}
@@ -1067,7 +1058,7 @@ TEST_F(ShelfViewTest, AddButtonQuickly) {
// Add a few platform buttons quickly without wait for animation.
int added_count = 0;
while (!test_api_->IsOverflowButtonVisible()) {
- AddPlatformAppNoWait();
+ AddAppNoWait();
++added_count;
ASSERT_LT(added_count, 10000);
}
@@ -1285,7 +1276,7 @@ TEST_F(ShelfViewTest, ShelfItemStatus) {
ASSERT_EQ(test_api_->GetButtonCount(), test_api_->GetLastVisibleIndex() + 1);
// Add platform app button.
- ShelfID last_added = AddPlatformApp();
+ ShelfID last_added = AddApp();
ShelfItem item = GetItemByID(last_added);
int index = model_->ItemIndexByID(last_added);
ShelfButton* button = GetButtonByID(last_added);
@@ -1305,7 +1296,7 @@ TEST_F(ShelfViewTest, ShelfItemStatusPlatformApp) {
ASSERT_EQ(test_api_->GetButtonCount(), test_api_->GetLastVisibleIndex() + 1);
// Add platform app button.
- ShelfID last_added = AddPlatformApp();
+ ShelfID last_added = AddApp();
ShelfItem item = GetItemByID(last_added);
int index = model_->ItemIndexByID(last_added);
ShelfButton* button = GetButtonByID(last_added);
@@ -1334,7 +1325,7 @@ TEST_F(ShelfViewTest, ShelfTooltipTest) {
// Prepare some items to the shelf.
ShelfID app_button_id = AddAppShortcut();
- ShelfID platform_button_id = AddPlatformApp();
+ ShelfID platform_button_id = AddApp();
ShelfButton* app_button = GetButtonByID(app_button_id);
ShelfButton* platform_button = GetButtonByID(platform_button_id);
@@ -1416,7 +1407,7 @@ TEST_F(ShelfViewTest, ShelfAlignmentClosesTooltip) {
TEST_F(ShelfViewTest, ShouldHideTooltipTest) {
ShelfID app_button_id = AddAppShortcut();
- ShelfID platform_button_id = AddPlatformApp();
+ ShelfID platform_button_id = AddApp();
// The tooltip shouldn't hide if the mouse is on normal buttons.
for (int i = 0; i < test_api_->GetButtonCount(); i++) {
@@ -1536,10 +1527,10 @@ TEST_F(ShelfViewTest, ResizeDuringOverflowAddAnimation) {
// Add buttons until overflow. Let the non-overflow add animations finish but
// leave the last running.
int items_added = 0;
- AddPlatformAppNoWait();
+ AddAppNoWait();
while (!test_api_->IsOverflowButtonVisible()) {
test_api_->RunMessageLoopUntilAnimationsDone();
- AddPlatformAppNoWait();
+ AddAppNoWait();
++items_added;
ASSERT_LT(items_added, 10000);
}
@@ -1792,7 +1783,7 @@ TEST_F(ShelfViewTest, CheckOverflowStatusPinOpenedAppToShelf) {
AddButtonsUntilOverflow();
// Add a running Platform app.
- ShelfID platform_app_id = AddPlatformApp();
+ ShelfID platform_app_id = AddApp();
EXPECT_FALSE(GetButtonByID(platform_app_id)->visible());
// Make the added running platform app to be an app shortcut.

Powered by Google App Engine
This is Rietveld 408576698