Index: ui/app_list/test/app_list_test_model.cc |
diff --git a/ui/app_list/test/app_list_test_model.cc b/ui/app_list/test/app_list_test_model.cc |
index dd7cab40bc523f541c7cf1da408099629f64b31d..3ffa18d55b7bef5f7984c154c8a2dd56abe04377 100644 |
--- a/ui/app_list/test/app_list_test_model.cc |
+++ b/ui/app_list/test/app_list_test_model.cc |
@@ -33,21 +33,31 @@ AppListTestModel::AppListTestModel() |
SetSignedIn(true); |
} |
+std::string AppListTestModel::GetItemName(int id) { |
+ return base::StringPrintf("Item %d", id); |
+} |
+ |
void AppListTestModel::PopulateApps(int n) { |
+ int start_index = 0; |
+ for (size_t p = 0; p < GetNumAppPages(); ++p) |
+ start_index += GetAppItemsForPage(p).item_count(); |
for (int i = 0; i < n; ++i) |
- AddItem(base::StringPrintf("Item %d", i)); |
+ CreateAndAddItem(GetItemName(start_index + i)); |
} |
void AppListTestModel::PopulateAppWithId(int id) { |
- AddItem(base::StringPrintf("Item %d", id)); |
+ CreateAndAddItem(GetItemName(id)); |
} |
std::string AppListTestModel::GetModelContent() { |
std::string content; |
- for (size_t i = 0; i < apps()->item_count(); ++i) { |
- if (i > 0) |
- content += ','; |
- content += apps()->GetItemAt(i)->title(); |
+ for (size_t p = 0; p < GetNumAppPages(); ++p) { |
+ const AppItems& apps = GetAppItemsForPage(p); |
+ for (size_t i = 0; i < apps.item_count(); ++i) { |
+ if (i > 0) |
+ content += ','; |
+ content += apps.GetItemAt(i)->title(); |
+ } |
} |
return content; |
} |
@@ -59,17 +69,17 @@ AppListItemModel* AppListTestModel::CreateItem(const std::string& title, |
return item; |
} |
-void AppListTestModel::AddItem(const std::string& title) { |
- apps()->Add(CreateItem(title, title)); |
+void AppListTestModel::CreateAndAddItem(const std::string& title, |
+ const std::string& full_name) { |
+ AddItem(CreateItem(title, full_name)); |
} |
-void AppListTestModel::AddItem(const std::string& title, |
- const std::string& full_name) { |
- apps()->Add(CreateItem(title, full_name)); |
+void AppListTestModel::CreateAndAddItem(const std::string& title) { |
+ CreateAndAddItem(title, title); |
} |
void AppListTestModel::HighlightItemAt(int index) { |
- AppListItemModel* item = apps()->GetItemAt(index); |
+ AppListItemModel* item = GetItemAt(0, index); |
item->SetHighlighted(true); |
} |