MacViews: Get c/b/ui/views/tabs to build on Mac
[chromium-blink-merge.git] / ui / app_list / test / app_list_test_view_delegate.h
blob2eb1853d4e84bb34b500ed2c535cae7c71f520b4
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_VIEW_DELEGATE_H_
6 #define UI_APP_LIST_TEST_APP_LIST_TEST_VIEW_DELEGATE_H_
8 #include <map>
9 #include <string>
11 #include "base/callback_forward.h"
12 #include "base/compiler_specific.h"
13 #include "base/memory/scoped_ptr.h"
14 #include "base/observer_list.h"
15 #include "ui/app_list/app_list_view_delegate.h"
16 #include "ui/app_list/speech_ui_model.h"
18 namespace app_list {
19 namespace test {
21 class AppListTestModel;
23 // A concrete AppListViewDelegate for unit tests.
24 class AppListTestViewDelegate : public AppListViewDelegate {
25 public:
26 AppListTestViewDelegate();
27 ~AppListTestViewDelegate() override;
29 int dismiss_count() { return dismiss_count_; }
30 int open_search_result_count() { return open_search_result_count_; }
31 void SetUsers(const Users& users) {
32 users_ = users;
34 std::map<size_t, int> open_search_result_counts() {
35 return open_search_result_counts_;
38 // Sets the number of apps that the model will be created with the next time
39 // SetProfileByPath() is called.
40 void set_next_profile_app_count(int apps) { next_profile_app_count_ = apps; }
42 void set_auto_launch_timeout(const base::TimeDelta& timeout) {
43 auto_launch_timeout_ = timeout;
46 // Returns the value of |toggle_speech_recognition_count_| and then
47 // resets this value to 0.
48 int GetToggleSpeechRecognitionCountAndReset();
50 // AppListViewDelegate overrides:
51 bool ForceNativeDesktop() const override;
52 void SetProfileByPath(const base::FilePath& profile_path) override;
53 AppListModel* GetModel() override;
54 SpeechUIModel* GetSpeechUI() override;
55 void GetShortcutPathForApp(
56 const std::string& app_id,
57 const base::Callback<void(const base::FilePath&)>& callback) override;
58 void StartSearch() override {}
59 void StopSearch() override {}
60 void OpenSearchResult(SearchResult* result,
61 bool auto_launch,
62 int event_flags) override;
63 void InvokeSearchResultAction(SearchResult* result,
64 int action_index,
65 int event_flags) override {}
66 base::TimeDelta GetAutoLaunchTimeout() override;
67 void AutoLaunchCanceled() override;
68 void ViewInitialized() override {}
69 void Dismiss() override;
70 void ViewClosing() override {}
71 gfx::ImageSkia GetWindowIcon() override;
72 void OpenSettings() override {}
73 void OpenHelp() override {}
74 void OpenFeedback() override {}
75 void ToggleSpeechRecognition() override;
76 void ShowForProfileByPath(const base::FilePath& profile_path) override {}
77 #if defined(TOOLKIT_VIEWS)
78 virtual views::View* CreateStartPageWebView(const gfx::Size& size) override;
79 virtual std::vector<views::View*> CreateCustomPageWebViews(
80 const gfx::Size& size) override;
81 #endif
82 bool IsSpeechRecognitionEnabled() override;
83 const Users& GetUsers() const override;
84 bool ShouldCenterWindow() const override;
85 void AddObserver(AppListViewDelegateObserver* observer) override;
86 void RemoveObserver(AppListViewDelegateObserver* observer) override;
88 // Do a bulk replacement of the items in the model.
89 void ReplaceTestModel(int item_count);
91 AppListTestModel* ReleaseTestModel() { return model_.release(); }
92 AppListTestModel* GetTestModel() { return model_.get(); }
94 private:
95 int dismiss_count_;
96 int toggle_speech_recognition_count_;
97 int open_search_result_count_;
98 int next_profile_app_count_;
99 std::map<size_t, int> open_search_result_counts_;
100 Users users_;
101 scoped_ptr<AppListTestModel> model_;
102 ObserverList<AppListViewDelegateObserver> observers_;
103 SpeechUIModel speech_ui_;
104 base::TimeDelta auto_launch_timeout_;
106 DISALLOW_COPY_AND_ASSIGN(AppListTestViewDelegate);
109 } // namespace test
110 } // namespace app_list
112 #endif // UI_APP_LIST_TEST_APP_LIST_TEST_VIEW_DELEGATE_H_