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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 | 88 |
89 // Attach |window| to the current shell's root window. | 89 // Attach |window| to the current shell's root window. |
90 void SetDefaultParentByPrimaryRootWindow(aura::Window* window); | 90 void SetDefaultParentByPrimaryRootWindow(aura::Window* window); |
91 | 91 |
92 // Returns the EventGenerator that uses screen coordinates and works | 92 // Returns the EventGenerator that uses screen coordinates and works |
93 // across multiple displays. It createse a new generator if it | 93 // across multiple displays. It createse a new generator if it |
94 // hasn't been created yet. | 94 // hasn't been created yet. |
95 aura::test::EventGenerator& GetEventGenerator(); | 95 aura::test::EventGenerator& GetEventGenerator(); |
96 | 96 |
97 protected: | 97 protected: |
| 98 enum UserSessionBlockReason { |
| 99 FIRST_BLOCK_REASON, |
| 100 BLOCKED_BY_LOCK_SCREEN = FIRST_BLOCK_REASON, |
| 101 BLOCKED_BY_LOGIN_SCREEN, |
| 102 BLOCKED_BY_USER_ADDING_SCREEN, |
| 103 NUMBER_OF_BLOCK_REASONS |
| 104 }; |
| 105 |
98 // True if the running environment supports multiple displays, | 106 // True if the running environment supports multiple displays, |
99 // or false otherwise (e.g. win8 bot). | 107 // or false otherwise (e.g. win8 bot). |
100 static bool SupportsMultipleDisplays(); | 108 static bool SupportsMultipleDisplays(); |
101 | 109 |
102 // True if the running environment supports host window resize, | 110 // True if the running environment supports host window resize, |
103 // or false otherwise (e.g. win8 bot). | 111 // or false otherwise (e.g. win8 bot). |
104 static bool SupportsHostWindowResize(); | 112 static bool SupportsHostWindowResize(); |
105 | 113 |
106 void RunAllPendingInMessageLoop(); | 114 void RunAllPendingInMessageLoop(); |
107 | 115 |
108 // Utility methods to emulate user logged in or not, session started or not | 116 // Utility methods to emulate user logged in or not, session started or not |
109 // and user able to lock screen or not cases. | 117 // and user able to lock screen or not cases. |
110 void SetSessionStarted(bool session_started); | 118 void SetSessionStarted(bool session_started); |
111 void SetUserLoggedIn(bool user_logged_in); | 119 void SetUserLoggedIn(bool user_logged_in); |
112 void SetCanLockScreen(bool can_lock_screen); | 120 void SetCanLockScreen(bool can_lock_screen); |
| 121 void SetUserAddingScreenRunning(bool user_adding_screen_running); |
| 122 |
| 123 // Methods to emulate blocking and unblocking user session with given |
| 124 // |block_reason|. |
| 125 void BlockUserSession(UserSessionBlockReason block_reason); |
| 126 void UnblockUserSession(); |
113 | 127 |
114 private: | 128 private: |
115 bool setup_called_; | 129 bool setup_called_; |
116 bool teardown_called_; | 130 bool teardown_called_; |
117 base::MessageLoopForUI message_loop_; | 131 base::MessageLoopForUI message_loop_; |
118 scoped_ptr<AshTestHelper> ash_test_helper_; | 132 scoped_ptr<AshTestHelper> ash_test_helper_; |
119 scoped_ptr<aura::test::EventGenerator> event_generator_; | 133 scoped_ptr<aura::test::EventGenerator> event_generator_; |
120 #if defined(OS_WIN) | 134 #if defined(OS_WIN) |
121 // Note that the order is important here as ipc_thread_ should be destroyed | 135 // Note that the order is important here as ipc_thread_ should be destroyed |
122 // after metro_viewer_host_->channel_. | 136 // after metro_viewer_host_->channel_. |
123 scoped_ptr<base::Thread> ipc_thread_; | 137 scoped_ptr<base::Thread> ipc_thread_; |
124 scoped_ptr<TestMetroViewerProcessHost> metro_viewer_host_; | 138 scoped_ptr<TestMetroViewerProcessHost> metro_viewer_host_; |
125 ui::ScopedOleInitializer ole_initializer_; | 139 ui::ScopedOleInitializer ole_initializer_; |
126 #endif | 140 #endif |
127 | 141 |
128 DISALLOW_COPY_AND_ASSIGN(AshTestBase); | 142 DISALLOW_COPY_AND_ASSIGN(AshTestBase); |
129 }; | 143 }; |
130 | 144 |
131 } // namespace test | 145 } // namespace test |
132 } // namespace ash | 146 } // namespace ash |
133 | 147 |
134 #endif // ASH_TEST_ASH_TEST_BASE_H_ | 148 #endif // ASH_TEST_ASH_TEST_BASE_H_ |
OLD | NEW |