Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / ui / app_list / test / app_list_test_view_delegate.h
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.
4
5 #ifndef UI_APP_LIST_TEST_APP_LIST_TEST_VIEW_DELEGATE_H_
6 #define UI_APP_LIST_TEST_APP_LIST_TEST_VIEW_DELEGATE_H_
7
8 #include <string>
9
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"
16
17 namespace app_list {
18 namespace test {
19
20 class AppListTestModel;
21 class TestSigninDelegate;
22
23 // A concrete AppListViewDelegate for unit tests.
24 class AppListTestViewDelegate : public AppListViewDelegate {
25  public:
26   AppListTestViewDelegate();
27   virtual ~AppListTestViewDelegate();
28
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;
33   }
34
35   void set_auto_launch_timeout(const base::TimeDelta& timeout) {
36     auto_launch_timeout_ = timeout;
37   }
38
39   // Sets the signin status of the signin delegate, creating one if there isn't
40   // one already.
41   void SetSignedIn(bool signed_in);
42
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,
55                                 bool auto_launch,
56                                 int event_flags) OVERRIDE;
57   virtual void InvokeSearchResultAction(SearchResult* result,
58                                         int action_index,
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;
77
78   // Do a bulk replacement of the items in the model.
79   void ReplaceTestModel(int item_count);
80
81   AppListTestModel* ReleaseTestModel() { return model_.release(); }
82   AppListTestModel* GetTestModel() { return model_.get(); }
83
84  private:
85   int dismiss_count_;
86   int open_search_result_count_;
87   Users users_;
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_;
93
94   DISALLOW_COPY_AND_ASSIGN(AppListTestViewDelegate);
95 };
96
97 }  // namespace test
98 }  // namespace app_list
99
100 #endif  // UI_APP_LIST_TEST_APP_LIST_TEST_VIEW_DELEGATE_H_