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

Side by Side Diff: ash/mus/test/wm_test_helper.cc

Issue 2539363005: Converts ash to use aura-mus (Closed)
Patch Set: merge Created 4 years 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/mus/test/wm_test_helper.h" 5 #include "ash/mus/test/wm_test_helper.h"
6 6
7 #include "ash/common/material_design/material_design_controller.h" 7 #include "ash/common/material_design/material_design_controller.h"
8 #include "ash/common/test/material_design_controller_test_api.h" 8 #include "ash/common/test/material_design_controller_test_api.h"
9 #include "ash/common/test/test_new_window_client.h" 9 #include "ash/common/test/test_new_window_client.h"
10 #include "ash/common/test/test_system_tray_delegate.h" 10 #include "ash/common/test/test_system_tray_delegate.h"
11 #include "ash/common/test/wm_shell_test_api.h" 11 #include "ash/common/test/wm_shell_test_api.h"
12 #include "ash/common/wm_shell.h" 12 #include "ash/common/wm_shell.h"
13 #include "ash/mus/root_window_controller.h" 13 #include "ash/mus/root_window_controller.h"
14 #include "ash/mus/screen_mus.h"
14 #include "ash/mus/window_manager.h" 15 #include "ash/mus/window_manager.h"
15 #include "ash/mus/window_manager_application.h" 16 #include "ash/mus/window_manager_application.h"
16 #include "base/memory/ptr_util.h" 17 #include "base/memory/ptr_util.h"
17 #include "base/message_loop/message_loop.h" 18 #include "base/message_loop/message_loop.h"
18 #include "base/strings/string_number_conversions.h" 19 #include "base/strings/string_number_conversions.h"
19 #include "base/strings/string_split.h" 20 #include "base/strings/string_split.h"
20 #include "base/test/sequenced_worker_pool_owner.h" 21 #include "base/test/sequenced_worker_pool_owner.h"
21 #include "services/ui/public/cpp/property_type_converters.h" 22 #include "services/ui/public/cpp/property_type_converters.h"
22 #include "services/ui/public/cpp/tests/window_tree_client_private.h" 23 #include "ui/aura/mus/window_tree_client.h"
23 #include "services/ui/public/cpp/window_tree_client.h" 24 #include "ui/aura/test/env_test_helper.h"
25 #include "ui/aura/test/mus/window_tree_client_private.h"
26 #include "ui/aura/window.h"
24 #include "ui/base/material_design/material_design_controller.h" 27 #include "ui/base/material_design/material_design_controller.h"
25 #include "ui/base/test/material_design_controller_test_api.h" 28 #include "ui/base/test/material_design_controller_test_api.h"
26 #include "ui/display/display.h" 29 #include "ui/display/display.h"
27 #include "ui/display/display_list.h" 30 #include "ui/display/display_list.h"
28 #include "ui/display/screen_base.h" 31 #include "ui/display/screen_base.h"
29 #include "ui/views/test/test_views_delegate.h" 32 #include "ui/views/test/test_views_delegate.h"
30 33
31 namespace ash { 34 namespace ash {
32 namespace mus { 35 namespace mus {
33 namespace { 36 namespace {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 const size_t kMaxNumberThreads = 3u; // Matches that of content. 99 const size_t kMaxNumberThreads = 3u; // Matches that of content.
97 const char kThreadNamePrefix[] = "MashBlockingForTesting"; 100 const char kThreadNamePrefix[] = "MashBlockingForTesting";
98 blocking_pool_owner_ = base::MakeUnique<base::SequencedWorkerPoolOwner>( 101 blocking_pool_owner_ = base::MakeUnique<base::SequencedWorkerPoolOwner>(
99 kMaxNumberThreads, kThreadNamePrefix); 102 kMaxNumberThreads, kThreadNamePrefix);
100 103
101 window_manager_app_->window_manager_.reset(new WindowManager(nullptr)); 104 window_manager_app_->window_manager_.reset(new WindowManager(nullptr));
102 105
103 window_tree_client_setup_.InitForWindowManager( 106 window_tree_client_setup_.InitForWindowManager(
104 window_manager_app_->window_manager_.get(), 107 window_manager_app_->window_manager_.get(),
105 window_manager_app_->window_manager_.get()); 108 window_manager_app_->window_manager_.get());
109 aura::test::EnvTestHelper().SetWindowTreeClient(
110 window_tree_client_setup_.window_tree_client());
106 window_manager_app_->InitWindowManager( 111 window_manager_app_->InitWindowManager(
107 window_tree_client_setup_.OwnWindowTreeClient(), 112 window_tree_client_setup_.OwnWindowTreeClient(),
108 blocking_pool_owner_->pool()); 113 blocking_pool_owner_->pool());
109 114
110 // TODO(jamescook): Pass a TestShellDelegate into WindowManager and use it to 115 // TODO(jamescook): Pass a TestShellDelegate into WindowManager and use it to
111 // create the various test delegates. 116 // create the various test delegates.
112 WmShellTestApi().SetSystemTrayDelegate( 117 WmShellTestApi().SetSystemTrayDelegate(
113 base::MakeUnique<test::TestSystemTrayDelegate>()); 118 base::MakeUnique<test::TestSystemTrayDelegate>());
114 WmShellTestApi().SetNewWindowClient(base::MakeUnique<TestNewWindowClient>()); 119 WmShellTestApi().SetNewWindowClient(base::MakeUnique<TestNewWindowClient>());
115 120
116 ui::WindowTreeClient* window_tree_client = 121 aura::WindowTreeClient* window_tree_client =
117 window_manager_app_->window_manager()->window_tree_client(); 122 window_manager_app_->window_manager()->window_tree_client();
118 window_tree_client_private_ = 123 window_tree_client_private_ =
119 base::MakeUnique<ui::WindowTreeClientPrivate>(window_tree_client); 124 base::MakeUnique<aura::WindowTreeClientPrivate>(window_tree_client);
120 int next_x = 0; 125 int next_x = 0;
121 CreateRootWindowController("800x600", &next_x); 126 CreateRootWindowController("800x600", &next_x);
122 } 127 }
123 128
124 std::vector<RootWindowController*> WmTestHelper::GetRootsOrderedByDisplayId() { 129 std::vector<RootWindowController*> WmTestHelper::GetRootsOrderedByDisplayId() {
125 std::set<RootWindowController*> roots = 130 std::set<RootWindowController*> roots =
126 window_manager_app_->window_manager()->GetRootWindowControllers(); 131 window_manager_app_->window_manager()->GetRootWindowControllers();
127 std::vector<RootWindowController*> ordered_roots; 132 std::vector<RootWindowController*> ordered_roots;
128 ordered_roots.insert(ordered_roots.begin(), roots.begin(), roots.end()); 133 ordered_roots.insert(ordered_roots.begin(), roots.begin(), roots.end());
129 std::sort(ordered_roots.begin(), ordered_roots.end(), &CompareByDisplayId); 134 std::sort(ordered_roots.begin(), ordered_roots.end(), &CompareByDisplayId);
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 const std::string& display_spec, 177 const std::string& display_spec,
173 int* next_x) { 178 int* next_x) {
174 gfx::Rect bounds = ParseDisplayBounds(display_spec); 179 gfx::Rect bounds = ParseDisplayBounds(display_spec);
175 bounds.set_x(*next_x); 180 bounds.set_x(*next_x);
176 *next_x += bounds.size().width(); 181 *next_x += bounds.size().width();
177 gfx::Insets work_area_insets = 182 gfx::Insets work_area_insets =
178 root_window_controller->display_.GetWorkAreaInsets(); 183 root_window_controller->display_.GetWorkAreaInsets();
179 root_window_controller->display_.set_bounds(bounds); 184 root_window_controller->display_.set_bounds(bounds);
180 root_window_controller->display_.UpdateWorkAreaFromInsets(work_area_insets); 185 root_window_controller->display_.UpdateWorkAreaFromInsets(work_area_insets);
181 root_window_controller->root()->SetBounds(gfx::Rect(bounds.size())); 186 root_window_controller->root()->SetBounds(gfx::Rect(bounds.size()));
182 display::ScreenBase* screen = 187 ScreenMus* screen = window_manager_app_->window_manager()->screen_.get();
183 window_manager_app_->window_manager()->screen_.get();
184 const bool is_primary = screen->display_list().FindDisplayById( 188 const bool is_primary = screen->display_list().FindDisplayById(
185 root_window_controller->display().id()) == 189 root_window_controller->display().id()) ==
186 screen->display_list().GetPrimaryDisplayIterator(); 190 screen->display_list().GetPrimaryDisplayIterator();
187 screen->display_list().UpdateDisplay( 191 screen->display_list().UpdateDisplay(
188 root_window_controller->display(), 192 root_window_controller->display(),
189 is_primary ? display::DisplayList::Type::PRIMARY 193 is_primary ? display::DisplayList::Type::PRIMARY
190 : display::DisplayList::Type::NOT_PRIMARY); 194 : display::DisplayList::Type::NOT_PRIMARY);
191 } 195 }
192 196
193 } // namespace mus 197 } // namespace mus
194 } // namespace ash 198 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698