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

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

Issue 2633293005: Converts mash to use Shell (Closed)
Patch Set: feedback Created 3 years, 11 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/mus/shell_delegate_mus.cc ('k') | ash/mus/window_manager.h » ('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/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_system_tray_delegate.h" 9 #include "ash/common/test/test_system_tray_delegate.h"
10 #include "ash/common/test/wm_shell_test_api.h" 10 #include "ash/common/test/wm_shell_test_api.h"
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 window_manager_app_ = base::MakeUnique<WindowManagerApplication>(); 94 window_manager_app_ = base::MakeUnique<WindowManagerApplication>();
95 95
96 message_loop_.reset(new base::MessageLoopForUI()); 96 message_loop_.reset(new base::MessageLoopForUI());
97 97
98 const size_t kMaxNumberThreads = 3u; // Matches that of content. 98 const size_t kMaxNumberThreads = 3u; // Matches that of content.
99 const char kThreadNamePrefix[] = "MashBlockingForTesting"; 99 const char kThreadNamePrefix[] = "MashBlockingForTesting";
100 blocking_pool_owner_ = base::MakeUnique<base::SequencedWorkerPoolOwner>( 100 blocking_pool_owner_ = base::MakeUnique<base::SequencedWorkerPoolOwner>(
101 kMaxNumberThreads, kThreadNamePrefix); 101 kMaxNumberThreads, kThreadNamePrefix);
102 102
103 window_manager_app_->window_manager_.reset(new WindowManager(nullptr)); 103 window_manager_app_->window_manager_.reset(new WindowManager(nullptr));
104 window_manager_app_->window_manager()->system_tray_delegate_for_test_ =
105 base::MakeUnique<test::TestSystemTrayDelegate>();
104 106
105 window_tree_client_setup_.InitForWindowManager( 107 window_tree_client_setup_.InitForWindowManager(
106 window_manager_app_->window_manager_.get(), 108 window_manager_app_->window_manager_.get(),
107 window_manager_app_->window_manager_.get()); 109 window_manager_app_->window_manager_.get());
108 aura::test::EnvTestHelper().SetWindowTreeClient( 110 aura::test::EnvTestHelper().SetWindowTreeClient(
109 window_tree_client_setup_.window_tree_client()); 111 window_tree_client_setup_.window_tree_client());
110 window_manager_app_->InitWindowManager( 112 window_manager_app_->InitWindowManager(
111 window_tree_client_setup_.OwnWindowTreeClient(), 113 window_tree_client_setup_.OwnWindowTreeClient(),
112 blocking_pool_owner_->pool()); 114 blocking_pool_owner_->pool());
113 115
114 // TODO(jamescook): Pass a TestShellDelegate into WindowManager and use it to
115 // create the various test delegates.
116 WmShellTestApi().SetSystemTrayDelegate(
117 base::MakeUnique<test::TestSystemTrayDelegate>());
118
119 aura::WindowTreeClient* window_tree_client = 116 aura::WindowTreeClient* window_tree_client =
120 window_manager_app_->window_manager()->window_tree_client(); 117 window_manager_app_->window_manager()->window_tree_client();
121 window_tree_client_private_ = 118 window_tree_client_private_ =
122 base::MakeUnique<aura::WindowTreeClientPrivate>(window_tree_client); 119 base::MakeUnique<aura::WindowTreeClientPrivate>(window_tree_client);
123 int next_x = 0; 120 int next_x = 0;
124 CreateRootWindowController("800x600", &next_x); 121 CreateRootWindowController("800x600", &next_x);
125 } 122 }
126 123
127 std::vector<RootWindowController*> WmTestHelper::GetRootsOrderedByDisplayId() { 124 std::vector<RootWindowController*> WmTestHelper::GetRootsOrderedByDisplayId() {
128 std::set<RootWindowController*> roots = 125 std::set<RootWindowController*> roots =
(...skipping 12 matching lines...) Expand all
141 int next_x = 0; 138 int next_x = 0;
142 for (size_t i = 0, 139 for (size_t i = 0,
143 end = std::min(parts.size(), root_window_controllers.size()); 140 end = std::min(parts.size(), root_window_controllers.size());
144 i < end; ++i) { 141 i < end; ++i) {
145 UpdateDisplay(root_window_controllers[i], parts[i], &next_x); 142 UpdateDisplay(root_window_controllers[i], parts[i], &next_x);
146 } 143 }
147 for (size_t i = root_window_controllers.size(); i < parts.size(); ++i) { 144 for (size_t i = root_window_controllers.size(); i < parts.size(); ++i) {
148 root_window_controllers.push_back( 145 root_window_controllers.push_back(
149 CreateRootWindowController(parts[i], &next_x)); 146 CreateRootWindowController(parts[i], &next_x));
150 } 147 }
148 const bool in_shutdown = false;
151 while (root_window_controllers.size() > parts.size()) { 149 while (root_window_controllers.size() > parts.size()) {
152 window_manager_app_->window_manager()->DestroyRootWindowController( 150 window_manager_app_->window_manager()->DestroyRootWindowController(
153 root_window_controllers.back()); 151 root_window_controllers.back(), in_shutdown);
154 root_window_controllers.pop_back(); 152 root_window_controllers.pop_back();
155 } 153 }
156 } 154 }
157 155
158 RootWindowController* WmTestHelper::CreateRootWindowController( 156 RootWindowController* WmTestHelper::CreateRootWindowController(
159 const std::string& display_spec, 157 const std::string& display_spec,
160 int* next_x) { 158 int* next_x) {
161 gfx::Rect bounds = ParseDisplayBounds(display_spec); 159 gfx::Rect bounds = ParseDisplayBounds(display_spec);
162 bounds.set_x(*next_x); 160 bounds.set_x(*next_x);
163 *next_x += bounds.size().width(); 161 *next_x += bounds.size().width();
(...skipping 23 matching lines...) Expand all
187 root_window_controller->display().id()) == 185 root_window_controller->display().id()) ==
188 screen->display_list().GetPrimaryDisplayIterator(); 186 screen->display_list().GetPrimaryDisplayIterator();
189 screen->display_list().UpdateDisplay( 187 screen->display_list().UpdateDisplay(
190 root_window_controller->display(), 188 root_window_controller->display(),
191 is_primary ? display::DisplayList::Type::PRIMARY 189 is_primary ? display::DisplayList::Type::PRIMARY
192 : display::DisplayList::Type::NOT_PRIMARY); 190 : display::DisplayList::Type::NOT_PRIMARY);
193 } 191 }
194 192
195 } // namespace mus 193 } // namespace mus
196 } // namespace ash 194 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/shell_delegate_mus.cc ('k') | ash/mus/window_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698