OLD | NEW |
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/mus/root_window_controller.h" | 7 #include "ash/mus/root_window_controller.h" |
8 #include "ash/mus/test/wm_test_screen.h" | 8 #include "ash/mus/test/wm_test_screen.h" |
9 #include "ash/mus/window_manager.h" | 9 #include "ash/mus/window_manager.h" |
10 #include "ash/mus/window_manager_application.h" | 10 #include "ash/mus/window_manager_application.h" |
11 #include "base/memory/ptr_util.h" | 11 #include "base/memory/ptr_util.h" |
12 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
13 #include "components/mus/public/cpp/property_type_converters.h" | 13 #include "components/mus/public/cpp/property_type_converters.h" |
14 #include "components/mus/public/cpp/tests/window_tree_client_private.h" | 14 #include "components/mus/public/cpp/tests/window_tree_client_private.h" |
15 #include "components/mus/public/cpp/window_tree_client.h" | 15 #include "components/mus/public/cpp/window_tree_client.h" |
16 #include "ui/display/display.h" | 16 #include "ui/display/display.h" |
17 | 17 |
18 namespace ash { | 18 namespace ash { |
19 namespace mus { | 19 namespace mus { |
20 | 20 |
21 WmTestHelper::WmTestHelper() {} | 21 WmTestHelper::WmTestHelper() {} |
22 | 22 |
23 WmTestHelper::~WmTestHelper() {} | 23 WmTestHelper::~WmTestHelper() {} |
24 | 24 |
25 void WmTestHelper::Init() { | 25 void WmTestHelper::Init() { |
26 message_loop_.reset(new base::MessageLoopForUI()); | 26 message_loop_.reset(new base::MessageLoopForUI()); |
27 window_manager_app_.window_manager_.reset( | 27 window_manager_app_.window_manager_.reset(new WindowManager(nullptr)); |
28 new WindowManager(&window_manager_app_, nullptr)); | |
29 screen_ = new WmTestScreen; | 28 screen_ = new WmTestScreen; |
30 window_manager_app_.window_manager_->screen_.reset(screen_); | 29 window_manager_app_.window_manager_->screen_.reset(screen_); |
31 | 30 |
32 // Need an id other than kInvalidDisplayID so the Display is considered valid. | 31 // Need an id other than kInvalidDisplayID so the Display is considered valid. |
33 display::Display display(1); | 32 display::Display display(1); |
34 const gfx::Rect display_bounds(0, 0, 800, 600); | 33 const gfx::Rect display_bounds(0, 0, 800, 600); |
35 display.set_bounds(display_bounds); | 34 display.set_bounds(display_bounds); |
36 // Offset the height slightly to give a different work area. -20 is arbitrary, | 35 // Offset the height slightly to give a different work area. -20 is arbitrary, |
37 // it could be anything. | 36 // it could be anything. |
38 const gfx::Rect work_area(0, 0, display_bounds.width(), | 37 const gfx::Rect work_area(0, 0, display_bounds.width(), |
39 display_bounds.height() - 20); | 38 display_bounds.height() - 20); |
40 display.set_work_area(work_area); | 39 display.set_work_area(work_area); |
41 window_tree_client_setup_.InitForWindowManager( | 40 window_tree_client_setup_.InitForWindowManager( |
42 window_manager_app_.window_manager_.get(), | 41 window_manager_app_.window_manager_.get(), |
43 window_manager_app_.window_manager_.get(), display); | 42 window_manager_app_.window_manager_.get(), display); |
44 | 43 |
45 window_manager_app_.InitWindowManager( | 44 window_manager_app_.InitWindowManager( |
46 window_tree_client_setup_.window_tree_client()); | 45 window_tree_client_setup_.window_tree_client()); |
47 | 46 |
48 screen_->display_list()->AddDisplay(display, | 47 screen_->display_list()->AddDisplay(display, |
49 views::DisplayList::Type::PRIMARY); | 48 views::DisplayList::Type::PRIMARY); |
50 | 49 |
51 ::mus::WindowTreeClientPrivate(window_tree_client_setup_.window_tree_client()) | 50 ::mus::WindowTreeClientPrivate(window_tree_client_setup_.window_tree_client()) |
52 .CallWmNewDisplayAdded(display); | 51 .CallWmNewDisplayAdded(display); |
53 } | 52 } |
54 | 53 |
55 } // namespace mus | 54 } // namespace mus |
56 } // namespace ash | 55 } // namespace ash |
OLD | NEW |