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