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

Unified Diff: ui/app_list/cocoa/apps_grid_controller_unittest.mm

Issue 148403007: Protect AppListItemList Add/Remove and fix sync bugs (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 11 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/cocoa/apps_grid_controller_unittest.mm
diff --git a/ui/app_list/cocoa/apps_grid_controller_unittest.mm b/ui/app_list/cocoa/apps_grid_controller_unittest.mm
index a01524644e11618c51b954740191ef7d1cb5c431..e12c80abbb930c538deb4f575bef8418a0b5c764 100644
--- a/ui/app_list/cocoa/apps_grid_controller_unittest.mm
+++ b/ui/app_list/cocoa/apps_grid_controller_unittest.mm
@@ -486,7 +486,7 @@ TEST_F(AppsGridControllerTest, ModelAdd) {
app_list::AppListItem* item1 = item_list->item_at(1);
app_list::AppListItem* item3 =
model()->CreateItem("Item Three", "Item Three");
- item_list->AddItem(item3);
+ model()->AddItem(item3);
item_list->SetItemPosition(
item3, item0->position().CreateBetween(item1->position()));
EXPECT_EQ(4u, [apps_grid_controller_ itemCount]);
@@ -509,7 +509,7 @@ TEST_F(AppsGridControllerTest, ModelRemove) {
EXPECT_EQ(std::string("|Item 0,Item 1,Item 2|"), GetViewContent());
// Test removing an item at the end.
- model()->item_list()->DeleteItem("Item 2");
+ model()->DeleteItem("Item 2");
EXPECT_EQ(2u, [apps_grid_controller_ itemCount]);
EXPECT_EQ(std::string("|Item 0,Item 1|"), GetViewContent());
@@ -517,18 +517,20 @@ TEST_F(AppsGridControllerTest, ModelRemove) {
model()->CreateAndAddItem("Item 2");
EXPECT_EQ(3u, [apps_grid_controller_ itemCount]);
EXPECT_EQ(std::string("|Item 0,Item 1,Item 2|"), GetViewContent());
- model()->item_list()->DeleteItem("Item 1");
+ model()->DeleteItem("Item 1");
EXPECT_EQ(2u, [apps_grid_controller_ itemCount]);
EXPECT_EQ(std::string("|Item 0,Item 2|"), GetViewContent());
}
-TEST_F(AppsGridControllerTest, ModelRemoveAlll) {
tapted 2014/01/28 23:33:54 Just a note, this test case initially existed to e
+TEST_F(AppsGridControllerTest, ModelRemoveSeveral) {
model()->PopulateApps(3);
EXPECT_EQ(3u, [[GetPageAt(0) content] count]);
EXPECT_EQ(std::string("|Item 0,Item 1,Item 2|"), GetViewContent());
// Test removing multiple items via the model.
- model()->item_list()->DeleteItemsByType(NULL /* all items */);
+ model()->DeleteItem("Item 0");
+ model()->DeleteItem("Item 1");
+ model()->DeleteItem("Item 2");
EXPECT_EQ(0u, [apps_grid_controller_ itemCount]);
EXPECT_EQ(std::string("||"), GetViewContent());
}
@@ -543,7 +545,7 @@ TEST_F(AppsGridControllerTest, ModelRemovePage) {
// Test removing the last item when there is one item on the second page.
app_list::AppListItem* last_item = item_list->item_at(kItemsPerPage);
- item_list->DeleteItem(last_item->id());
+ model()->DeleteItem(last_item->id());
EXPECT_EQ(kItemsPerPage, item_list->item_count());
EXPECT_EQ(kItemsPerPage, [apps_grid_controller_ itemCount]);
EXPECT_EQ(1u, [apps_grid_controller_ pageCount]);
@@ -962,8 +964,8 @@ TEST_F(AppsGridControllerTest, ScrollingWhileDragging) {
TEST_F(AppsGridControllerTest, ContextMenus) {
AppListItemWithMenu* item_two_model = new AppListItemWithMenu("Item Two");
- model()->item_list()->AddItem(new AppListItemWithMenu("Item One"));
- model()->item_list()->AddItem(item_two_model);
+ model()->AddItem(new AppListItemWithMenu("Item One"));
+ model()->AddItem(item_two_model);
EXPECT_EQ(2u, [apps_grid_controller_ itemCount]);
NSCollectionView* page = [apps_grid_controller_ collectionViewAtPageIndex:0];

Powered by Google App Engine
This is Rietveld 408576698