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 TestSessionStateDelegate; | 21 class AshTestBase; |
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; |
29 virtual bool IsFirstRunAfterBoot() const OVERRIDE; | 32 virtual bool IsFirstRunAfterBoot() const OVERRIDE; |
30 virtual bool IsMultiProfilesEnabled() const OVERRIDE; | 33 virtual bool IsMultiProfilesEnabled() const OVERRIDE; |
31 virtual bool IsRunningInForcedAppMode() const OVERRIDE; | 34 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; |
32 virtual void PreInit() OVERRIDE; | 39 virtual void PreInit() OVERRIDE; |
33 virtual void Shutdown() OVERRIDE; | 40 virtual void Shutdown() OVERRIDE; |
34 virtual void Exit() OVERRIDE; | 41 virtual void Exit() OVERRIDE; |
35 virtual void NewTab() OVERRIDE; | 42 virtual void NewTab() OVERRIDE; |
36 virtual void NewWindow(bool incognito) OVERRIDE; | 43 virtual void NewWindow(bool incognito) OVERRIDE; |
37 virtual void ToggleMaximized() OVERRIDE; | 44 virtual void ToggleMaximized() OVERRIDE; |
38 virtual void OpenFileManager(bool as_dialog) OVERRIDE; | 45 virtual void OpenFileManager(bool as_dialog) OVERRIDE; |
39 virtual void OpenCrosh() OVERRIDE; | 46 virtual void OpenCrosh() OVERRIDE; |
40 virtual void OpenMobileSetup(const std::string& service_path) OVERRIDE; | 47 virtual void OpenMobileSetup(const std::string& service_path) OVERRIDE; |
41 virtual void RestoreTab() OVERRIDE; | 48 virtual void RestoreTab() OVERRIDE; |
(...skipping 12 matching lines...) Expand all Loading... |
54 virtual void SetMagnifierType(MagnifierType type) OVERRIDE; | 61 virtual void SetMagnifierType(MagnifierType type) OVERRIDE; |
55 virtual bool IsMagnifierEnabled() const OVERRIDE; | 62 virtual bool IsMagnifierEnabled() const OVERRIDE; |
56 virtual MagnifierType GetMagnifierType() const OVERRIDE; | 63 virtual MagnifierType GetMagnifierType() const OVERRIDE; |
57 virtual bool ShouldAlwaysShowAccessibilityMenu() const OVERRIDE; | 64 virtual bool ShouldAlwaysShowAccessibilityMenu() const OVERRIDE; |
58 virtual app_list::AppListViewDelegate* CreateAppListViewDelegate() OVERRIDE; | 65 virtual app_list::AppListViewDelegate* CreateAppListViewDelegate() OVERRIDE; |
59 virtual LauncherDelegate* CreateLauncherDelegate( | 66 virtual LauncherDelegate* CreateLauncherDelegate( |
60 ash::LauncherModel* model) OVERRIDE; | 67 ash::LauncherModel* model) OVERRIDE; |
61 virtual SystemTrayDelegate* CreateSystemTrayDelegate() OVERRIDE; | 68 virtual SystemTrayDelegate* CreateSystemTrayDelegate() OVERRIDE; |
62 virtual UserWallpaperDelegate* CreateUserWallpaperDelegate() OVERRIDE; | 69 virtual UserWallpaperDelegate* CreateUserWallpaperDelegate() OVERRIDE; |
63 virtual CapsLockDelegate* CreateCapsLockDelegate() OVERRIDE; | 70 virtual CapsLockDelegate* CreateCapsLockDelegate() OVERRIDE; |
64 virtual SessionStateDelegate* CreateSessionStateDelegate() OVERRIDE; | |
65 virtual aura::client::UserActionClient* CreateUserActionClient() OVERRIDE; | 71 virtual aura::client::UserActionClient* CreateUserActionClient() OVERRIDE; |
66 virtual void OpenFeedbackPage() OVERRIDE; | 72 virtual void OpenFeedbackPage() OVERRIDE; |
67 virtual void RecordUserMetricsAction(UserMetricsAction action) OVERRIDE; | 73 virtual void RecordUserMetricsAction(UserMetricsAction action) OVERRIDE; |
68 virtual void HandleMediaNextTrack() OVERRIDE; | 74 virtual void HandleMediaNextTrack() OVERRIDE; |
69 virtual void HandleMediaPlayPause() OVERRIDE; | 75 virtual void HandleMediaPlayPause() OVERRIDE; |
70 virtual void HandleMediaPrevTrack() OVERRIDE; | 76 virtual void HandleMediaPrevTrack() OVERRIDE; |
71 virtual base::string16 GetTimeRemainingString(base::TimeDelta delta) OVERRIDE; | 77 virtual base::string16 GetTimeRemainingString(base::TimeDelta delta) OVERRIDE; |
72 virtual base::string16 GetTimeDurationLongString( | 78 virtual base::string16 GetTimeDurationLongString( |
73 base::TimeDelta delta) OVERRIDE; | 79 base::TimeDelta delta) OVERRIDE; |
74 virtual void SaveScreenMagnifierScale(double scale) OVERRIDE; | 80 virtual void SaveScreenMagnifierScale(double scale) OVERRIDE; |
75 virtual double GetSavedScreenMagnifierScale() OVERRIDE; | 81 virtual double GetSavedScreenMagnifierScale() OVERRIDE; |
76 virtual ui::MenuModel* CreateContextMenu(aura::RootWindow* root) OVERRIDE; | 82 virtual ui::MenuModel* CreateContextMenu(aura::RootWindow* root) OVERRIDE; |
77 virtual RootWindowHostFactory* CreateRootWindowHostFactory() OVERRIDE; | 83 virtual RootWindowHostFactory* CreateRootWindowHostFactory() OVERRIDE; |
78 virtual base::string16 GetProductName() const OVERRIDE; | 84 virtual base::string16 GetProductName() const OVERRIDE; |
79 | 85 |
80 int num_exit_requests() const { return num_exit_requests_; } | 86 int num_exit_requests() const { return num_exit_requests_; } |
81 | 87 |
82 TestSessionStateDelegate* test_session_state_delegate(); | 88 private: |
| 89 friend class ash::test::AshTestBase; |
83 | 90 |
84 private: | 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_; |
85 bool spoken_feedback_enabled_; | 111 bool spoken_feedback_enabled_; |
86 bool high_contrast_enabled_; | 112 bool high_contrast_enabled_; |
87 bool screen_magnifier_enabled_; | 113 bool screen_magnifier_enabled_; |
88 MagnifierType screen_magnifier_type_; | 114 MagnifierType screen_magnifier_type_; |
| 115 bool user_logged_in_; |
| 116 bool can_lock_screen_; |
89 int num_exit_requests_; | 117 int num_exit_requests_; |
90 | 118 |
91 scoped_ptr<content::BrowserContext> current_browser_context_; | 119 scoped_ptr<content::BrowserContext> current_browser_context_; |
92 | 120 |
93 TestSessionStateDelegate* test_session_state_delegate_; // Not owned. | |
94 | |
95 DISALLOW_COPY_AND_ASSIGN(TestShellDelegate); | 121 DISALLOW_COPY_AND_ASSIGN(TestShellDelegate); |
96 }; | 122 }; |
97 | 123 |
98 } // namespace test | 124 } // namespace test |
99 } // namespace ash | 125 } // namespace ash |
100 | 126 |
101 #endif // ASH_TEST_TEST_SHELL_DELEGATE_H_ | 127 #endif // ASH_TEST_TEST_SHELL_DELEGATE_H_ |
OLD | NEW |