OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "athena/test/test_app_model_builder.h" | 5 #include "athena/test/test_app_model_builder.h" |
6 | 6 |
7 #include "ui/app_list/app_list_item.h" | 7 #include "ui/app_list/app_list_item.h" |
8 #include "ui/app_list/app_list_model.h" | 8 #include "ui/app_list/app_list_model.h" |
9 | 9 |
10 namespace athena { | 10 namespace athena { |
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 color = SK_ColorYELLOW; | 71 color = SK_ColorYELLOW; |
72 break; | 72 break; |
73 case DUMMY_CONTACT: | 73 case DUMMY_CONTACT: |
74 color = SK_ColorCYAN; | 74 color = SK_ColorCYAN; |
75 break; | 75 break; |
76 case LAST_TYPE: | 76 case LAST_TYPE: |
77 NOTREACHED(); | 77 NOTREACHED(); |
78 break; | 78 break; |
79 } | 79 } |
80 SkBitmap bitmap; | 80 SkBitmap bitmap; |
81 bitmap.setConfig(SkBitmap::kARGB_8888_Config, kIconSize, kIconSize); | 81 bitmap.allocN32Pixels(kIconSize, kIconSize); |
82 bitmap.allocPixels(); | |
83 bitmap.eraseColor(color); | 82 bitmap.eraseColor(color); |
84 return gfx::ImageSkia::CreateFrom1xBitmap(bitmap); | 83 return gfx::ImageSkia::CreateFrom1xBitmap(bitmap); |
85 } | 84 } |
86 | 85 |
87 Type type_; | 86 Type type_; |
88 | 87 |
89 DISALLOW_COPY_AND_ASSIGN(DummyItem); | 88 DISALLOW_COPY_AND_ASSIGN(DummyItem); |
90 }; | 89 }; |
91 | 90 |
92 } // namespace | 91 } // namespace |
93 | 92 |
94 TestAppModelBuilder::TestAppModelBuilder() { | 93 TestAppModelBuilder::TestAppModelBuilder() { |
95 } | 94 } |
96 | 95 |
97 TestAppModelBuilder::~TestAppModelBuilder() { | 96 TestAppModelBuilder::~TestAppModelBuilder() { |
98 } | 97 } |
99 | 98 |
100 void TestAppModelBuilder::PopulateApps(app_list::AppListModel* model) { | 99 void TestAppModelBuilder::PopulateApps(app_list::AppListModel* model) { |
101 for (int i = 0; i < static_cast<int>(DummyItem::LAST_TYPE); ++i) { | 100 for (int i = 0; i < static_cast<int>(DummyItem::LAST_TYPE); ++i) { |
102 model->AddItem(scoped_ptr<app_list::AppListItem>( | 101 model->AddItem(scoped_ptr<app_list::AppListItem>( |
103 new DummyItem(static_cast<DummyItem::Type>(i)))); | 102 new DummyItem(static_cast<DummyItem::Type>(i)))); |
104 } | 103 } |
105 } | 104 } |
106 | 105 |
107 } // namespace athena | 106 } // namespace athena |
OLD | NEW |