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_ASH_TEST_BASE_H_ | 5 #ifndef ASH_TEST_ASH_TEST_BASE_H_ |
6 #define ASH_TEST_ASH_TEST_BASE_H_ | 6 #define ASH_TEST_ASH_TEST_BASE_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 }; | 103 }; |
104 | 104 |
105 // True if the running environment supports multiple displays, | 105 // True if the running environment supports multiple displays, |
106 // or false otherwise (e.g. win8 bot). | 106 // or false otherwise (e.g. win8 bot). |
107 static bool SupportsMultipleDisplays(); | 107 static bool SupportsMultipleDisplays(); |
108 | 108 |
109 // True if the running environment supports host window resize, | 109 // True if the running environment supports host window resize, |
110 // or false otherwise (e.g. win8 bot). | 110 // or false otherwise (e.g. win8 bot). |
111 static bool SupportsHostWindowResize(); | 111 static bool SupportsHostWindowResize(); |
112 | 112 |
| 113 void set_start_session(bool start_session) { start_session_ = start_session; } |
| 114 |
113 void RunAllPendingInMessageLoop(); | 115 void RunAllPendingInMessageLoop(); |
114 | 116 |
115 // Utility methods to emulate user logged in or not, session started or not | 117 // Utility methods to emulate user logged in or not, session started or not |
116 // and user able to lock screen or not cases. | 118 // and user able to lock screen or not cases. |
117 void SetSessionStarted(bool session_started); | 119 void SetSessionStarted(bool session_started); |
118 void SetUserLoggedIn(bool user_logged_in); | 120 void SetUserLoggedIn(bool user_logged_in); |
119 void SetCanLockScreen(bool can_lock_screen); | 121 void SetCanLockScreen(bool can_lock_screen); |
120 void SetUserAddingScreenRunning(bool user_adding_screen_running); | 122 void SetUserAddingScreenRunning(bool user_adding_screen_running); |
121 | 123 |
122 // Methods to emulate blocking and unblocking user session with given | 124 // Methods to emulate blocking and unblocking user session with given |
123 // |block_reason|. | 125 // |block_reason|. |
124 void BlockUserSession(UserSessionBlockReason block_reason); | 126 void BlockUserSession(UserSessionBlockReason block_reason); |
125 void UnblockUserSession(); | 127 void UnblockUserSession(); |
126 | 128 |
127 private: | 129 private: |
128 bool setup_called_; | 130 bool setup_called_; |
129 bool teardown_called_; | 131 bool teardown_called_; |
| 132 // |SetUp()| doesn't activate session if this is set to false. |
| 133 bool start_session_; |
130 content::TestBrowserThreadBundle thread_bundle_; | 134 content::TestBrowserThreadBundle thread_bundle_; |
131 scoped_ptr<AshTestHelper> ash_test_helper_; | 135 scoped_ptr<AshTestHelper> ash_test_helper_; |
132 scoped_ptr<aura::test::EventGenerator> event_generator_; | 136 scoped_ptr<aura::test::EventGenerator> event_generator_; |
133 #if defined(OS_WIN) | 137 #if defined(OS_WIN) |
134 // Note that the order is important here as ipc_thread_ should be destroyed | 138 // Note that the order is important here as ipc_thread_ should be destroyed |
135 // after metro_viewer_host_->channel_. | 139 // after metro_viewer_host_->channel_. |
136 scoped_ptr<base::Thread> ipc_thread_; | 140 scoped_ptr<base::Thread> ipc_thread_; |
137 scoped_ptr<TestMetroViewerProcessHost> metro_viewer_host_; | 141 scoped_ptr<TestMetroViewerProcessHost> metro_viewer_host_; |
138 ui::ScopedOleInitializer ole_initializer_; | 142 ui::ScopedOleInitializer ole_initializer_; |
139 #endif | 143 #endif |
140 | 144 |
141 DISALLOW_COPY_AND_ASSIGN(AshTestBase); | 145 DISALLOW_COPY_AND_ASSIGN(AshTestBase); |
142 }; | 146 }; |
143 | 147 |
| 148 class NoSessionAshTestBase : public AshTestBase { |
| 149 public: |
| 150 NoSessionAshTestBase() { |
| 151 set_start_session(false); |
| 152 } |
| 153 virtual ~NoSessionAshTestBase() {} |
| 154 |
| 155 private: |
| 156 DISALLOW_COPY_AND_ASSIGN(NoSessionAshTestBase); |
| 157 }; |
| 158 |
144 } // namespace test | 159 } // namespace test |
145 } // namespace ash | 160 } // namespace ash |
146 | 161 |
147 #endif // ASH_TEST_ASH_TEST_BASE_H_ | 162 #endif // ASH_TEST_ASH_TEST_BASE_H_ |
OLD | NEW |