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 70b60a882f930ac8aec194fe6ed1af6a042912e7..9a81aab40014917b9183e358394a082b830319df 100644 |
--- a/ui/app_list/test/app_list_test_model.cc |
+++ b/ui/app_list/test/app_list_test_model.cc |
@@ -7,11 +7,22 @@ |
#include "base/memory/scoped_ptr.h" |
#include "base/strings/stringprintf.h" |
#include "grit/ui_resources.h" |
+#include "third_party/skia/include/core/SkBitmap.h" |
+#include "ui/app_list/app_list_constants.h" |
#include "ui/base/resource/resource_bundle.h" |
+#include "ui/gfx/image/image_skia.h" |
namespace app_list { |
namespace test { |
+gfx::ImageSkia CreateImageSkia(int width, int height) { |
+ SkBitmap bitmap; |
+ bitmap.setConfig(SkBitmap::kARGB_8888_Config, width, height); |
+ bitmap.allocPixels(); |
+ bitmap.eraseARGB(255, 0, 255, 0); |
+ return gfx::ImageSkia::CreateFrom1xBitmap(bitmap); |
+} |
+ |
// static |
const char AppListTestModel::kItemType[] = "TestItem"; |
@@ -22,6 +33,8 @@ AppListTestModel::AppListTestItem::AppListTestItem( |
AppListTestModel* model) |
: AppListItem(id), |
model_(model) { |
+ SetIcon(CreateImageSkia(kPreferredIconDimension, kPreferredIconDimension), |
+ false /* has_shadow */); |
} |
AppListTestModel::AppListTestItem::~AppListTestItem() { |
@@ -93,6 +106,16 @@ AppListFolderItem* AppListTestModel::CreateAndAddOemFolder( |
return static_cast<AppListFolderItem*>(AddItem(folder)); |
} |
+AppListFolderItem* AppListTestModel::CreateSingleItemFolder( |
+ const std::string& folder_id, |
+ const std::string& item_id) { |
+ AppListTestItem* item = CreateItem(item_id); |
+ AddItemToFolder(item, folder_id); |
+ AppListItem* folder_item = FindItem(folder_id); |
+ DCHECK(folder_item->GetItemType() == AppListFolderItem::kItemType); |
+ return static_cast<AppListFolderItem*>(folder_item); |
+} |
+ |
void AppListTestModel::PopulateAppWithId(int id) { |
CreateAndAddItem(GetItemName(id)); |
} |