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 "mash/wm/test/wm_test_helper.h" | 5 #include "ash/mus/test/wm_test_helper.h" |
6 | 6 |
7 #include "ash/mus/root_window_controller.h" | |
8 #include "ash/mus/test/wm_test_screen.h" | |
9 #include "ash/mus/window_manager.h" | |
10 #include "ash/mus/window_manager.h" | |
msw
2016/06/02 20:28:34
nit: remove duplicate include.
sky
2016/06/02 21:31:51
Done.
| |
11 #include "ash/mus/window_manager_application.h" | |
7 #include "base/message_loop/message_loop.h" | 12 #include "base/message_loop/message_loop.h" |
8 #include "components/mus/public/cpp/property_type_converters.h" | 13 #include "components/mus/public/cpp/property_type_converters.h" |
9 #include "components/mus/public/cpp/window_tree_client.h" | 14 #include "components/mus/public/cpp/window_tree_client.h" |
10 #include "mash/wm/root_window_controller.h" | |
11 #include "mash/wm/test/wm_test_screen.h" | |
12 #include "mash/wm/window_manager.h" | |
13 #include "mash/wm/window_manager.h" | |
14 #include "mash/wm/window_manager_application.h" | |
15 #include "ui/display/display.h" | 15 #include "ui/display/display.h" |
16 | 16 |
17 namespace mash { | 17 namespace ash { |
18 namespace wm { | 18 namespace mus { |
19 | 19 |
20 WmTestHelper::WmTestHelper() {} | 20 WmTestHelper::WmTestHelper() {} |
21 | 21 |
22 WmTestHelper::~WmTestHelper() {} | 22 WmTestHelper::~WmTestHelper() {} |
23 | 23 |
24 void WmTestHelper::Init() { | 24 void WmTestHelper::Init() { |
25 message_loop_.reset(new base::MessageLoopForUI()); | 25 message_loop_.reset(new base::MessageLoopForUI()); |
26 const uint32_t app_id = 1; | 26 const uint32_t app_id = 1; |
27 window_manager_app_.Initialize(nullptr, shell::Identity(), app_id); | 27 window_manager_app_.Initialize(nullptr, shell::Identity(), app_id); |
28 screen_ = new WmTestScreen; | 28 screen_ = new WmTestScreen; |
29 window_manager_app_.screen_.reset(screen_); | 29 window_manager_app_.screen_.reset(screen_); |
30 | 30 |
31 // RootWindowController controls its own lifetime. | 31 // RootWindowController controls its own lifetime. |
32 RootWindowController* root_window_controller = | 32 RootWindowController* root_window_controller = |
33 new RootWindowController(&window_manager_app_); | 33 new RootWindowController(&window_manager_app_); |
34 // Need an id other than kInvalidDisplayID so the Display is considered valid. | 34 // Need an id other than kInvalidDisplayID so the Display is considered valid. |
35 root_window_controller->display_.set_id(1); | 35 root_window_controller->display_.set_id(1); |
36 const gfx::Rect display_bounds(0, 0, 800, 600); | 36 const gfx::Rect display_bounds(0, 0, 800, 600); |
37 root_window_controller->display_.set_bounds(display_bounds); | 37 root_window_controller->display_.set_bounds(display_bounds); |
38 // Offset the height slightly to give a different work area. -20 is arbitrary, | 38 // Offset the height slightly to give a different work area. -20 is arbitrary, |
39 // it could be anything. | 39 // it could be anything. |
40 const gfx::Rect work_area(0, 0, display_bounds.width(), | 40 const gfx::Rect work_area(0, 0, display_bounds.width(), |
41 display_bounds.height() - 20); | 41 display_bounds.height() - 20); |
42 root_window_controller->display_.set_work_area(work_area); | 42 root_window_controller->display_.set_work_area(work_area); |
43 | 43 |
44 screen_->display_list()->AddDisplay(root_window_controller->display(), | 44 screen_->display_list()->AddDisplay(root_window_controller->display(), |
45 views::DisplayList::Type::PRIMARY); | 45 views::DisplayList::Type::PRIMARY); |
46 | 46 |
47 window_tree_client_setup_.Init( | 47 window_tree_client_setup_.Init(root_window_controller, |
48 root_window_controller, root_window_controller->window_manager_.get()); | 48 root_window_controller->window_manager_.get()); |
49 root_window_controller->root()->SetBounds(display_bounds); | 49 root_window_controller->root()->SetBounds(display_bounds); |
50 window_manager_app_.AddRootWindowController(root_window_controller); | 50 window_manager_app_.AddRootWindowController(root_window_controller); |
51 } | 51 } |
52 | 52 |
53 } // namespace wm | 53 } // namespace mus |
54 } // namespace mash | 54 } // namespace ash |
OLD | NEW |