OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 ASH_TEST_TEST_SHELL_DELEGATE_H_ | 5 #ifndef ASH_TEST_TEST_SHELL_DELEGATE_H_ |
6 #define ASH_TEST_TEST_SHELL_DELEGATE_H_ | 6 #define ASH_TEST_TEST_SHELL_DELEGATE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "ash/shell_delegate.h" | 10 #include "ash/shell_delegate.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 | 13 |
14 namespace keyboard { | 14 namespace keyboard { |
15 class KeyboardControllerProxy; | 15 class KeyboardControllerProxy; |
16 } | 16 } |
17 | 17 |
18 namespace ash { | 18 namespace ash { |
19 namespace test { | 19 namespace test { |
20 | 20 |
21 class AshTestBase; | 21 class TestSessionStateDelegate; |
22 | 22 |
23 class TestShellDelegate : public ShellDelegate { | 23 class TestShellDelegate : public ShellDelegate { |
24 public: | 24 public: |
25 TestShellDelegate(); | 25 TestShellDelegate(); |
26 virtual ~TestShellDelegate(); | 26 virtual ~TestShellDelegate(); |
27 | 27 |
28 // Overridden from ShellDelegate: | 28 // Overridden from ShellDelegate: |
29 virtual bool IsUserLoggedIn() const OVERRIDE; | |
30 virtual bool IsSessionStarted() const OVERRIDE; | |
31 virtual bool IsGuestSession() const OVERRIDE; | |
32 virtual bool IsFirstRunAfterBoot() const OVERRIDE; | 29 virtual bool IsFirstRunAfterBoot() const OVERRIDE; |
33 virtual bool IsMultiProfilesEnabled() const OVERRIDE; | 30 virtual bool IsMultiProfilesEnabled() const OVERRIDE; |
34 virtual bool IsRunningInForcedAppMode() const OVERRIDE; | 31 virtual bool IsRunningInForcedAppMode() const OVERRIDE; |
35 virtual bool CanLockScreen() const OVERRIDE; | |
36 virtual void LockScreen() OVERRIDE; | |
37 virtual void UnlockScreen() OVERRIDE; | |
38 virtual bool IsScreenLocked() const OVERRIDE; | |
39 virtual void PreInit() OVERRIDE; | 32 virtual void PreInit() OVERRIDE; |
40 virtual void Shutdown() OVERRIDE; | 33 virtual void Shutdown() OVERRIDE; |
41 virtual void Exit() OVERRIDE; | 34 virtual void Exit() OVERRIDE; |
42 virtual void NewTab() OVERRIDE; | 35 virtual void NewTab() OVERRIDE; |
43 virtual void NewWindow(bool incognito) OVERRIDE; | 36 virtual void NewWindow(bool incognito) OVERRIDE; |
44 virtual void ToggleMaximized() OVERRIDE; | 37 virtual void ToggleMaximized() OVERRIDE; |
45 virtual void OpenFileManager(bool as_dialog) OVERRIDE; | 38 virtual void OpenFileManager(bool as_dialog) OVERRIDE; |
46 virtual void OpenCrosh() OVERRIDE; | 39 virtual void OpenCrosh() OVERRIDE; |
47 virtual void OpenMobileSetup(const std::string& service_path) OVERRIDE; | 40 virtual void OpenMobileSetup(const std::string& service_path) OVERRIDE; |
48 virtual void RestoreTab() OVERRIDE; | 41 virtual void RestoreTab() OVERRIDE; |
(...skipping 12 matching lines...) Expand all Loading... |
61 virtual void SetMagnifierType(MagnifierType type) OVERRIDE; | 54 virtual void SetMagnifierType(MagnifierType type) OVERRIDE; |
62 virtual bool IsMagnifierEnabled() const OVERRIDE; | 55 virtual bool IsMagnifierEnabled() const OVERRIDE; |
63 virtual MagnifierType GetMagnifierType() const OVERRIDE; | 56 virtual MagnifierType GetMagnifierType() const OVERRIDE; |
64 virtual bool ShouldAlwaysShowAccessibilityMenu() const OVERRIDE; | 57 virtual bool ShouldAlwaysShowAccessibilityMenu() const OVERRIDE; |
65 virtual app_list::AppListViewDelegate* CreateAppListViewDelegate() OVERRIDE; | 58 virtual app_list::AppListViewDelegate* CreateAppListViewDelegate() OVERRIDE; |
66 virtual LauncherDelegate* CreateLauncherDelegate( | 59 virtual LauncherDelegate* CreateLauncherDelegate( |
67 ash::LauncherModel* model) OVERRIDE; | 60 ash::LauncherModel* model) OVERRIDE; |
68 virtual SystemTrayDelegate* CreateSystemTrayDelegate() OVERRIDE; | 61 virtual SystemTrayDelegate* CreateSystemTrayDelegate() OVERRIDE; |
69 virtual UserWallpaperDelegate* CreateUserWallpaperDelegate() OVERRIDE; | 62 virtual UserWallpaperDelegate* CreateUserWallpaperDelegate() OVERRIDE; |
70 virtual CapsLockDelegate* CreateCapsLockDelegate() OVERRIDE; | 63 virtual CapsLockDelegate* CreateCapsLockDelegate() OVERRIDE; |
| 64 virtual SessionStateDelegate* CreateSessionStateDelegate() OVERRIDE; |
71 virtual aura::client::UserActionClient* CreateUserActionClient() OVERRIDE; | 65 virtual aura::client::UserActionClient* CreateUserActionClient() OVERRIDE; |
72 virtual void OpenFeedbackPage() OVERRIDE; | 66 virtual void OpenFeedbackPage() OVERRIDE; |
73 virtual void RecordUserMetricsAction(UserMetricsAction action) OVERRIDE; | 67 virtual void RecordUserMetricsAction(UserMetricsAction action) OVERRIDE; |
74 virtual void HandleMediaNextTrack() OVERRIDE; | 68 virtual void HandleMediaNextTrack() OVERRIDE; |
75 virtual void HandleMediaPlayPause() OVERRIDE; | 69 virtual void HandleMediaPlayPause() OVERRIDE; |
76 virtual void HandleMediaPrevTrack() OVERRIDE; | 70 virtual void HandleMediaPrevTrack() OVERRIDE; |
77 virtual base::string16 GetTimeRemainingString(base::TimeDelta delta) OVERRIDE; | 71 virtual base::string16 GetTimeRemainingString(base::TimeDelta delta) OVERRIDE; |
78 virtual base::string16 GetTimeDurationLongString( | 72 virtual base::string16 GetTimeDurationLongString( |
79 base::TimeDelta delta) OVERRIDE; | 73 base::TimeDelta delta) OVERRIDE; |
80 virtual void SaveScreenMagnifierScale(double scale) OVERRIDE; | 74 virtual void SaveScreenMagnifierScale(double scale) OVERRIDE; |
81 virtual double GetSavedScreenMagnifierScale() OVERRIDE; | 75 virtual double GetSavedScreenMagnifierScale() OVERRIDE; |
82 virtual ui::MenuModel* CreateContextMenu(aura::RootWindow* root) OVERRIDE; | 76 virtual ui::MenuModel* CreateContextMenu(aura::RootWindow* root) OVERRIDE; |
83 virtual RootWindowHostFactory* CreateRootWindowHostFactory() OVERRIDE; | 77 virtual RootWindowHostFactory* CreateRootWindowHostFactory() OVERRIDE; |
84 virtual base::string16 GetProductName() const OVERRIDE; | 78 virtual base::string16 GetProductName() const OVERRIDE; |
85 | 79 |
86 int num_exit_requests() const { return num_exit_requests_; } | 80 int num_exit_requests() const { return num_exit_requests_; } |
87 | 81 |
| 82 TestSessionStateDelegate* test_session_state_delegate(); |
| 83 |
88 private: | 84 private: |
89 friend class ash::test::AshTestBase; | |
90 | |
91 // Given |session_started| will update internal state. | |
92 // If |session_started| is true this method will also set | |
93 // |user_logged_in_| to true. | |
94 // When session is started it always means that user has logged in. | |
95 // Possible situation is that user has already logged in but session has not | |
96 // been started (user selects avatar and login window is still open). | |
97 void SetSessionStarted(bool session_started); | |
98 | |
99 // Given |user_logged_in| will update internal state. | |
100 // If |user_logged_in| is false this method will also set |session_started_| | |
101 // to false. When user is not logged in it always means that session | |
102 // hasn't been started too. | |
103 void SetUserLoggedIn(bool user_logged_in); | |
104 | |
105 // Sets the internal state that indicates whether the user can lock the | |
106 // screen. | |
107 void SetCanLockScreen(bool can_lock_screen); | |
108 | |
109 bool locked_; | |
110 bool session_started_; | |
111 bool spoken_feedback_enabled_; | 85 bool spoken_feedback_enabled_; |
112 bool high_contrast_enabled_; | 86 bool high_contrast_enabled_; |
113 bool screen_magnifier_enabled_; | 87 bool screen_magnifier_enabled_; |
114 MagnifierType screen_magnifier_type_; | 88 MagnifierType screen_magnifier_type_; |
115 bool user_logged_in_; | |
116 bool can_lock_screen_; | |
117 int num_exit_requests_; | 89 int num_exit_requests_; |
118 | 90 |
119 scoped_ptr<content::BrowserContext> current_browser_context_; | 91 scoped_ptr<content::BrowserContext> current_browser_context_; |
120 | 92 |
| 93 TestSessionStateDelegate* test_session_state_delegate_; // Not owned. |
| 94 |
121 DISALLOW_COPY_AND_ASSIGN(TestShellDelegate); | 95 DISALLOW_COPY_AND_ASSIGN(TestShellDelegate); |
122 }; | 96 }; |
123 | 97 |
124 } // namespace test | 98 } // namespace test |
125 } // namespace ash | 99 } // namespace ash |
126 | 100 |
127 #endif // ASH_TEST_TEST_SHELL_DELEGATE_H_ | 101 #endif // ASH_TEST_TEST_SHELL_DELEGATE_H_ |
OLD | NEW |