Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(237)

Side by Side Diff: ash/test/ash_test_helper.cc

Issue 2808723004: Renames WmShell to ShellPort (Closed)
Patch Set: feedback Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_helper.h" 5 #include "ash/test/ash_test_helper.h"
6 6
7 #include "ash/accelerators/accelerator_controller_delegate_aura.h" 7 #include "ash/accelerators/accelerator_controller_delegate_aura.h"
8 #include "ash/aura/wm_shell_aura.h" 8 #include "ash/aura/shell_port_classic.h"
9 #include "ash/mus/bridge/wm_shell_mus.h" 9 #include "ash/mus/bridge/shell_port_mash.h"
10 #include "ash/mus/screen_mus.h" 10 #include "ash/mus/screen_mus.h"
11 #include "ash/mus/window_manager.h" 11 #include "ash/mus/window_manager.h"
12 #include "ash/mus/window_manager_application.h" 12 #include "ash/mus/window_manager_application.h"
13 #include "ash/public/cpp/config.h" 13 #include "ash/public/cpp/config.h"
14 #include "ash/shell.h" 14 #include "ash/shell.h"
15 #include "ash/shell_init_params.h" 15 #include "ash/shell_init_params.h"
16 #include "ash/shell_port.h"
16 #include "ash/system/screen_layout_observer.h" 17 #include "ash/system/screen_layout_observer.h"
17 #include "ash/test/ash_test_environment.h" 18 #include "ash/test/ash_test_environment.h"
18 #include "ash/test/ash_test_views_delegate.h" 19 #include "ash/test/ash_test_views_delegate.h"
19 #include "ash/test/display_configuration_controller_test_api.h" 20 #include "ash/test/display_configuration_controller_test_api.h"
20 #include "ash/test/test_screenshot_delegate.h" 21 #include "ash/test/test_screenshot_delegate.h"
21 #include "ash/test/test_session_state_delegate.h" 22 #include "ash/test/test_session_state_delegate.h"
22 #include "ash/test/test_shell_delegate.h" 23 #include "ash/test/test_shell_delegate.h"
23 #include "ash/test/test_system_tray_delegate.h" 24 #include "ash/test/test_system_tray_delegate.h"
24 #include "ash/wm_shell.h"
25 #include "ash/wm_window.h" 25 #include "ash/wm_window.h"
26 #include "base/memory/ptr_util.h" 26 #include "base/memory/ptr_util.h"
27 #include "base/run_loop.h" 27 #include "base/run_loop.h"
28 #include "base/strings/string_split.h" 28 #include "base/strings/string_split.h"
29 #include "base/test/sequenced_worker_pool_owner.h" 29 #include "base/test/sequenced_worker_pool_owner.h"
30 #include "chromeos/audio/cras_audio_handler.h" 30 #include "chromeos/audio/cras_audio_handler.h"
31 #include "chromeos/dbus/dbus_thread_manager.h" 31 #include "chromeos/dbus/dbus_thread_manager.h"
32 #include "chromeos/network/network_handler.h" 32 #include "chromeos/network/network_handler.h"
33 #include "device/bluetooth/bluetooth_adapter_factory.h" 33 #include "device/bluetooth/bluetooth_adapter_factory.h"
34 #include "device/bluetooth/dbus/bluez_dbus_manager.h" 34 #include "device/bluetooth/dbus/bluez_dbus_manager.h"
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 // DisplayManager is specific to classic-ash. 160 // DisplayManager is specific to classic-ash.
161 display::test::DisplayManagerTestApi(shell->display_manager()) 161 display::test::DisplayManagerTestApi(shell->display_manager())
162 .DisableChangeDisplayUponHostResize(); 162 .DisableChangeDisplayUponHostResize();
163 DisplayConfigurationControllerTestApi( 163 DisplayConfigurationControllerTestApi(
164 shell->display_configuration_controller()) 164 shell->display_configuration_controller())
165 .DisableDisplayAnimator(); 165 .DisableDisplayAnimator();
166 166
167 // TODO: disabled for mash as AcceleratorControllerDelegateAura isn't 167 // TODO: disabled for mash as AcceleratorControllerDelegateAura isn't
168 // created in mash http://crbug.com/632111. 168 // created in mash http://crbug.com/632111.
169 test_screenshot_delegate_ = new TestScreenshotDelegate(); 169 test_screenshot_delegate_ = new TestScreenshotDelegate();
170 WmShellAura::Get() 170 ShellPortClassic::Get()
171 ->accelerator_controller_delegate() 171 ->accelerator_controller_delegate()
172 ->SetScreenshotDelegate( 172 ->SetScreenshotDelegate(
173 std::unique_ptr<ScreenshotDelegate>(test_screenshot_delegate_)); 173 std::unique_ptr<ScreenshotDelegate>(test_screenshot_delegate_));
174 } else if (config_ == Config::MUS) { 174 } else if (config_ == Config::MUS) {
175 test_screenshot_delegate_ = new TestScreenshotDelegate(); 175 test_screenshot_delegate_ = new TestScreenshotDelegate();
176 mus::WmShellMus::Get() 176 mus::ShellPortMash::Get()
177 ->accelerator_controller_delegate_mus() 177 ->accelerator_controller_delegate_mus()
178 ->SetScreenshotDelegate( 178 ->SetScreenshotDelegate(
179 std::unique_ptr<ScreenshotDelegate>(test_screenshot_delegate_)); 179 std::unique_ptr<ScreenshotDelegate>(test_screenshot_delegate_));
180 } 180 }
181 } 181 }
182 182
183 void AshTestHelper::TearDown() { 183 void AshTestHelper::TearDown() {
184 window_manager_app_.reset(); 184 window_manager_app_.reset();
185 185
186 // WindowManger owns the Shell in mash. 186 // WindowManger owns the Shell in mash.
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 CHECK(config_ != Config::CLASSIC || !::wm::CaptureController::Get()); 224 CHECK(config_ != Config::CLASSIC || !::wm::CaptureController::Get());
225 } 225 }
226 226
227 void AshTestHelper::RunAllPendingInMessageLoop() { 227 void AshTestHelper::RunAllPendingInMessageLoop() {
228 base::RunLoop run_loop; 228 base::RunLoop run_loop;
229 run_loop.RunUntilIdle(); 229 run_loop.RunUntilIdle();
230 } 230 }
231 231
232 // static 232 // static
233 TestSessionStateDelegate* AshTestHelper::GetTestSessionStateDelegate() { 233 TestSessionStateDelegate* AshTestHelper::GetTestSessionStateDelegate() {
234 CHECK(WmShell::HasInstance()); 234 CHECK(ShellPort::HasInstance());
235 return static_cast<TestSessionStateDelegate*>( 235 return static_cast<TestSessionStateDelegate*>(
236 WmShell::Get()->GetSessionStateDelegate()); 236 ShellPort::Get()->GetSessionStateDelegate());
237 } 237 }
238 238
239 aura::Window* AshTestHelper::CurrentContext() { 239 aura::Window* AshTestHelper::CurrentContext() {
240 aura::Window* root_window = Shell::GetRootWindowForNewWindows(); 240 aura::Window* root_window = Shell::GetRootWindowForNewWindows();
241 if (!root_window) 241 if (!root_window)
242 root_window = Shell::GetPrimaryRootWindow(); 242 root_window = Shell::GetPrimaryRootWindow();
243 DCHECK(root_window); 243 DCHECK(root_window);
244 return root_window; 244 return root_window;
245 } 245 }
246 246
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
376 std::set<RootWindowController*> roots = 376 std::set<RootWindowController*> roots =
377 window_manager_app_->window_manager()->GetRootWindowControllers(); 377 window_manager_app_->window_manager()->GetRootWindowControllers();
378 std::vector<RootWindowController*> ordered_roots; 378 std::vector<RootWindowController*> ordered_roots;
379 ordered_roots.insert(ordered_roots.begin(), roots.begin(), roots.end()); 379 ordered_roots.insert(ordered_roots.begin(), roots.begin(), roots.end());
380 std::sort(ordered_roots.begin(), ordered_roots.end(), &CompareByDisplayId); 380 std::sort(ordered_roots.begin(), ordered_roots.end(), &CompareByDisplayId);
381 return ordered_roots; 381 return ordered_roots;
382 } 382 }
383 383
384 } // namespace test 384 } // namespace test
385 } // namespace ash 385 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698