| 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 // Sets the number of apps that the model will be created with the next time | 38 // Sets the number of apps that the model will be created with the next time |
| 40 // SetProfileByPath() is called. | 39 // SetProfileByPath() is called. |
| 41 void set_next_profile_app_count(int apps) { next_profile_app_count_ = apps; } | 40 void set_next_profile_app_count(int apps) { next_profile_app_count_ = apps; } |
| 42 | 41 |
| 43 void set_auto_launch_timeout(const base::TimeDelta& timeout) { | 42 void set_auto_launch_timeout(const base::TimeDelta& timeout) { |
| 44 auto_launch_timeout_ = timeout; | 43 auto_launch_timeout_ = timeout; |
| 45 } | 44 } |
| 46 | 45 |
| 47 // Sets the signin status of the signin delegate, creating one if there isn't | |
| 48 // one already. | |
| 49 void SetSignedIn(bool signed_in); | |
| 50 | |
| 51 // Returns the value of |toggle_speech_recognition_count_| and then | 46 // Returns the value of |toggle_speech_recognition_count_| and then |
| 52 // resets this value to 0. | 47 // resets this value to 0. |
| 53 int GetToggleSpeechRecognitionCountAndReset(); | 48 int GetToggleSpeechRecognitionCountAndReset(); |
| 54 | 49 |
| 55 // AppListViewDelegate overrides: | 50 // AppListViewDelegate overrides: |
| 56 virtual bool ForceNativeDesktop() const OVERRIDE; | 51 virtual bool ForceNativeDesktop() const OVERRIDE; |
| 57 virtual void SetProfileByPath(const base::FilePath& profile_path) OVERRIDE; | 52 virtual void SetProfileByPath(const base::FilePath& profile_path) OVERRIDE; |
| 58 virtual AppListModel* GetModel() OVERRIDE; | 53 virtual AppListModel* GetModel() OVERRIDE; |
| 59 virtual SigninDelegate* GetSigninDelegate() OVERRIDE; | |
| 60 virtual SpeechUIModel* GetSpeechUI() OVERRIDE; | 54 virtual SpeechUIModel* GetSpeechUI() OVERRIDE; |
| 61 virtual void GetShortcutPathForApp( | 55 virtual void GetShortcutPathForApp( |
| 62 const std::string& app_id, | 56 const std::string& app_id, |
| 63 const base::Callback<void(const base::FilePath&)>& callback) OVERRIDE; | 57 const base::Callback<void(const base::FilePath&)>& callback) OVERRIDE; |
| 64 virtual void StartSearch() OVERRIDE {} | 58 virtual void StartSearch() OVERRIDE {} |
| 65 virtual void StopSearch() OVERRIDE {} | 59 virtual void StopSearch() OVERRIDE {} |
| 66 virtual void OpenSearchResult(SearchResult* result, | 60 virtual void OpenSearchResult(SearchResult* result, |
| 67 bool auto_launch, | 61 bool auto_launch, |
| 68 int event_flags) OVERRIDE; | 62 int event_flags) OVERRIDE; |
| 69 virtual void InvokeSearchResultAction(SearchResult* result, | 63 virtual void InvokeSearchResultAction(SearchResult* result, |
| (...skipping 24 matching lines...) Expand all Loading... |
| 94 AppListTestModel* ReleaseTestModel() { return model_.release(); } | 88 AppListTestModel* ReleaseTestModel() { return model_.release(); } |
| 95 AppListTestModel* GetTestModel() { return model_.get(); } | 89 AppListTestModel* GetTestModel() { return model_.get(); } |
| 96 | 90 |
| 97 private: | 91 private: |
| 98 int dismiss_count_; | 92 int dismiss_count_; |
| 99 int toggle_speech_recognition_count_; | 93 int toggle_speech_recognition_count_; |
| 100 int open_search_result_count_; | 94 int open_search_result_count_; |
| 101 int next_profile_app_count_; | 95 int next_profile_app_count_; |
| 102 std::map<size_t, int> open_search_result_counts_; | 96 std::map<size_t, int> open_search_result_counts_; |
| 103 Users users_; | 97 Users users_; |
| 104 scoped_ptr<TestSigninDelegate> test_signin_delegate_; | |
| 105 scoped_ptr<AppListTestModel> model_; | 98 scoped_ptr<AppListTestModel> model_; |
| 106 ObserverList<AppListViewDelegateObserver> observers_; | 99 ObserverList<AppListViewDelegateObserver> observers_; |
| 107 SpeechUIModel speech_ui_; | 100 SpeechUIModel speech_ui_; |
| 108 base::TimeDelta auto_launch_timeout_; | 101 base::TimeDelta auto_launch_timeout_; |
| 109 | 102 |
| 110 DISALLOW_COPY_AND_ASSIGN(AppListTestViewDelegate); | 103 DISALLOW_COPY_AND_ASSIGN(AppListTestViewDelegate); |
| 111 }; | 104 }; |
| 112 | 105 |
| 113 } // namespace test | 106 } // namespace test |
| 114 } // namespace app_list | 107 } // namespace app_list |
| 115 | 108 |
| 116 #endif // UI_APP_LIST_TEST_APP_LIST_TEST_VIEW_DELEGATE_H_ | 109 #endif // UI_APP_LIST_TEST_APP_LIST_TEST_VIEW_DELEGATE_H_ |
| OLD | NEW |