- add sources.
[platform/framework/web/crosswalk.git] / src / ui / app_list / test / app_list_test_model.h
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.
4
5 #ifndef UI_APP_LIST_TEST_APP_LIST_TEST_MODEL_H_
6 #define UI_APP_LIST_TEST_APP_LIST_TEST_MODEL_H_
7
8 #include <string>
9
10 #include "ui/app_list/app_list_model.h"
11
12 namespace app_list {
13
14 class AppListItemModel;
15
16 namespace test {
17
18 // Extends AppListModel with helper functions for use in tests.
19 class AppListTestModel : public AppListModel {
20  public:
21   AppListTestModel();
22
23   // Generates a name based on |id|.
24   std::string GetItemName(int id);
25
26   // Populate the model with |n| items titled "Item #".
27   void PopulateApps(int n);
28
29   // Populate the model with an item titled "Item |id|".
30   void PopulateAppWithId(int id);
31
32   // Get a string of all apps in |model| joined with ','.
33   std::string GetModelContent();
34
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);
38
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);
41
42   // Convenience version of CreateAndAddItem(title, title).
43   void CreateAndAddItem(const std::string& title);
44
45   // Call SetHighlighted on the specified item.
46   void HighlightItemAt(int index);
47
48   int activate_count() { return activate_count_; }
49   AppListItemModel* last_activated() { return last_activated_; }
50
51   static const char kAppType[];
52
53  private:
54   class AppListTestItemModel;
55
56   void ItemActivated(AppListTestItemModel* item);
57
58   int activate_count_;
59   AppListItemModel* last_activated_;
60
61   DISALLOW_COPY_AND_ASSIGN(AppListTestModel);
62 };
63
64 }  // namespace test
65 }  // namespace app_list
66
67 #endif  // UI_APP_LIST_TEST_APP_LIST_TEST_MODEL_H_