1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "athena/test/test_app_model_builder.h"
7 #include "ui/app_list/app_list_item.h"
8 #include "ui/app_list/app_list_model.h"
14 const int kIconSize
= 64;
16 class DummyItem
: public app_list::AppListItem
{
27 static std::string
GetTitle(Type type
) {
46 static std::string
GetId(Type type
) {
47 return std::string("id-") + GetTitle(type
);
50 explicit DummyItem(Type type
)
51 : app_list::AppListItem(GetId(type
)),
53 SetIcon(GetIcon(), false /* has_shadow */);
54 SetName(GetTitle(type_
));
58 gfx::ImageSkia
GetIcon() const {
59 SkColor color
= SK_ColorWHITE
;
68 color
= SK_ColorGREEN
;
71 color
= SK_ColorYELLOW
;
81 bitmap
.allocN32Pixels(kIconSize
, kIconSize
);
82 bitmap
.eraseColor(color
);
83 return gfx::ImageSkia::CreateFrom1xBitmap(bitmap
);
88 DISALLOW_COPY_AND_ASSIGN(DummyItem
);
93 TestAppModelBuilder::TestAppModelBuilder() {
96 TestAppModelBuilder::~TestAppModelBuilder() {
99 void TestAppModelBuilder::PopulateApps(app_list::AppListModel
* model
) {
100 for (int i
= 0; i
< static_cast<int>(DummyItem::LAST_TYPE
); ++i
) {
101 model
->AddItem(scoped_ptr
<app_list::AppListItem
>(
102 new DummyItem(static_cast<DummyItem::Type
>(i
))));
106 } // namespace athena