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 #include "ash/test/ash_test_base.h" | 5 #include "ash/test/ash_test_base.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/ash_switches.h" | 10 #include "ash/ash_switches.h" |
11 #include "ash/common/wm/window_positioner.h" | 11 #include "ash/common/wm/window_positioner.h" |
| 12 #include "ash/common/wm_root_window_controller.h" |
12 #include "ash/common/wm_shell.h" | 13 #include "ash/common/wm_shell.h" |
| 14 #include "ash/common/wm_window.h" |
13 #include "ash/display/window_tree_host_manager.h" | 15 #include "ash/display/window_tree_host_manager.h" |
14 #include "ash/ime/input_method_event_handler.h" | 16 #include "ash/ime/input_method_event_handler.h" |
15 #include "ash/shell.h" | 17 #include "ash/shell.h" |
16 #include "ash/shell/toplevel_window.h" | 18 #include "ash/shell/toplevel_window.h" |
17 #include "ash/test/ash_test_helper.h" | 19 #include "ash/test/ash_test_helper.h" |
18 #include "ash/test/display_manager_test_api.h" | 20 #include "ash/test/display_manager_test_api.h" |
19 #include "ash/test/test_session_state_delegate.h" | 21 #include "ash/test/test_session_state_delegate.h" |
20 #include "ash/test/test_shell_delegate.h" | 22 #include "ash/test/test_shell_delegate.h" |
21 #include "ash/test/test_system_tray_delegate.h" | 23 #include "ash/test/test_system_tray_delegate.h" |
22 #include "base/command_line.h" | 24 #include "base/command_line.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 } | 174 } |
173 | 175 |
174 ui::test::EventGenerator& AshTestBase::GetEventGenerator() { | 176 ui::test::EventGenerator& AshTestBase::GetEventGenerator() { |
175 if (!event_generator_) { | 177 if (!event_generator_) { |
176 event_generator_.reset( | 178 event_generator_.reset( |
177 new ui::test::EventGenerator(new AshEventGeneratorDelegate())); | 179 new ui::test::EventGenerator(new AshEventGeneratorDelegate())); |
178 } | 180 } |
179 return *event_generator_.get(); | 181 return *event_generator_.get(); |
180 } | 182 } |
181 | 183 |
| 184 // static |
182 display::Display::Rotation AshTestBase::GetActiveDisplayRotation(int64_t id) { | 185 display::Display::Rotation AshTestBase::GetActiveDisplayRotation(int64_t id) { |
183 return Shell::GetInstance() | 186 return Shell::GetInstance() |
184 ->display_manager() | 187 ->display_manager() |
185 ->GetDisplayInfo(id) | 188 ->GetDisplayInfo(id) |
186 .GetActiveRotation(); | 189 .GetActiveRotation(); |
187 } | 190 } |
188 | 191 |
| 192 // static |
189 display::Display::Rotation AshTestBase::GetCurrentInternalDisplayRotation() { | 193 display::Display::Rotation AshTestBase::GetCurrentInternalDisplayRotation() { |
190 return GetActiveDisplayRotation(display::Display::InternalDisplayId()); | 194 return GetActiveDisplayRotation(display::Display::InternalDisplayId()); |
191 } | 195 } |
192 | 196 |
| 197 // static |
193 bool AshTestBase::SupportsMultipleDisplays() { | 198 bool AshTestBase::SupportsMultipleDisplays() { |
194 return AshTestHelper::SupportsMultipleDisplays(); | 199 return AshTestHelper::SupportsMultipleDisplays(); |
195 } | 200 } |
196 | 201 |
| 202 // static |
197 bool AshTestBase::SupportsHostWindowResize() { | 203 bool AshTestBase::SupportsHostWindowResize() { |
198 return AshTestHelper::SupportsHostWindowResize(); | 204 return AshTestHelper::SupportsHostWindowResize(); |
199 } | 205 } |
200 | 206 |
| 207 // static |
| 208 WmShelf* AshTestBase::GetPrimaryShelf() { |
| 209 return WmShell::Get() |
| 210 ->GetPrimaryRootWindow() |
| 211 ->GetRootWindowController() |
| 212 ->GetShelf(); |
| 213 } |
| 214 |
201 void AshTestBase::UpdateDisplay(const std::string& display_specs) { | 215 void AshTestBase::UpdateDisplay(const std::string& display_specs) { |
202 DisplayManagerTestApi().UpdateDisplay(display_specs); | 216 DisplayManagerTestApi().UpdateDisplay(display_specs); |
203 } | 217 } |
204 | 218 |
205 aura::Window* AshTestBase::CurrentContext() { | 219 aura::Window* AshTestBase::CurrentContext() { |
206 return ash_test_helper_->CurrentContext(); | 220 return ash_test_helper_->CurrentContext(); |
207 } | 221 } |
208 | 222 |
209 aura::Window* AshTestBase::CreateTestWindowInShellWithId(int id) { | 223 aura::Window* AshTestBase::CreateTestWindowInShellWithId(int id) { |
210 return CreateTestWindowInShellWithDelegate(NULL, id, gfx::Rect()); | 224 return CreateTestWindowInShellWithDelegate(NULL, id, gfx::Rect()); |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 | 355 |
342 void AshTestBase::DisableIME() { | 356 void AshTestBase::DisableIME() { |
343 Shell::GetInstance()->RemovePreTargetHandler( | 357 Shell::GetInstance()->RemovePreTargetHandler( |
344 Shell::GetInstance() | 358 Shell::GetInstance() |
345 ->window_tree_host_manager() | 359 ->window_tree_host_manager() |
346 ->input_method_event_handler()); | 360 ->input_method_event_handler()); |
347 } | 361 } |
348 | 362 |
349 } // namespace test | 363 } // namespace test |
350 } // namespace ash | 364 } // namespace ash |
OLD | NEW |