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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "ash/common/material_design/material_design_controller.h" | |
13 #include "base/compiler_specific.h" | 14 #include "base/compiler_specific.h" |
14 #include "base/macros.h" | 15 #include "base/macros.h" |
15 #include "base/message_loop/message_loop.h" | 16 #include "base/message_loop/message_loop.h" |
16 #include "base/threading/thread.h" | 17 #include "base/threading/thread.h" |
17 #include "content/public/test/test_browser_thread_bundle.h" | 18 #include "content/public/test/test_browser_thread_bundle.h" |
18 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
19 #include "third_party/skia/include/core/SkColor.h" | 20 #include "third_party/skia/include/core/SkColor.h" |
20 #include "ui/display/display.h" | 21 #include "ui/display/display.h" |
21 #include "ui/wm/public/window_types.h" | 22 #include "ui/wm/public/window_types.h" |
22 | 23 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
131 static bool SupportsMultipleDisplays(); | 132 static bool SupportsMultipleDisplays(); |
132 | 133 |
133 // Proxy to AshTestHelper::SupportsHostWindowResize(). | 134 // Proxy to AshTestHelper::SupportsHostWindowResize(). |
134 static bool SupportsHostWindowResize(); | 135 static bool SupportsHostWindowResize(); |
135 | 136 |
136 // Returns the WmShelf for the primary display. | 137 // Returns the WmShelf for the primary display. |
137 static WmShelf* GetPrimaryShelf(); | 138 static WmShelf* GetPrimaryShelf(); |
138 | 139 |
139 void set_start_session(bool start_session) { start_session_ = start_session; } | 140 void set_start_session(bool start_session) { start_session_ = start_session; } |
140 | 141 |
142 // Sets material mode for the test. This will override material mode set via | |
143 // command line switches. | |
144 void set_material_mode(MaterialDesignController::Mode material_mode) { | |
145 material_mode_ = material_mode; | |
bruthig
2016/07/29 19:53:25
(In case this got lost)
Can you add 'CHECK(!setup
mohsen
2016/07/29 20:03:52
Oops! Done.
| |
146 } | |
147 | |
141 AshTestHelper* ash_test_helper() { return ash_test_helper_.get(); } | 148 AshTestHelper* ash_test_helper() { return ash_test_helper_.get(); } |
142 | 149 |
143 void RunAllPendingInMessageLoop(); | 150 void RunAllPendingInMessageLoop(); |
144 | 151 |
145 TestScreenshotDelegate* GetScreenshotDelegate(); | 152 TestScreenshotDelegate* GetScreenshotDelegate(); |
146 | 153 |
147 TestSystemTrayDelegate* GetSystemTrayDelegate(); | 154 TestSystemTrayDelegate* GetSystemTrayDelegate(); |
148 | 155 |
149 // Utility methods to emulate user logged in or not, session started or not | 156 // Utility methods to emulate user logged in or not, session started or not |
150 // and user able to lock screen or not cases. | 157 // and user able to lock screen or not cases. |
(...skipping 12 matching lines...) Expand all Loading... | |
163 void BlockUserSession(UserSessionBlockReason block_reason); | 170 void BlockUserSession(UserSessionBlockReason block_reason); |
164 void UnblockUserSession(); | 171 void UnblockUserSession(); |
165 | 172 |
166 void DisableIME(); | 173 void DisableIME(); |
167 | 174 |
168 private: | 175 private: |
169 bool setup_called_; | 176 bool setup_called_; |
170 bool teardown_called_; | 177 bool teardown_called_; |
171 // |SetUp()| doesn't activate session if this is set to false. | 178 // |SetUp()| doesn't activate session if this is set to false. |
172 bool start_session_; | 179 bool start_session_; |
180 MaterialDesignController::Mode material_mode_; | |
173 std::unique_ptr<content::TestBrowserThreadBundle> thread_bundle_; | 181 std::unique_ptr<content::TestBrowserThreadBundle> thread_bundle_; |
174 std::unique_ptr<AshTestHelper> ash_test_helper_; | 182 std::unique_ptr<AshTestHelper> ash_test_helper_; |
175 std::unique_ptr<ui::test::EventGenerator> event_generator_; | 183 std::unique_ptr<ui::test::EventGenerator> event_generator_; |
176 #if defined(OS_WIN) | 184 #if defined(OS_WIN) |
177 ui::ScopedOleInitializer ole_initializer_; | 185 ui::ScopedOleInitializer ole_initializer_; |
178 #endif | 186 #endif |
179 | 187 |
180 DISALLOW_COPY_AND_ASSIGN(AshTestBase); | 188 DISALLOW_COPY_AND_ASSIGN(AshTestBase); |
181 }; | 189 }; |
182 | 190 |
183 class NoSessionAshTestBase : public AshTestBase { | 191 class NoSessionAshTestBase : public AshTestBase { |
184 public: | 192 public: |
185 NoSessionAshTestBase() { set_start_session(false); } | 193 NoSessionAshTestBase() { set_start_session(false); } |
186 ~NoSessionAshTestBase() override {} | 194 ~NoSessionAshTestBase() override {} |
187 | 195 |
188 private: | 196 private: |
189 DISALLOW_COPY_AND_ASSIGN(NoSessionAshTestBase); | 197 DISALLOW_COPY_AND_ASSIGN(NoSessionAshTestBase); |
190 }; | 198 }; |
191 | 199 |
192 } // namespace test | 200 } // namespace test |
193 } // namespace ash | 201 } // namespace ash |
194 | 202 |
195 #endif // ASH_TEST_ASH_TEST_BASE_H_ | 203 #endif // ASH_TEST_ASH_TEST_BASE_H_ |
OLD | NEW |