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

Side by Side Diff: ash/mus/window_manager_unittest.cc

Issue 2823903005: Extracts parameters to WindowTreeHostMus into structure (Closed)
Patch Set: cleanup Created 3 years, 8 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <map> 5 #include <map>
6 #include <memory> 6 #include <memory>
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/public/interfaces/constants.mojom.h" 9 #include "ash/public/interfaces/constants.mojom.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "services/service_manager/public/cpp/service_test.h" 13 #include "services/service_manager/public/cpp/service_test.h"
14 #include "services/ui/public/cpp/property_type_converters.h" 14 #include "services/ui/public/cpp/property_type_converters.h"
15 #include "services/ui/public/interfaces/window_tree.mojom.h" 15 #include "services/ui/public/interfaces/window_tree.mojom.h"
16 #include "ui/aura/env.h" 16 #include "ui/aura/env.h"
17 #include "ui/aura/mus/property_converter.h" 17 #include "ui/aura/mus/property_converter.h"
18 #include "ui/aura/mus/window_tree_client.h" 18 #include "ui/aura/mus/window_tree_client.h"
19 #include "ui/aura/mus/window_tree_client_delegate.h" 19 #include "ui/aura/mus/window_tree_client_delegate.h"
20 #include "ui/aura/mus/window_tree_host_mus.h" 20 #include "ui/aura/mus/window_tree_host_mus.h"
21 #include "ui/aura/mus/window_tree_host_mus_init_params.h"
21 #include "ui/aura/test/env_test_helper.h" 22 #include "ui/aura/test/env_test_helper.h"
22 #include "ui/aura/window.h" 23 #include "ui/aura/window.h"
23 #include "ui/display/display.h" 24 #include "ui/display/display.h"
24 #include "ui/display/display_list.h" 25 #include "ui/display/display_list.h"
25 #include "ui/display/screen_base.h" 26 #include "ui/display/screen_base.h"
26 #include "ui/wm/core/capture_controller.h" 27 #include "ui/wm/core/capture_controller.h"
27 #include "ui/wm/core/wm_state.h" 28 #include "ui/wm/core/wm_state.h"
28 29
29 namespace ash { 30 namespace ash {
30 namespace mus { 31 namespace mus {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // Connect to mus and create a new top level window. The request goes to 93 // Connect to mus and create a new top level window. The request goes to
93 // |ash|, but is async. 94 // |ash|, but is async.
94 aura::WindowTreeClient client(connector(), &window_tree_delegate, nullptr, 95 aura::WindowTreeClient client(connector(), &window_tree_delegate, nullptr,
95 nullptr, nullptr, false); 96 nullptr, nullptr, false);
96 client.ConnectViaWindowTreeFactory(); 97 client.ConnectViaWindowTreeFactory();
97 aura::test::EnvTestHelper().SetWindowTreeClient(&client); 98 aura::test::EnvTestHelper().SetWindowTreeClient(&client);
98 std::map<std::string, std::vector<uint8_t>> properties; 99 std::map<std::string, std::vector<uint8_t>> properties;
99 properties[ui::mojom::WindowManager::kWindowType_InitProperty] = 100 properties[ui::mojom::WindowManager::kWindowType_InitProperty] =
100 mojo::ConvertTo<std::vector<uint8_t>>( 101 mojo::ConvertTo<std::vector<uint8_t>>(
101 static_cast<int32_t>(ui::mojom::WindowType::WINDOW)); 102 static_cast<int32_t>(ui::mojom::WindowType::WINDOW));
102 aura::WindowTreeHostMus window_tree_host_mus(&client, cc::FrameSinkId(), 103 std::unique_ptr<aura::WindowTreeHostMusInitParams>
103 &properties); 104 window_tree_host_init_params =
105 aura::CreateInitParamsForTopLevel(&client, std::move(properties));
106 aura::WindowTreeHostMus window_tree_host_mus(
107 std::move(window_tree_host_init_params));
104 window_tree_host_mus.InitHost(); 108 window_tree_host_mus.InitHost();
105 aura::Window* child_window = new aura::Window(nullptr); 109 aura::Window* child_window = new aura::Window(nullptr);
106 child_window->Init(ui::LAYER_NOT_DRAWN); 110 child_window->Init(ui::LAYER_NOT_DRAWN);
107 window_tree_host_mus.window()->AddChild(child_window); 111 window_tree_host_mus.window()->AddChild(child_window);
108 112
109 // Create another WindowTreeClient by way of embedding in 113 // Create another WindowTreeClient by way of embedding in
110 // |child_window|. This blocks until it succeeds. 114 // |child_window|. This blocks until it succeeds.
111 ui::mojom::WindowTreeClientPtr tree_client; 115 ui::mojom::WindowTreeClientPtr tree_client;
112 auto tree_client_request = MakeRequest(&tree_client); 116 auto tree_client_request = MakeRequest(&tree_client);
113 client.Embed(child_window, std::move(tree_client), 0u, base::Bind(&OnEmbed)); 117 client.Embed(child_window, std::move(tree_client), 0u, base::Bind(&OnEmbed));
114 aura::WindowTreeClient child_client(connector(), &window_tree_delegate, 118 aura::WindowTreeClient child_client(connector(), &window_tree_delegate,
115 nullptr, std::move(tree_client_request), 119 nullptr, std::move(tree_client_request),
116 nullptr, false); 120 nullptr, false);
117 window_tree_delegate.WaitForEmbed(); 121 window_tree_delegate.WaitForEmbed();
118 ASSERT_TRUE(!child_client.GetRoots().empty()); 122 ASSERT_TRUE(!child_client.GetRoots().empty());
119 window_tree_delegate.DestroyWindowTreeHost(); 123 window_tree_delegate.DestroyWindowTreeHost();
120 } 124 }
121 125
122 } // namespace mus 126 } // namespace mus
123 } // namespace ash 127 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/views/frame/browser_frame_mus.cc » ('j') | ui/aura/mus/window_tree_host_mus_init_params.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698