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

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

Issue 2297893002: Merges RootWindowControllerCommon into WmRootWindowController (Closed)
Patch Set: includes Created 4 years, 3 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/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/mus/root_window_controller.h" 9 #include "ash/mus/root_window_controller.h"
10 #include "ash/mus/test/wm_test_screen.h" 10 #include "ash/mus/test/wm_test_screen.h"
11 #include "ash/mus/window_manager.h" 11 #include "ash/mus/window_manager.h"
12 #include "ash/mus/window_manager_application.h" 12 #include "ash/mus/window_manager_application.h"
13 #include "base/memory/ptr_util.h" 13 #include "base/memory/ptr_util.h"
14 #include "base/message_loop/message_loop.h" 14 #include "base/message_loop/message_loop.h"
15 #include "services/ui/public/cpp/property_type_converters.h" 15 #include "services/ui/public/cpp/property_type_converters.h"
16 #include "services/ui/public/cpp/tests/window_tree_client_private.h" 16 #include "services/ui/public/cpp/tests/window_tree_client_private.h"
17 #include "services/ui/public/cpp/window_tree_client.h" 17 #include "services/ui/public/cpp/window_tree_client.h"
18 #include "ui/base/material_design/material_design_controller.h" 18 #include "ui/base/material_design/material_design_controller.h"
19 #include "ui/base/test/material_design_controller_test_api.h" 19 #include "ui/base/test/material_design_controller_test_api.h"
20 #include "ui/display/display.h" 20 #include "ui/display/display.h"
21 21
22 namespace ash { 22 namespace ash {
23 namespace mus { 23 namespace mus {
24 24
25 WmTestHelper::WmTestHelper() {} 25 WmTestHelper::WmTestHelper() {}
26 26
27 WmTestHelper::~WmTestHelper() { 27 WmTestHelper::~WmTestHelper() {
28 window_manager_app_.window_manager_.reset(); 28 window_manager_app_.reset();
29 ash::test::MaterialDesignControllerTestAPI::Uninitialize(); 29 ash::test::MaterialDesignControllerTestAPI::Uninitialize();
30 ui::test::MaterialDesignControllerTestAPI::Uninitialize(); 30 ui::test::MaterialDesignControllerTestAPI::Uninitialize();
31 } 31 }
32 32
33 void WmTestHelper::Init() { 33 void WmTestHelper::Init() {
34 ui::MaterialDesignController::Initialize(); 34 ui::MaterialDesignController::Initialize();
35 ash::MaterialDesignController::Initialize(); 35 ash::MaterialDesignController::Initialize();
36 36
37 window_manager_app_ = base::MakeUnique<WindowManagerApplication>();
msw 2016/08/30 21:26:46 nit: maybe cite the reason for changing constructi
sky 2016/08/30 22:02:56 Added comment to destructor.
38
37 message_loop_.reset(new base::MessageLoopForUI()); 39 message_loop_.reset(new base::MessageLoopForUI());
38 window_manager_app_.window_manager_.reset(new WindowManager(nullptr)); 40 window_manager_app_->window_manager_.reset(new WindowManager(nullptr));
39 screen_ = new WmTestScreen; 41 screen_ = new WmTestScreen;
40 window_manager_app_.window_manager_->screen_.reset(screen_); 42 window_manager_app_->window_manager_->screen_.reset(screen_);
41 43
42 // Need an id other than kInvalidDisplayID so the Display is considered valid. 44 // Need an id other than kInvalidDisplayID so the Display is considered valid.
43 display::Display display(1); 45 display::Display display(1);
44 const gfx::Rect display_bounds(0, 0, 800, 600); 46 const gfx::Rect display_bounds(0, 0, 800, 600);
45 display.set_bounds(display_bounds); 47 display.set_bounds(display_bounds);
46 // Offset the height slightly to give a different work area. -20 is arbitrary, 48 // Offset the height slightly to give a different work area. -20 is arbitrary,
47 // it could be anything. 49 // it could be anything.
48 const gfx::Rect work_area(0, 0, display_bounds.width(), 50 const gfx::Rect work_area(0, 0, display_bounds.width(),
49 display_bounds.height() - 20); 51 display_bounds.height() - 20);
50 display.set_work_area(work_area); 52 display.set_work_area(work_area);
51 window_tree_client_setup_.InitForWindowManager( 53 window_tree_client_setup_.InitForWindowManager(
52 window_manager_app_.window_manager_.get(), 54 window_manager_app_->window_manager_.get(),
53 window_manager_app_.window_manager_.get(), display); 55 window_manager_app_->window_manager_.get(), display);
54 56
55 window_manager_app_.InitWindowManager( 57 window_manager_app_->InitWindowManager(
56 window_tree_client_setup_.window_tree_client()); 58 window_tree_client_setup_.window_tree_client());
57 59
58 screen_->display_list()->AddDisplay(display, 60 screen_->display_list()->AddDisplay(display,
59 views::DisplayList::Type::PRIMARY); 61 views::DisplayList::Type::PRIMARY);
60 62
61 ui::WindowTreeClientPrivate(window_tree_client_setup_.window_tree_client()) 63 ui::WindowTreeClientPrivate(window_tree_client_setup_.window_tree_client())
62 .CallWmNewDisplayAdded(display); 64 .CallWmNewDisplayAdded(display);
63 } 65 }
64 66
65 } // namespace mus 67 } // namespace mus
66 } // namespace ash 68 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698