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

Side by Side Diff: ash/test/ash_test.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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.h" 5 #include "ash/test/ash_test.h"
6 6
7 #include "ash/root_window_controller.h" 7 #include "ash/root_window_controller.h"
8 #include "ash/shelf/wm_shelf.h" 8 #include "ash/shelf/wm_shelf.h"
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/shell_port.h"
10 #include "ash/system/status_area_widget.h" 11 #include "ash/system/status_area_widget.h"
11 #include "ash/test/ash_test_impl.h" 12 #include "ash/test/ash_test_impl.h"
12 #include "ash/test/test_session_state_delegate.h" 13 #include "ash/test/test_session_state_delegate.h"
13 #include "ash/test/test_system_tray_delegate.h" 14 #include "ash/test/test_system_tray_delegate.h"
14 #include "ash/wm_shell.h"
15 #include "ash/wm_window.h" 15 #include "ash/wm_window.h"
16 #include "base/memory/ptr_util.h" 16 #include "base/memory/ptr_util.h"
17 #include "base/run_loop.h" 17 #include "base/run_loop.h"
18 #include "ui/aura/window.h" 18 #include "ui/aura/window.h"
19 #include "ui/compositor/layer_type.h" 19 #include "ui/compositor/layer_type.h"
20 #include "ui/display/display.h" 20 #include "ui/display/display.h"
21 21
22 namespace ash { 22 namespace ash {
23 23
24 WindowOwner::WindowOwner(WmWindow* window) : window_(window) {} 24 WindowOwner::WindowOwner(WmWindow* window) : window_(window) {}
25 25
26 WindowOwner::~WindowOwner() { 26 WindowOwner::~WindowOwner() {
27 window_->Destroy(); 27 window_->Destroy();
28 } 28 }
29 29
30 AshTest::AshTest() : test_impl_(AshTestImpl::Create()) {} 30 AshTest::AshTest() : test_impl_(AshTestImpl::Create()) {}
31 31
32 AshTest::~AshTest() {} 32 AshTest::~AshTest() {}
33 33
34 // static 34 // static
35 WmShelf* AshTest::GetPrimaryShelf() { 35 WmShelf* AshTest::GetPrimaryShelf() {
36 return WmShell::Get() 36 return ShellPort::Get()
37 ->GetPrimaryRootWindow() 37 ->GetPrimaryRootWindow()
38 ->GetRootWindowController() 38 ->GetRootWindowController()
39 ->GetShelf(); 39 ->GetShelf();
40 } 40 }
41 41
42 // static 42 // static
43 SystemTray* AshTest::GetPrimarySystemTray() { 43 SystemTray* AshTest::GetPrimarySystemTray() {
44 return GetPrimaryShelf()->GetStatusAreaWidget()->system_tray(); 44 return GetPrimaryShelf()->GetStatusAreaWidget()->system_tray();
45 } 45 }
46 46
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // static 84 // static
85 std::unique_ptr<views::Widget> AshTest::CreateTestWidget( 85 std::unique_ptr<views::Widget> AshTest::CreateTestWidget(
86 const gfx::Rect& bounds, 86 const gfx::Rect& bounds,
87 views::WidgetDelegate* delegate, 87 views::WidgetDelegate* delegate,
88 int container_id) { 88 int container_id) {
89 std::unique_ptr<views::Widget> widget(new views::Widget); 89 std::unique_ptr<views::Widget> widget(new views::Widget);
90 views::Widget::InitParams params; 90 views::Widget::InitParams params;
91 params.delegate = delegate; 91 params.delegate = delegate;
92 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; 92 params.ownership = views::Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET;
93 params.bounds = bounds; 93 params.bounds = bounds;
94 WmShell::Get() 94 ShellPort::Get()
95 ->GetPrimaryRootWindow() 95 ->GetPrimaryRootWindow()
96 ->GetRootWindowController() 96 ->GetRootWindowController()
97 ->ConfigureWidgetInitParamsForContainer(widget.get(), container_id, 97 ->ConfigureWidgetInitParamsForContainer(widget.get(), container_id,
98 &params); 98 &params);
99 widget->Init(params); 99 widget->Init(params);
100 widget->Show(); 100 widget->Show();
101 return widget; 101 return widget;
102 } 102 }
103 103
104 display::Display AshTest::GetSecondaryDisplay() { 104 display::Display AshTest::GetSecondaryDisplay() {
105 return test_impl_->GetSecondaryDisplay(); 105 return test_impl_->GetSecondaryDisplay();
106 } 106 }
107 107
108 bool AshTest::SetSecondaryDisplayPlacement( 108 bool AshTest::SetSecondaryDisplayPlacement(
109 display::DisplayPlacement::Position position, 109 display::DisplayPlacement::Position position,
110 int offset) { 110 int offset) {
111 if (WmShell::Get()->IsRunningInMash()) { 111 if (ShellPort::Get()->IsRunningInMash()) {
112 NOTIMPLEMENTED(); 112 NOTIMPLEMENTED();
113 return false; 113 return false;
114 } 114 }
115 return test_impl_->SetSecondaryDisplayPlacement(position, offset); 115 return test_impl_->SetSecondaryDisplayPlacement(position, offset);
116 } 116 }
117 117
118 void AshTest::ConfigureWidgetInitParamsForDisplay( 118 void AshTest::ConfigureWidgetInitParamsForDisplay(
119 WmWindow* window, 119 WmWindow* window,
120 views::Widget::InitParams* init_params) { 120 views::Widget::InitParams* init_params) {
121 test_impl_->ConfigureWidgetInitParamsForDisplay(window, init_params); 121 test_impl_->ConfigureWidgetInitParamsForDisplay(window, init_params);
122 } 122 }
123 123
124 void AshTest::ParentWindowInPrimaryRootWindow(WmWindow* window) { 124 void AshTest::ParentWindowInPrimaryRootWindow(WmWindow* window) {
125 window->SetParentUsingContext(WmShell::Get()->GetPrimaryRootWindow(), 125 window->SetParentUsingContext(ShellPort::Get()->GetPrimaryRootWindow(),
126 gfx::Rect()); 126 gfx::Rect());
127 } 127 }
128 128
129 void AshTest::AddTransientChild(WmWindow* parent, WmWindow* window) { 129 void AshTest::AddTransientChild(WmWindow* parent, WmWindow* window) {
130 test_impl_->AddTransientChild(parent, window); 130 test_impl_->AddTransientChild(parent, window);
131 } 131 }
132 132
133 void AshTest::RunAllPendingInMessageLoop() { 133 void AshTest::RunAllPendingInMessageLoop() {
134 base::RunLoop run_loop; 134 base::RunLoop run_loop;
135 run_loop.RunUntilIdle(); 135 run_loop.RunUntilIdle();
136 } 136 }
137 137
138 void AshTest::SetUp() { 138 void AshTest::SetUp() {
139 test_impl_->SetUp(); 139 test_impl_->SetUp();
140 } 140 }
141 141
142 void AshTest::TearDown() { 142 void AshTest::TearDown() {
143 test_impl_->TearDown(); 143 test_impl_->TearDown();
144 } 144 }
145 145
146 } // namespace ash 146 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698