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

Side by Side Diff: ash/test/ash_test_base.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 (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/display/extended_mouse_warp_controller.h" 10 #include "ash/display/extended_mouse_warp_controller.h"
11 #include "ash/display/mouse_cursor_event_filter.h" 11 #include "ash/display/mouse_cursor_event_filter.h"
12 #include "ash/display/unified_mouse_warp_controller.h" 12 #include "ash/display/unified_mouse_warp_controller.h"
13 #include "ash/display/window_tree_host_manager.h" 13 #include "ash/display/window_tree_host_manager.h"
14 #include "ash/ime/input_method_event_handler.h" 14 #include "ash/ime/input_method_event_handler.h"
15 #include "ash/public/cpp/config.h" 15 #include "ash/public/cpp/config.h"
16 #include "ash/root_window_controller.h" 16 #include "ash/root_window_controller.h"
17 #include "ash/session/session_controller.h" 17 #include "ash/session/session_controller.h"
18 #include "ash/shell.h" 18 #include "ash/shell.h"
19 #include "ash/shell/toplevel_window.h" 19 #include "ash/shell/toplevel_window.h"
20 #include "ash/shell_port.h"
20 #include "ash/test/ash_test_environment.h" 21 #include "ash/test/ash_test_environment.h"
21 #include "ash/test/ash_test_helper.h" 22 #include "ash/test/ash_test_helper.h"
22 #include "ash/test/test_session_controller_client.h" 23 #include "ash/test/test_session_controller_client.h"
23 #include "ash/test/test_shell_delegate.h" 24 #include "ash/test/test_shell_delegate.h"
24 #include "ash/test/test_system_tray_delegate.h" 25 #include "ash/test/test_system_tray_delegate.h"
25 #include "ash/wm/window_positioner.h" 26 #include "ash/wm/window_positioner.h"
26 #include "ash/wm_shell.h"
27 #include "ash/wm_window.h" 27 #include "ash/wm_window.h"
28 #include "base/command_line.h" 28 #include "base/command_line.h"
29 #include "services/ui/public/interfaces/window_manager_constants.mojom.h" 29 #include "services/ui/public/interfaces/window_manager_constants.mojom.h"
30 #include "ui/aura/client/aura_constants.h" 30 #include "ui/aura/client/aura_constants.h"
31 #include "ui/aura/client/screen_position_client.h" 31 #include "ui/aura/client/screen_position_client.h"
32 #include "ui/aura/client/window_parenting_client.h" 32 #include "ui/aura/client/window_parenting_client.h"
33 #include "ui/aura/env.h" 33 #include "ui/aura/env.h"
34 #include "ui/aura/test/event_generator_delegate_aura.h" 34 #include "ui/aura/test/event_generator_delegate_aura.h"
35 #include "ui/aura/test/test_window_delegate.h" 35 #include "ui/aura/test/test_window_delegate.h"
36 #include "ui/aura/window.h" 36 #include "ui/aura/window.h"
(...skipping 21 matching lines...) Expand all
58 : public aura::test::EventGeneratorDelegateAura { 58 : public aura::test::EventGeneratorDelegateAura {
59 public: 59 public:
60 AshEventGeneratorDelegate() {} 60 AshEventGeneratorDelegate() {}
61 ~AshEventGeneratorDelegate() override {} 61 ~AshEventGeneratorDelegate() override {}
62 62
63 // aura::test::EventGeneratorDelegateAura overrides: 63 // aura::test::EventGeneratorDelegateAura overrides:
64 aura::WindowTreeHost* GetHostAt( 64 aura::WindowTreeHost* GetHostAt(
65 const gfx::Point& point_in_screen) const override { 65 const gfx::Point& point_in_screen) const override {
66 display::Screen* screen = display::Screen::GetScreen(); 66 display::Screen* screen = display::Screen::GetScreen();
67 display::Display display = screen->GetDisplayNearestPoint(point_in_screen); 67 display::Display display = screen->GetDisplayNearestPoint(point_in_screen);
68 return WmShell::Get() 68 return ShellPort::Get()
69 ->GetRootWindowForDisplayId(display.id()) 69 ->GetRootWindowForDisplayId(display.id())
70 ->aura_window() 70 ->aura_window()
71 ->GetHost(); 71 ->GetHost();
72 } 72 }
73 73
74 aura::client::ScreenPositionClient* GetScreenPositionClient( 74 aura::client::ScreenPositionClient* GetScreenPositionClient(
75 const aura::Window* window) const override { 75 const aura::Window* window) const override {
76 return aura::client::GetScreenPositionClient(window->GetRootWindow()); 76 return aura::client::GetScreenPositionClient(window->GetRootWindow());
77 } 77 }
78 78
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 ash_test_helper_->TearDown(); 159 ash_test_helper_->TearDown();
160 160
161 event_generator_.reset(); 161 event_generator_.reset();
162 // Some tests set an internal display id, 162 // Some tests set an internal display id,
163 // reset it here, so other tests will continue in a clean environment. 163 // reset it here, so other tests will continue in a clean environment.
164 display::Display::SetInternalDisplayId(display::kInvalidDisplayId); 164 display::Display::SetInternalDisplayId(display::kInvalidDisplayId);
165 } 165 }
166 166
167 // static 167 // static
168 WmShelf* AshTestBase::GetPrimaryShelf() { 168 WmShelf* AshTestBase::GetPrimaryShelf() {
169 return WmShell::Get() 169 return ShellPort::Get()
170 ->GetPrimaryRootWindow() 170 ->GetPrimaryRootWindow()
171 ->GetRootWindowController() 171 ->GetRootWindowController()
172 ->GetShelf(); 172 ->GetShelf();
173 } 173 }
174 174
175 // static 175 // static
176 SystemTray* AshTestBase::GetPrimarySystemTray() { 176 SystemTray* AshTestBase::GetPrimarySystemTray() {
177 return Shell::Get()->GetPrimarySystemTray(); 177 return Shell::Get()->GetPrimarySystemTray();
178 } 178 }
179 179
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 // static 215 // static
216 std::unique_ptr<views::Widget> AshTestBase::CreateTestWidget( 216 std::unique_ptr<views::Widget> AshTestBase::CreateTestWidget(
217 views::WidgetDelegate* delegate, 217 views::WidgetDelegate* delegate,
218 int container_id, 218 int container_id,
219 const gfx::Rect& bounds) { 219 const gfx::Rect& bounds) {
220 std::unique_ptr<views::Widget> widget(new views::Widget); 220 std::unique_ptr<views::Widget> widget(new views::Widget);
221 views::Widget::InitParams params; 221 views::Widget::InitParams params;
222 params.delegate = delegate; 222 params.delegate = delegate;
223 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 223 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
224 params.bounds = bounds; 224 params.bounds = bounds;
225 WmShell::Get() 225 ShellPort::Get()
226 ->GetPrimaryRootWindow() 226 ->GetPrimaryRootWindow()
227 ->GetRootWindowController() 227 ->GetRootWindowController()
228 ->ConfigureWidgetInitParamsForContainer(widget.get(), container_id, 228 ->ConfigureWidgetInitParamsForContainer(widget.get(), container_id,
229 &params); 229 &params);
230 widget->Init(params); 230 widget->Init(params);
231 widget->Show(); 231 widget->Show();
232 return widget; 232 return widget;
233 } 233 }
234 234
235 aura::Window* AshTestBase::CreateTestWindowInShellWithId(int id) { 235 aura::Window* AshTestBase::CreateTestWindowInShellWithId(int id) {
(...skipping 29 matching lines...) Expand all
265 window->set_id(id); 265 window->set_id(id);
266 window->SetType(type); 266 window->SetType(type);
267 window->Init(ui::LAYER_TEXTURED); 267 window->Init(ui::LAYER_TEXTURED);
268 window->Show(); 268 window->Show();
269 269
270 if (bounds.IsEmpty()) { 270 if (bounds.IsEmpty()) {
271 ParentWindowInPrimaryRootWindow(window); 271 ParentWindowInPrimaryRootWindow(window);
272 } else { 272 } else {
273 display::Display display = 273 display::Display display =
274 display::Screen::GetScreen()->GetDisplayMatching(bounds); 274 display::Screen::GetScreen()->GetDisplayMatching(bounds);
275 aura::Window* root = 275 aura::Window* root = ShellPort::Get()
276 WmShell::Get()->GetRootWindowForDisplayId(display.id())->aura_window(); 276 ->GetRootWindowForDisplayId(display.id())
277 ->aura_window();
277 gfx::Point origin = bounds.origin(); 278 gfx::Point origin = bounds.origin();
278 ::wm::ConvertPointFromScreen(root, &origin); 279 ::wm::ConvertPointFromScreen(root, &origin);
279 window->SetBounds(gfx::Rect(origin, bounds.size())); 280 window->SetBounds(gfx::Rect(origin, bounds.size()));
280 aura::client::ParentWindowWithContext(window, root, bounds); 281 aura::client::ParentWindowWithContext(window, root, bounds);
281 } 282 }
282 window->SetProperty(aura::client::kResizeBehaviorKey, 283 window->SetProperty(aura::client::kResizeBehaviorKey,
283 ui::mojom::kResizeBehaviorCanMaximize | 284 ui::mojom::kResizeBehaviorCanMaximize |
284 ui::mojom::kResizeBehaviorCanMinimize | 285 ui::mojom::kResizeBehaviorCanMinimize |
285 ui::mojom::kResizeBehaviorCanResize); 286 ui::mojom::kResizeBehaviorCanResize);
286 287
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 } 355 }
355 356
356 void AshTestBase::UnblockUserSession() { 357 void AshTestBase::UnblockUserSession() {
357 SetSessionStarted(true); 358 SetSessionStarted(true);
358 GetSessionControllerClient()->UnlockScreen(); 359 GetSessionControllerClient()->UnlockScreen();
359 } 360 }
360 361
361 void AshTestBase::DisableIME() { 362 void AshTestBase::DisableIME() {
362 // WindowTreeHostManager isn't applicable to mash and IME is routed 363 // WindowTreeHostManager isn't applicable to mash and IME is routed
363 // differently in mash. 364 // differently in mash.
364 if (WmShell::Get()->IsRunningInMash()) 365 if (ShellPort::Get()->IsRunningInMash())
365 return; 366 return;
366 367
367 Shell::Get()->RemovePreTargetHandler( 368 Shell::Get()->RemovePreTargetHandler(
368 Shell::Get()->window_tree_host_manager()->input_method_event_handler()); 369 Shell::Get()->window_tree_host_manager()->input_method_event_handler());
369 } 370 }
370 371
371 display::DisplayManager* AshTestBase::display_manager() { 372 display::DisplayManager* AshTestBase::display_manager() {
372 return Shell::Get()->display_manager(); 373 return Shell::Get()->display_manager();
373 } 374 }
374 375
(...skipping 20 matching lines...) Expand all
395 Shell::Get()->window_tree_host_manager()->SetPrimaryDisplayId( 396 Shell::Get()->window_tree_host_manager()->SetPrimaryDisplayId(
396 display_manager()->GetSecondaryDisplay().id()); 397 display_manager()->GetSecondaryDisplay().id());
397 } 398 }
398 399
399 display::Display AshTestBase::GetSecondaryDisplay() { 400 display::Display AshTestBase::GetSecondaryDisplay() {
400 return ash_test_helper_->GetSecondaryDisplay(); 401 return ash_test_helper_->GetSecondaryDisplay();
401 } 402 }
402 403
403 } // namespace test 404 } // namespace test
404 } // namespace ash 405 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698