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 #ifndef UI_APP_LIST_TEST_APP_LIST_TEST_VIEW_DELEGATE_H_ | 5 #ifndef UI_APP_LIST_TEST_APP_LIST_TEST_VIEW_DELEGATE_H_ |
6 #define UI_APP_LIST_TEST_APP_LIST_TEST_VIEW_DELEGATE_H_ | 6 #define UI_APP_LIST_TEST_APP_LIST_TEST_VIEW_DELEGATE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 #include "base/callback_forward.h" | 11 #include "base/callback_forward.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/observer_list.h" | 14 #include "base/observer_list.h" |
15 #include "ui/app_list/app_list_view_delegate.h" | 15 #include "ui/app_list/app_list_view_delegate.h" |
16 #include "ui/app_list/speech_ui_model.h" | 16 #include "ui/app_list/speech_ui_model.h" |
17 | 17 |
18 namespace app_list { | 18 namespace app_list { |
19 namespace test { | 19 namespace test { |
20 | 20 |
21 class AppListTestModel; | 21 class AppListTestModel; |
22 class TestSigninDelegate; | |
23 | 22 |
24 // A concrete AppListViewDelegate for unit tests. | 23 // A concrete AppListViewDelegate for unit tests. |
25 class AppListTestViewDelegate : public AppListViewDelegate { | 24 class AppListTestViewDelegate : public AppListViewDelegate { |
26 public: | 25 public: |
27 AppListTestViewDelegate(); | 26 AppListTestViewDelegate(); |
28 virtual ~AppListTestViewDelegate(); | 27 virtual ~AppListTestViewDelegate(); |
29 | 28 |
30 int dismiss_count() { return dismiss_count_; } | 29 int dismiss_count() { return dismiss_count_; } |
31 int open_search_result_count() { return open_search_result_count_; } | 30 int open_search_result_count() { return open_search_result_count_; } |
32 void SetUsers(const Users& users) { | 31 void SetUsers(const Users& users) { |
33 users_ = users; | 32 users_ = users; |
34 } | 33 } |
35 std::map<size_t, int> open_search_result_counts() { | 34 std::map<size_t, int> open_search_result_counts() { |
36 return open_search_result_counts_; | 35 return open_search_result_counts_; |
37 } | 36 } |
38 | 37 |
39 void set_auto_launch_timeout(const base::TimeDelta& timeout) { | 38 void set_auto_launch_timeout(const base::TimeDelta& timeout) { |
40 auto_launch_timeout_ = timeout; | 39 auto_launch_timeout_ = timeout; |
41 } | 40 } |
42 | 41 |
43 // Sets the signin status of the signin delegate, creating one if there isn't | |
44 // one already. | |
45 void SetSignedIn(bool signed_in); | |
46 | |
47 // AppListViewDelegate overrides: | 42 // AppListViewDelegate overrides: |
48 virtual bool ForceNativeDesktop() const OVERRIDE; | 43 virtual bool ForceNativeDesktop() const OVERRIDE; |
49 virtual void SetProfileByPath(const base::FilePath& profile_path) OVERRIDE {} | 44 virtual void SetProfileByPath(const base::FilePath& profile_path) OVERRIDE {} |
50 virtual AppListModel* GetModel() OVERRIDE; | 45 virtual AppListModel* GetModel() OVERRIDE; |
51 virtual SigninDelegate* GetSigninDelegate() OVERRIDE; | |
52 virtual SpeechUIModel* GetSpeechUI() OVERRIDE; | 46 virtual SpeechUIModel* GetSpeechUI() OVERRIDE; |
53 virtual void GetShortcutPathForApp( | 47 virtual void GetShortcutPathForApp( |
54 const std::string& app_id, | 48 const std::string& app_id, |
55 const base::Callback<void(const base::FilePath&)>& callback) OVERRIDE; | 49 const base::Callback<void(const base::FilePath&)>& callback) OVERRIDE; |
56 virtual void StartSearch() OVERRIDE {} | 50 virtual void StartSearch() OVERRIDE {} |
57 virtual void StopSearch() OVERRIDE {} | 51 virtual void StopSearch() OVERRIDE {} |
58 virtual void OpenSearchResult(SearchResult* result, | 52 virtual void OpenSearchResult(SearchResult* result, |
59 bool auto_launch, | 53 bool auto_launch, |
60 int event_flags) OVERRIDE; | 54 int event_flags) OVERRIDE; |
61 virtual void InvokeSearchResultAction(SearchResult* result, | 55 virtual void InvokeSearchResultAction(SearchResult* result, |
(...skipping 22 matching lines...) Expand all Loading... |
84 void ReplaceTestModel(int item_count); | 78 void ReplaceTestModel(int item_count); |
85 | 79 |
86 AppListTestModel* ReleaseTestModel() { return model_.release(); } | 80 AppListTestModel* ReleaseTestModel() { return model_.release(); } |
87 AppListTestModel* GetTestModel() { return model_.get(); } | 81 AppListTestModel* GetTestModel() { return model_.get(); } |
88 | 82 |
89 private: | 83 private: |
90 int dismiss_count_; | 84 int dismiss_count_; |
91 int open_search_result_count_; | 85 int open_search_result_count_; |
92 std::map<size_t, int> open_search_result_counts_; | 86 std::map<size_t, int> open_search_result_counts_; |
93 Users users_; | 87 Users users_; |
94 scoped_ptr<TestSigninDelegate> test_signin_delegate_; | |
95 scoped_ptr<AppListTestModel> model_; | 88 scoped_ptr<AppListTestModel> model_; |
96 ObserverList<AppListViewDelegateObserver> observers_; | 89 ObserverList<AppListViewDelegateObserver> observers_; |
97 SpeechUIModel speech_ui_; | 90 SpeechUIModel speech_ui_; |
98 base::TimeDelta auto_launch_timeout_; | 91 base::TimeDelta auto_launch_timeout_; |
99 | 92 |
100 DISALLOW_COPY_AND_ASSIGN(AppListTestViewDelegate); | 93 DISALLOW_COPY_AND_ASSIGN(AppListTestViewDelegate); |
101 }; | 94 }; |
102 | 95 |
103 } // namespace test | 96 } // namespace test |
104 } // namespace app_list | 97 } // namespace app_list |
105 | 98 |
106 #endif // UI_APP_LIST_TEST_APP_LIST_TEST_VIEW_DELEGATE_H_ | 99 #endif // UI_APP_LIST_TEST_APP_LIST_TEST_VIEW_DELEGATE_H_ |
OLD | NEW |