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

Unified Diff: ash/common/shelf/shelf_model_unittest.cc

Issue 2518423003: Combine shelf platform and windowed app types. (Closed)
Patch Set: Fix kInvalidShelfID typo. 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
« no previous file with comments | « ash/common/shelf/shelf_model.cc ('k') | ash/common/shelf/shelf_view.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ash/common/shelf/shelf_model_unittest.cc
diff --git a/ash/common/shelf/shelf_model_unittest.cc b/ash/common/shelf/shelf_model_unittest.cc
index e0b8bccff0142c0d14be1b0e88f0c4141e522743..9589da1d73a467fcc5f969e84d03c7aa4307e5e1 100644
--- a/ash/common/shelf/shelf_model_unittest.cc
+++ b/ash/common/shelf/shelf_model_unittest.cc
@@ -107,11 +107,11 @@ TEST_F(ShelfModelTest, BasicAssertions) {
// Change to a platform app item.
ShelfID original_id = model_->items()[index].id;
- item.type = TYPE_PLATFORM_APP;
+ item.type = TYPE_APP;
model_->Set(index, item);
EXPECT_EQ(original_id, model_->items()[index].id);
EXPECT_EQ("changed=1", observer_->StateStringAndClear());
- EXPECT_EQ(TYPE_PLATFORM_APP, model_->items()[index].type);
+ EXPECT_EQ(TYPE_APP, model_->items()[index].type);
// Remove the item.
model_->RemoveItemAt(index);
@@ -156,9 +156,9 @@ TEST_F(ShelfModelTest, AddIndices) {
int browser_shortcut_index = model_->Add(browser_shortcut);
EXPECT_EQ(1, browser_shortcut_index);
- // platform app items should be after browser shortcut.
+ // App items should be after the browser shortcut.
ShelfItem item;
- item.type = TYPE_PLATFORM_APP;
+ item.type = TYPE_APP;
int platform_app_index1 = model_->Add(item);
EXPECT_EQ(2, platform_app_index1);
@@ -195,9 +195,8 @@ TEST_F(ShelfModelTest, AddIndices) {
// Before there are any panels, no icons should be right aligned.
EXPECT_EQ(model_->item_count(), model_->FirstPanelIndex());
- // Check that AddAt() figures out the correct indexes for platform apps and
- // panels.
- item.type = TYPE_PLATFORM_APP;
+ // Check that AddAt() figures out the correct indexes for apps and panels.
+ item.type = TYPE_APP;
int platform_app_index3 = model_->AddAt(3, item);
EXPECT_EQ(7, platform_app_index3);
@@ -205,7 +204,7 @@ TEST_F(ShelfModelTest, AddIndices) {
int app_panel_index1 = model_->AddAt(2, item);
EXPECT_EQ(10, app_panel_index1);
- item.type = TYPE_PLATFORM_APP;
+ item.type = TYPE_APP;
int platform_app_index4 = model_->AddAt(11, item);
EXPECT_EQ(10, platform_app_index4);
@@ -213,7 +212,7 @@ TEST_F(ShelfModelTest, AddIndices) {
int app_panel_index2 = model_->AddAt(12, item);
EXPECT_EQ(12, app_panel_index2);
- item.type = TYPE_PLATFORM_APP;
+ item.type = TYPE_APP;
int platform_app_index5 = model_->AddAt(7, item);
EXPECT_EQ(7, platform_app_index5);
@@ -228,9 +227,8 @@ TEST_F(ShelfModelTest, AddIndices) {
EXPECT_EQ(TYPE_APP_LIST, model_->items()[0].type);
}
-// Test that the indexes for the running applications are properly determined
-// when the first running application is a windowed application.
-TEST_F(ShelfModelTest, FirstRunningAppIndexUsingWindowedAppFirst) {
+// Test that the indexes for the running applications are properly determined.
+TEST_F(ShelfModelTest, FirstRunningAppIndex) {
// Insert the browser shortcut at index 1 and check that the running
// application index would be behind it.
ShelfItem item;
@@ -250,48 +248,12 @@ TEST_F(ShelfModelTest, FirstRunningAppIndexUsingWindowedAppFirst) {
EXPECT_EQ(2, model_->Add(item));
EXPECT_EQ(3, model_->FirstRunningAppIndex());
- // Insert different running application shortcuts - but first a windowed
- // application - and make sure that the same index gets returned.
- item.type = TYPE_WINDOWED_APP;
- int running_app_index = model_->Add(item);
- EXPECT_EQ(3, running_app_index);
- EXPECT_EQ(running_app_index, model_->FirstRunningAppIndex());
- item.type = TYPE_PLATFORM_APP;
- EXPECT_EQ(running_app_index + 1, model_->Add(item));
- EXPECT_EQ(running_app_index, model_->FirstRunningAppIndex());
-}
-
-// Test that the indexes for the running applications are properly determined
-// when the first running application is a platform application.
-TEST_F(ShelfModelTest, FirstRunningAppIndexUsingPlatformAppFirst) {
- // Insert the browser shortcut at index 1 and check that the running
- // application index would be behind it.
- ShelfItem item;
- item.type = TYPE_BROWSER_SHORTCUT;
- EXPECT_EQ(1, model_->Add(item));
- EXPECT_EQ(2, model_->FirstRunningAppIndex());
-
- // Insert a panel application at the end and check that the running
- // application index would be at / before the application panel.
- item.type = TYPE_APP_PANEL;
- EXPECT_EQ(2, model_->Add(item));
- EXPECT_EQ(2, model_->FirstRunningAppIndex());
-
- // Insert an application shortcut and make sure that the running application
- // index would be behind it.
- item.type = TYPE_APP_SHORTCUT;
- EXPECT_EQ(2, model_->Add(item));
+ // Insert a two app items and check the first running app index.
+ item.type = TYPE_APP;
+ EXPECT_EQ(3, model_->Add(item));
+ EXPECT_EQ(3, model_->FirstRunningAppIndex());
+ EXPECT_EQ(4, model_->Add(item));
EXPECT_EQ(3, model_->FirstRunningAppIndex());
-
- // Insert different running application shortcuts - but first a platfom
- // application - and make sure that the same index gets returned.
- item.type = TYPE_PLATFORM_APP;
- int running_app_index = model_->Add(item);
- EXPECT_EQ(3, running_app_index);
- EXPECT_EQ(running_app_index, model_->FirstRunningAppIndex());
- item.type = TYPE_WINDOWED_APP;
- EXPECT_EQ(running_app_index + 1, model_->Add(item));
- EXPECT_EQ(running_app_index, model_->FirstRunningAppIndex());
}
// Assertions around id generation and usage.
@@ -312,7 +274,7 @@ TEST_F(ShelfModelTest, ShelfIDTests) {
// Adding another item to the list should also produce a new ID.
ShelfItem item;
- item.type = TYPE_PLATFORM_APP;
+ item.type = TYPE_APP;
model_->Add(item);
EXPECT_NE(model_->next_id(), id2);
}
@@ -340,11 +302,11 @@ TEST_F(ShelfModelTest, CorrectMoveItemsWhenStateChange) {
// Now change the type of the second item and make sure that it is moving
// behind the shortcuts.
- item.type = TYPE_PLATFORM_APP;
+ item.type = TYPE_APP;
model_->Set(app2_index, item);
// The item should have moved in front of the app launcher.
- EXPECT_EQ(TYPE_PLATFORM_APP, model_->items()[4].type);
+ EXPECT_EQ(TYPE_APP, model_->items()[4].type);
}
} // namespace ash
« no previous file with comments | « ash/common/shelf/shelf_model.cc ('k') | ash/common/shelf/shelf_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698