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
3 // found in the LICENSE file.
5 #ifndef UI_APP_LIST_TEST_APP_LIST_TEST_MODEL_H_
6 #define UI_APP_LIST_TEST_APP_LIST_TEST_MODEL_H_
10 #include "ui/app_list/app_list_model.h"
14 class AppListItemModel;
18 // Extends AppListModel with helper functions for use in tests.
19 class AppListTestModel : public AppListModel {
23 // Generates a name based on |id|.
24 std::string GetItemName(int id);
26 // Populate the model with |n| items titled "Item #".
27 void PopulateApps(int n);
29 // Populate the model with an item titled "Item |id|".
30 void PopulateAppWithId(int id);
32 // Get a string of all apps in |model| joined with ','.
33 std::string GetModelContent();
35 // Creates an item with |title| and |full_name|. Caller owns the result.
36 AppListItemModel* CreateItem(const std::string& title,
37 const std::string& full_name);
39 // Creates and adds an item with |title| and |full_name| to the model.
40 void CreateAndAddItem(const std::string& title, const std::string& full_name);
42 // Convenience version of CreateAndAddItem(title, title).
43 void CreateAndAddItem(const std::string& title);
45 // Call SetHighlighted on the specified item.
46 void HighlightItemAt(int index);
48 int activate_count() { return activate_count_; }
49 AppListItemModel* last_activated() { return last_activated_; }
51 static const char kAppType[];
54 class AppListTestItemModel;
56 void ItemActivated(AppListTestItemModel* item);
59 AppListItemModel* last_activated_;
61 DISALLOW_COPY_AND_ASSIGN(AppListTestModel);
65 } // namespace app_list
67 #endif // UI_APP_LIST_TEST_APP_LIST_TEST_MODEL_H_