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

Unified Diff: ui/app_list/app_list_model_unittest.cc

Issue 1003393002: After uninstall, remove last item in Launcher folder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move work from views to model, as per reviewer comment Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: ui/app_list/app_list_model_unittest.cc
diff --git a/ui/app_list/app_list_model_unittest.cc b/ui/app_list/app_list_model_unittest.cc
index a81e5043ca0494adcda1323f97a7c8b73411b209..64edc6bcc85ecd999fcda1d8cb1ccb34accaea56 100644
--- a/ui/app_list/app_list_model_unittest.cc
+++ b/ui/app_list/app_list_model_unittest.cc
@@ -438,6 +438,37 @@ TEST_F(AppListModelFolderTest, MoveItemFromFolderToFolder) {
ASSERT_TRUE(folder2);
}
+TEST_F(AppListModelFolderTest, UninstallFolderItems) {
+ model_.AddItem(new AppListItem("Item 0"));
+ model_.AddItem(new AppListItem("Item 1"));
+ model_.AddItem(new AppListItem("Item 2"));
+ AppListFolderItem* folder1 = static_cast<AppListFolderItem*>(model_.AddItem(
+ new AppListFolderItem("folder1", AppListFolderItem::FOLDER_TYPE_NORMAL)));
+ EXPECT_EQ("Item 0,Item 1,Item 2,folder1", GetModelContents());
+
+ // Move all items to folder1.
+ model_.MoveItemToFolderAt(model_.top_level_item_list()->item_at(0),
+ folder1->id(), syncer::StringOrdinal());
+ model_.MoveItemToFolderAt(model_.top_level_item_list()->item_at(0),
+ folder1->id(),
+ folder1->item_list()->item_at(0)->position());
+ model_.MoveItemToFolderAt(model_.top_level_item_list()->item_at(0),
+ folder1->id(),
+ folder1->item_list()->item_at(0)->position());
stevenjb 2015/03/25 22:24:01 This is a little unclear, relying on the fact that
Greg Levin 2015/03/26 19:45:11 Done. (I find the current version more unclear, bu
stevenjb 2015/03/30 17:23:59 'position' is a StringOrdinal, which uses strings
Greg Levin 2015/03/30 23:08:52 Ok, thanks. I'll ask for more detail if I ever ne
+ EXPECT_EQ("Item 2,Item 1,Item 0", GetItemListContents(folder1->item_list()));
+ EXPECT_EQ("folder1", GetModelContents());
+
+ // Delete Item 2 from folder.
+ model_.DeleteUninstalledItem("Item 2");
+ EXPECT_EQ("Item 1,Item 0", GetItemListContents(folder1->item_list()));
+ EXPECT_EQ("folder1", GetModelContents());
+
+ // Delete Item 1 from folder, should reparent Item 0 and delete folder1.
+ model_.DeleteUninstalledItem("Item 1");
+ EXPECT_EQ(nullptr, model_.FindItem("folder1"));
+ EXPECT_EQ("Item 0", GetModelContents());
+}
stevenjb 2015/03/25 22:24:01 We should also add a test that creates a single it
Greg Levin 2015/03/26 19:45:11 Done.
+
TEST_F(AppListModelFolderTest, FindItemInFolder) {
AppListFolderItem* folder =
new AppListFolderItem("folder1", AppListFolderItem::FOLDER_TYPE_NORMAL);

Powered by Google App Engine
This is Rietveld 408576698