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_
10 #include "base/callback_forward.h"
11 #include "base/compiler_specific.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "base/observer_list.h"
14 #include "ui/app_list/app_list_view_delegate.h"
15 #include "ui/app_list/speech_ui_model.h"
20 class AppListTestModel;
21 class TestSigninDelegate;
23 // A concrete AppListViewDelegate for unit tests.
24 class AppListTestViewDelegate : public AppListViewDelegate {
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) {
35 void set_auto_launch_timeout(const base::TimeDelta& timeout) {
36 auto_launch_timeout_ = timeout;
39 // Sets the signin status of the signin delegate, creating one if there isn't
41 void SetSignedIn(bool signed_in);
43 // AppListViewDelegate overrides:
44 virtual bool ForceNativeDesktop() const OVERRIDE;
45 virtual void SetProfileByPath(const base::FilePath& profile_path) OVERRIDE {}
46 virtual AppListModel* GetModel() OVERRIDE;
47 virtual SigninDelegate* GetSigninDelegate() OVERRIDE;
48 virtual SpeechUIModel* GetSpeechUI() OVERRIDE;
49 virtual void GetShortcutPathForApp(
50 const std::string& app_id,
51 const base::Callback<void(const base::FilePath&)>& callback) OVERRIDE;
52 virtual void StartSearch() OVERRIDE {}
53 virtual void StopSearch() OVERRIDE {}
54 virtual void OpenSearchResult(SearchResult* result,
56 int event_flags) OVERRIDE;
57 virtual void InvokeSearchResultAction(SearchResult* result,
59 int event_flags) OVERRIDE {}
60 virtual base::TimeDelta GetAutoLaunchTimeout() OVERRIDE;
61 virtual void AutoLaunchCanceled() OVERRIDE;
62 virtual void ViewInitialized() OVERRIDE {}
63 virtual void Dismiss() OVERRIDE;
64 virtual void ViewClosing() OVERRIDE {}
65 virtual gfx::ImageSkia GetWindowIcon() OVERRIDE;
66 virtual void OpenSettings() OVERRIDE {}
67 virtual void OpenHelp() OVERRIDE {}
68 virtual void OpenFeedback() OVERRIDE {}
69 virtual void ToggleSpeechRecognition() OVERRIDE {}
70 virtual void ShowForProfileByPath(
71 const base::FilePath& profile_path) OVERRIDE {}
72 virtual content::WebContents* GetStartPageContents() OVERRIDE;
73 virtual content::WebContents* GetSpeechRecognitionContents() OVERRIDE;
74 virtual const Users& GetUsers() const OVERRIDE;
75 virtual void AddObserver(AppListViewDelegateObserver* observer) OVERRIDE;
76 virtual void RemoveObserver(AppListViewDelegateObserver* observer) OVERRIDE;
78 // Do a bulk replacement of the items in the model.
79 void ReplaceTestModel(int item_count);
81 AppListTestModel* ReleaseTestModel() { return model_.release(); }
82 AppListTestModel* GetTestModel() { return model_.get(); }
86 int open_search_result_count_;
88 scoped_ptr<TestSigninDelegate> test_signin_delegate_;
89 scoped_ptr<AppListTestModel> model_;
90 ObserverList<AppListViewDelegateObserver> observers_;
91 SpeechUIModel speech_ui_;
92 base::TimeDelta auto_launch_timeout_;
94 DISALLOW_COPY_AND_ASSIGN(AppListTestViewDelegate);
98 } // namespace app_list
100 #endif // UI_APP_LIST_TEST_APP_LIST_TEST_VIEW_DELEGATE_H_