OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "ui/app_list/test/app_list_test_model.h" | 5 #include "ui/app_list/test/app_list_test_model.h" |
6 | 6 |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "ui/app_list/app_list_item_model.h" | 8 #include "ui/app_list/app_list_item_model.h" |
9 | 9 |
10 namespace app_list { | 10 namespace app_list { |
(...skipping 15 matching lines...) Expand all Loading... |
26 std::string AppListTestModel::GetModelContent() { | 26 std::string AppListTestModel::GetModelContent() { |
27 std::string content; | 27 std::string content; |
28 for (size_t i = 0; i < apps()->item_count(); ++i) { | 28 for (size_t i = 0; i < apps()->item_count(); ++i) { |
29 if (i > 0) | 29 if (i > 0) |
30 content += ','; | 30 content += ','; |
31 content += apps()->GetItemAt(i)->title(); | 31 content += apps()->GetItemAt(i)->title(); |
32 } | 32 } |
33 return content; | 33 return content; |
34 } | 34 } |
35 | 35 |
36 AppListItemModel* AppListTestModel::CreateItem(const std::string& title) { | 36 AppListItemModel* AppListTestModel::CreateItem(const std::string& title, |
| 37 const std::string& full_name) { |
37 AppListItemModel* item = new AppListItemModel; | 38 AppListItemModel* item = new AppListItemModel; |
38 item->SetTitle(title); | 39 item->SetTitle(title); |
| 40 item->SetFullName(full_name); |
39 return item; | 41 return item; |
40 } | 42 } |
41 | 43 |
42 void AppListTestModel::AddItem(const std::string& title) { | 44 void AppListTestModel::AddItem(const std::string& title) { |
43 apps()->Add(CreateItem(title)); | 45 apps()->Add(CreateItem(title, title)); |
| 46 } |
| 47 |
| 48 void AppListTestModel::AddItem(const std::string& title, |
| 49 const std::string& full_name) { |
| 50 apps()->Add(CreateItem(title, full_name)); |
44 } | 51 } |
45 | 52 |
46 void AppListTestModel::HighlightItemAt(int index) { | 53 void AppListTestModel::HighlightItemAt(int index) { |
47 AppListItemModel* item = apps()->GetItemAt(index); | 54 AppListItemModel* item = apps()->GetItemAt(index); |
48 item->SetHighlighted(true); | 55 item->SetHighlighted(true); |
49 } | 56 } |
50 | 57 |
51 } // namespace test | 58 } // namespace test |
52 } // namespace app_list | 59 } // namespace app_list |
OLD | NEW |