Performance histograms for extension content verification
[chromium-blink-merge.git] / ui / app_list / test / app_list_test_view_delegate.h
blob698496c50189a4f2a726b8ff4402615036fcbbba
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 virtual ~AppListTestViewDelegate();
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 virtual bool ForceNativeDesktop() const OVERRIDE;
52 virtual void SetProfileByPath(const base::FilePath& profile_path) OVERRIDE;
53 virtual AppListModel* GetModel() OVERRIDE;
54 virtual SpeechUIModel* GetSpeechUI() OVERRIDE;
55 virtual void GetShortcutPathForApp(
56 const std::string& app_id,
57 const base::Callback<void(const base::FilePath&)>& callback) OVERRIDE;
58 virtual void StartSearch() OVERRIDE {}
59 virtual void StopSearch() OVERRIDE {}
60 virtual void OpenSearchResult(SearchResult* result,
61 bool auto_launch,
62 int event_flags) OVERRIDE;
63 virtual void InvokeSearchResultAction(SearchResult* result,
64 int action_index,
65 int event_flags) OVERRIDE {}
66 virtual base::TimeDelta GetAutoLaunchTimeout() OVERRIDE;
67 virtual void AutoLaunchCanceled() OVERRIDE;
68 virtual void ViewInitialized() OVERRIDE {}
69 virtual void Dismiss() OVERRIDE;
70 virtual void ViewClosing() OVERRIDE {}
71 virtual gfx::ImageSkia GetWindowIcon() OVERRIDE;
72 virtual void OpenSettings() OVERRIDE {}
73 virtual void OpenHelp() OVERRIDE {}
74 virtual void OpenFeedback() OVERRIDE {}
75 virtual void ToggleSpeechRecognition() OVERRIDE;
76 virtual void ShowForProfileByPath(
77 const base::FilePath& profile_path) OVERRIDE {}
78 #if defined(TOOLKIT_VIEWS)
79 virtual views::View* CreateStartPageWebView(const gfx::Size& size) OVERRIDE;
80 #endif
81 virtual bool IsSpeechRecognitionEnabled() OVERRIDE;
82 virtual const Users& GetUsers() const OVERRIDE;
83 virtual bool ShouldCenterWindow() const OVERRIDE;
84 virtual void AddObserver(AppListViewDelegateObserver* observer) OVERRIDE;
85 virtual void RemoveObserver(AppListViewDelegateObserver* observer) OVERRIDE;
87 // Do a bulk replacement of the items in the model.
88 void ReplaceTestModel(int item_count);
90 AppListTestModel* ReleaseTestModel() { return model_.release(); }
91 AppListTestModel* GetTestModel() { return model_.get(); }
93 private:
94 int dismiss_count_;
95 int toggle_speech_recognition_count_;
96 int open_search_result_count_;
97 int next_profile_app_count_;
98 std::map<size_t, int> open_search_result_counts_;
99 Users users_;
100 scoped_ptr<AppListTestModel> model_;
101 ObserverList<AppListViewDelegateObserver> observers_;
102 SpeechUIModel speech_ui_;
103 base::TimeDelta auto_launch_timeout_;
105 DISALLOW_COPY_AND_ASSIGN(AppListTestViewDelegate);
108 } // namespace test
109 } // namespace app_list
111 #endif // UI_APP_LIST_TEST_APP_LIST_TEST_VIEW_DELEGATE_H_