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

Side by Side Diff: ash/common/test/ash_test.cc

Issue 2733303004: Removes WmShell::NewWindow() (Closed)
Patch Set: merge and feedback Created 3 years, 9 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
« no previous file with comments | « ash/common/shelf/shelf_window_watcher_unittest.cc ('k') | ash/common/wm/window_dimmer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/common/test/ash_test.h" 5 #include "ash/common/test/ash_test.h"
6 6
7 #include "ash/common/shelf/wm_shelf.h" 7 #include "ash/common/shelf/wm_shelf.h"
8 #include "ash/common/system/status_area_widget.h" 8 #include "ash/common/system/status_area_widget.h"
9 #include "ash/common/test/ash_test_impl.h" 9 #include "ash/common/test/ash_test_impl.h"
10 #include "ash/common/test/test_session_state_delegate.h" 10 #include "ash/common/test/test_session_state_delegate.h"
11 #include "ash/common/test/test_system_tray_delegate.h" 11 #include "ash/common/test/test_system_tray_delegate.h"
12 #include "ash/common/wm_shell.h" 12 #include "ash/common/wm_shell.h"
13 #include "ash/common/wm_window.h" 13 #include "ash/common/wm_window.h"
14 #include "ash/root_window_controller.h" 14 #include "ash/root_window_controller.h"
15 #include "base/memory/ptr_util.h" 15 #include "base/memory/ptr_util.h"
16 #include "base/run_loop.h" 16 #include "base/run_loop.h"
17 #include "ui/aura/window.h"
17 #include "ui/compositor/layer_type.h" 18 #include "ui/compositor/layer_type.h"
18 #include "ui/display/display.h" 19 #include "ui/display/display.h"
19 20
20 namespace ash { 21 namespace ash {
21 22
22 WindowOwner::WindowOwner(WmWindow* window) : window_(window) {} 23 WindowOwner::WindowOwner(WmWindow* window) : window_(window) {}
23 24
24 WindowOwner::~WindowOwner() { 25 WindowOwner::~WindowOwner() {
25 window_->Destroy(); 26 window_->Destroy();
26 } 27 }
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 std::unique_ptr<WindowOwner> AshTest::CreateToplevelTestWindow( 62 std::unique_ptr<WindowOwner> AshTest::CreateToplevelTestWindow(
62 const gfx::Rect& bounds_in_screen, 63 const gfx::Rect& bounds_in_screen,
63 int shell_window_id) { 64 int shell_window_id) {
64 return test_impl_->CreateToplevelTestWindow(bounds_in_screen, 65 return test_impl_->CreateToplevelTestWindow(bounds_in_screen,
65 shell_window_id); 66 shell_window_id);
66 } 67 }
67 68
68 std::unique_ptr<WindowOwner> AshTest::CreateChildWindow(WmWindow* parent, 69 std::unique_ptr<WindowOwner> AshTest::CreateChildWindow(WmWindow* parent,
69 const gfx::Rect& bounds, 70 const gfx::Rect& bounds,
70 int shell_window_id) { 71 int shell_window_id) {
72 aura::Window* window = new aura::Window(nullptr, ui::wm::WINDOW_TYPE_NORMAL);
73 window->Init(ui::LAYER_NOT_DRAWN);
71 std::unique_ptr<WindowOwner> window_owner = 74 std::unique_ptr<WindowOwner> window_owner =
72 base::MakeUnique<WindowOwner>(WmShell::Get()->NewWindow( 75 base::MakeUnique<WindowOwner>(WmWindow::Get(window));
73 ui::wm::WINDOW_TYPE_NORMAL, ui::LAYER_NOT_DRAWN)); 76 window->SetBounds(bounds);
74 window_owner->window()->SetBounds(bounds); 77 window->set_id(shell_window_id);
75 window_owner->window()->SetShellWindowId(shell_window_id); 78 parent->aura_window()->AddChild(window);
76 parent->AddChild(window_owner->window()); 79 window->Show();
77 window_owner->window()->Show();
78 return window_owner; 80 return window_owner;
79 } 81 }
80 82
81 // static 83 // static
82 std::unique_ptr<views::Widget> AshTest::CreateTestWidget( 84 std::unique_ptr<views::Widget> AshTest::CreateTestWidget(
83 const gfx::Rect& bounds, 85 const gfx::Rect& bounds,
84 views::WidgetDelegate* delegate, 86 views::WidgetDelegate* delegate,
85 int container_id) { 87 int container_id) {
86 std::unique_ptr<views::Widget> widget(new views::Widget); 88 std::unique_ptr<views::Widget> widget(new views::Widget);
87 views::Widget::InitParams params; 89 views::Widget::InitParams params;
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 136
135 void AshTest::SetUp() { 137 void AshTest::SetUp() {
136 test_impl_->SetUp(); 138 test_impl_->SetUp();
137 } 139 }
138 140
139 void AshTest::TearDown() { 141 void AshTest::TearDown() {
140 test_impl_->TearDown(); 142 test_impl_->TearDown();
141 } 143 }
142 144
143 } // namespace ash 145 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/shelf/shelf_window_watcher_unittest.cc ('k') | ash/common/wm/window_dimmer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698