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

Side by Side Diff: ash/test/ash_test_helper.cc

Issue 2910773002: cros: CustomFrameViewAsh avatar icon from a window prop (Closed)
Patch Set: add test Created 3 years, 6 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/test/ash_test_helper.h ('k') | ash/test/shell_test_api.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_helper.h" 5 #include "ash/test/ash_test_helper.h"
6 6
7 #include <algorithm>
8 #include <set>
9
7 #include "ash/accelerators/accelerator_controller_delegate_aura.h" 10 #include "ash/accelerators/accelerator_controller_delegate_aura.h"
8 #include "ash/ash_switches.h" 11 #include "ash/ash_switches.h"
9 #include "ash/aura/shell_port_classic.h" 12 #include "ash/aura/shell_port_classic.h"
10 #include "ash/mus/bridge/shell_port_mash.h" 13 #include "ash/mus/bridge/shell_port_mash.h"
11 #include "ash/mus/screen_mus.h" 14 #include "ash/mus/screen_mus.h"
12 #include "ash/mus/window_manager.h" 15 #include "ash/mus/window_manager.h"
13 #include "ash/mus/window_manager_application.h" 16 #include "ash/mus/window_manager_application.h"
14 #include "ash/public/cpp/config.h" 17 #include "ash/public/cpp/config.h"
15 #include "ash/shell.h" 18 #include "ash/shell.h"
16 #include "ash/shell_init_params.h" 19 #include "ash/shell_init_params.h"
17 #include "ash/shell_port.h" 20 #include "ash/shell_port.h"
18 #include "ash/system/screen_layout_observer.h" 21 #include "ash/system/screen_layout_observer.h"
19 #include "ash/test/ash_test_environment.h" 22 #include "ash/test/ash_test_environment.h"
20 #include "ash/test/ash_test_views_delegate.h" 23 #include "ash/test/ash_test_views_delegate.h"
21 #include "ash/test/display_configuration_controller_test_api.h" 24 #include "ash/test/display_configuration_controller_test_api.h"
22 #include "ash/test/test_screenshot_delegate.h" 25 #include "ash/test/test_screenshot_delegate.h"
23 #include "ash/test/test_session_state_delegate.h"
24 #include "ash/test/test_shell_delegate.h" 26 #include "ash/test/test_shell_delegate.h"
25 #include "ash/test/test_system_tray_delegate.h" 27 #include "ash/test/test_system_tray_delegate.h"
26 #include "ash/wm_window.h" 28 #include "ash/wm_window.h"
27 #include "base/memory/ptr_util.h" 29 #include "base/memory/ptr_util.h"
28 #include "base/run_loop.h" 30 #include "base/run_loop.h"
29 #include "base/strings/string_split.h" 31 #include "base/strings/string_split.h"
30 #include "base/test/sequenced_worker_pool_owner.h" 32 #include "base/test/sequenced_worker_pool_owner.h"
31 #include "chromeos/audio/cras_audio_handler.h" 33 #include "chromeos/audio/cras_audio_handler.h"
32 #include "chromeos/cryptohome/system_salt_getter.h" 34 #include "chromeos/cryptohome/system_salt_getter.h"
33 #include "chromeos/dbus/dbus_thread_manager.h" 35 #include "chromeos/dbus/dbus_thread_manager.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 261
260 // WindowManager owns the CaptureController for mus/mash. 262 // WindowManager owns the CaptureController for mus/mash.
261 CHECK(config_ != Config::CLASSIC || !::wm::CaptureController::Get()); 263 CHECK(config_ != Config::CLASSIC || !::wm::CaptureController::Get());
262 } 264 }
263 265
264 void AshTestHelper::RunAllPendingInMessageLoop() { 266 void AshTestHelper::RunAllPendingInMessageLoop() {
265 base::RunLoop run_loop; 267 base::RunLoop run_loop;
266 run_loop.RunUntilIdle(); 268 run_loop.RunUntilIdle();
267 } 269 }
268 270
269 // static
270 TestSessionStateDelegate* AshTestHelper::GetTestSessionStateDelegate() {
271 CHECK(ShellPort::HasInstance());
272 return static_cast<TestSessionStateDelegate*>(
273 ShellPort::Get()->GetSessionStateDelegate());
274 }
275
276 aura::Window* AshTestHelper::CurrentContext() { 271 aura::Window* AshTestHelper::CurrentContext() {
277 aura::Window* root_window = Shell::GetRootWindowForNewWindows(); 272 aura::Window* root_window = Shell::GetRootWindowForNewWindows();
278 if (!root_window) 273 if (!root_window)
279 root_window = Shell::GetPrimaryRootWindow(); 274 root_window = Shell::GetPrimaryRootWindow();
280 DCHECK(root_window); 275 DCHECK(root_window);
281 return root_window; 276 return root_window;
282 } 277 }
283 278
284 void AshTestHelper::UpdateDisplayForMash(const std::string& display_spec) { 279 void AshTestHelper::UpdateDisplayForMash(const std::string& display_spec) {
285 // TODO(erg): This is not equivalent to display::DisplayManager:: 280 // TODO(erg): This is not equivalent to display::DisplayManager::
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 void AshTestHelper::CreateMashWindowManager() { 320 void AshTestHelper::CreateMashWindowManager() {
326 CHECK(config_ != Config::CLASSIC); 321 CHECK(config_ != Config::CLASSIC);
327 const bool show_primary_root_on_connect = false; 322 const bool show_primary_root_on_connect = false;
328 window_manager_app_ = base::MakeUnique<mus::WindowManagerApplication>( 323 window_manager_app_ = base::MakeUnique<mus::WindowManagerApplication>(
329 show_primary_root_on_connect); 324 show_primary_root_on_connect);
330 325
331 window_manager_app_->window_manager_.reset( 326 window_manager_app_->window_manager_.reset(
332 new mus::WindowManager(nullptr, config_, show_primary_root_on_connect)); 327 new mus::WindowManager(nullptr, config_, show_primary_root_on_connect));
333 window_manager_app_->window_manager()->shell_delegate_.reset( 328 window_manager_app_->window_manager()->shell_delegate_.reset(
334 test_shell_delegate_); 329 test_shell_delegate_);
335 window_manager_app_->window_manager()
336 ->create_session_state_delegate_stub_for_test_ = false;
337 330
338 window_tree_client_setup_.InitForWindowManager( 331 window_tree_client_setup_.InitForWindowManager(
339 window_manager_app_->window_manager_.get(), 332 window_manager_app_->window_manager_.get(),
340 window_manager_app_->window_manager_.get()); 333 window_manager_app_->window_manager_.get());
341 aura::test::EnvTestHelper().SetWindowTreeClient( 334 aura::test::EnvTestHelper().SetWindowTreeClient(
342 window_tree_client_setup_.window_tree_client()); 335 window_tree_client_setup_.window_tree_client());
343 // Classic ash does not start the NetworkHandler in tests, so don't start it 336 // Classic ash does not start the NetworkHandler in tests, so don't start it
344 // for mash either. The NetworkHandler may cause subtle side effects (such as 337 // for mash either. The NetworkHandler may cause subtle side effects (such as
345 // additional tray items) that can make for flaky tests. 338 // additional tray items) that can make for flaky tests.
346 const bool init_network_handler = false; 339 const bool init_network_handler = false;
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 std::set<RootWindowController*> roots = 408 std::set<RootWindowController*> roots =
416 window_manager_app_->window_manager()->GetRootWindowControllers(); 409 window_manager_app_->window_manager()->GetRootWindowControllers();
417 std::vector<RootWindowController*> ordered_roots; 410 std::vector<RootWindowController*> ordered_roots;
418 ordered_roots.insert(ordered_roots.begin(), roots.begin(), roots.end()); 411 ordered_roots.insert(ordered_roots.begin(), roots.begin(), roots.end());
419 std::sort(ordered_roots.begin(), ordered_roots.end(), &CompareByDisplayId); 412 std::sort(ordered_roots.begin(), ordered_roots.end(), &CompareByDisplayId);
420 return ordered_roots; 413 return ordered_roots;
421 } 414 }
422 415
423 } // namespace test 416 } // namespace test
424 } // namespace ash 417 } // namespace ash
OLDNEW
« no previous file with comments | « ash/test/ash_test_helper.h ('k') | ash/test/shell_test_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698