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" | |
14 #include "base/macros.h" | 13 #include "base/macros.h" |
15 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
16 #include "base/threading/thread.h" | 15 #include "base/threading/thread.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
18 #include "third_party/skia/include/core/SkColor.h" | 17 #include "third_party/skia/include/core/SkColor.h" |
19 #include "ui/display/display.h" | 18 #include "ui/display/display.h" |
20 #include "ui/wm/public/window_types.h" | 19 #include "ui/wm/public/window_types.h" |
21 | 20 |
22 namespace aura { | 21 namespace aura { |
23 class Window; | 22 class Window; |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 }; | 132 }; |
134 | 133 |
135 // Returns the rotation currentl active for the display |id|. | 134 // Returns the rotation currentl active for the display |id|. |
136 static display::Display::Rotation GetActiveDisplayRotation(int64_t id); | 135 static display::Display::Rotation GetActiveDisplayRotation(int64_t id); |
137 | 136 |
138 // Returns the rotation currently active for the internal display. | 137 // Returns the rotation currently active for the internal display. |
139 static display::Display::Rotation GetCurrentInternalDisplayRotation(); | 138 static display::Display::Rotation GetCurrentInternalDisplayRotation(); |
140 | 139 |
141 void set_start_session(bool start_session) { start_session_ = start_session; } | 140 void set_start_session(bool start_session) { start_session_ = start_session; } |
142 | 141 |
143 // Sets material mode for the test. This will override material mode set via | |
144 // command line switches. | |
145 void set_material_mode(MaterialDesignController::Mode material_mode) { | |
146 CHECK(!setup_called_); | |
147 material_mode_ = material_mode; | |
148 } | |
149 | |
150 AshTestHelper* ash_test_helper() { return ash_test_helper_.get(); } | 142 AshTestHelper* ash_test_helper() { return ash_test_helper_.get(); } |
151 | 143 |
152 void RunAllPendingInMessageLoop(); | 144 void RunAllPendingInMessageLoop(); |
153 | 145 |
154 TestScreenshotDelegate* GetScreenshotDelegate(); | 146 TestScreenshotDelegate* GetScreenshotDelegate(); |
155 | 147 |
156 TestSystemTrayDelegate* GetSystemTrayDelegate(); | 148 TestSystemTrayDelegate* GetSystemTrayDelegate(); |
157 | 149 |
158 // Utility methods to emulate user logged in or not, session started or not | 150 // Utility methods to emulate user logged in or not, session started or not |
159 // and user able to lock screen or not cases. | 151 // and user able to lock screen or not cases. |
(...skipping 16 matching lines...) Expand all Loading... |
176 // Swap the primary display with the secondary. | 168 // Swap the primary display with the secondary. |
177 void SwapPrimaryDisplay(); | 169 void SwapPrimaryDisplay(); |
178 | 170 |
179 private: | 171 private: |
180 friend class ash::AshTestImplAura; | 172 friend class ash::AshTestImplAura; |
181 | 173 |
182 bool setup_called_; | 174 bool setup_called_; |
183 bool teardown_called_; | 175 bool teardown_called_; |
184 // |SetUp()| doesn't activate session if this is set to false. | 176 // |SetUp()| doesn't activate session if this is set to false. |
185 bool start_session_; | 177 bool start_session_; |
186 MaterialDesignController::Mode material_mode_; | |
187 std::unique_ptr<AshTestEnvironment> ash_test_environment_; | 178 std::unique_ptr<AshTestEnvironment> ash_test_environment_; |
188 std::unique_ptr<AshTestHelper> ash_test_helper_; | 179 std::unique_ptr<AshTestHelper> ash_test_helper_; |
189 std::unique_ptr<ui::test::EventGenerator> event_generator_; | 180 std::unique_ptr<ui::test::EventGenerator> event_generator_; |
190 | 181 |
191 DISALLOW_COPY_AND_ASSIGN(AshTestBase); | 182 DISALLOW_COPY_AND_ASSIGN(AshTestBase); |
192 }; | 183 }; |
193 | 184 |
194 class NoSessionAshTestBase : public AshTestBase { | 185 class NoSessionAshTestBase : public AshTestBase { |
195 public: | 186 public: |
196 NoSessionAshTestBase() { set_start_session(false); } | 187 NoSessionAshTestBase() { set_start_session(false); } |
197 ~NoSessionAshTestBase() override {} | 188 ~NoSessionAshTestBase() override {} |
198 | 189 |
199 private: | 190 private: |
200 DISALLOW_COPY_AND_ASSIGN(NoSessionAshTestBase); | 191 DISALLOW_COPY_AND_ASSIGN(NoSessionAshTestBase); |
201 }; | 192 }; |
202 | 193 |
203 } // namespace test | 194 } // namespace test |
204 } // namespace ash | 195 } // namespace ash |
205 | 196 |
206 #endif // ASH_TEST_ASH_TEST_BASE_H_ | 197 #endif // ASH_TEST_ASH_TEST_BASE_H_ |
OLD | NEW |