OLD | NEW |
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" |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 // Connect to mus and create a new top level window. The request goes to | 92 // Connect to mus and create a new top level window. The request goes to |
93 // |ash|, but is async. | 93 // |ash|, but is async. |
94 aura::WindowTreeClient client(connector(), &window_tree_delegate, nullptr, | 94 aura::WindowTreeClient client(connector(), &window_tree_delegate, nullptr, |
95 nullptr, nullptr, false); | 95 nullptr, nullptr, false); |
96 client.ConnectViaWindowTreeFactory(); | 96 client.ConnectViaWindowTreeFactory(); |
97 aura::test::EnvTestHelper().SetWindowTreeClient(&client); | 97 aura::test::EnvTestHelper().SetWindowTreeClient(&client); |
98 std::map<std::string, std::vector<uint8_t>> properties; | 98 std::map<std::string, std::vector<uint8_t>> properties; |
99 properties[ui::mojom::WindowManager::kWindowType_InitProperty] = | 99 properties[ui::mojom::WindowManager::kWindowType_InitProperty] = |
100 mojo::ConvertTo<std::vector<uint8_t>>( | 100 mojo::ConvertTo<std::vector<uint8_t>>( |
101 static_cast<int32_t>(ui::mojom::WindowType::WINDOW)); | 101 static_cast<int32_t>(ui::mojom::WindowType::WINDOW)); |
102 aura::WindowTreeHostMus window_tree_host_mus(&client, &properties); | 102 aura::WindowTreeHostMus window_tree_host_mus(&client, cc::FrameSinkId(), |
| 103 &properties); |
103 window_tree_host_mus.InitHost(); | 104 window_tree_host_mus.InitHost(); |
104 aura::Window* child_window = new aura::Window(nullptr); | 105 aura::Window* child_window = new aura::Window(nullptr); |
105 child_window->Init(ui::LAYER_NOT_DRAWN); | 106 child_window->Init(ui::LAYER_NOT_DRAWN); |
106 window_tree_host_mus.window()->AddChild(child_window); | 107 window_tree_host_mus.window()->AddChild(child_window); |
107 | 108 |
108 // Create another WindowTreeClient by way of embedding in | 109 // Create another WindowTreeClient by way of embedding in |
109 // |child_window|. This blocks until it succeeds. | 110 // |child_window|. This blocks until it succeeds. |
110 ui::mojom::WindowTreeClientPtr tree_client; | 111 ui::mojom::WindowTreeClientPtr tree_client; |
111 auto tree_client_request = MakeRequest(&tree_client); | 112 auto tree_client_request = MakeRequest(&tree_client); |
112 client.Embed(child_window, std::move(tree_client), 0u, base::Bind(&OnEmbed)); | 113 client.Embed(child_window, std::move(tree_client), 0u, base::Bind(&OnEmbed)); |
113 aura::WindowTreeClient child_client(connector(), &window_tree_delegate, | 114 aura::WindowTreeClient child_client(connector(), &window_tree_delegate, |
114 nullptr, std::move(tree_client_request), | 115 nullptr, std::move(tree_client_request), |
115 nullptr, false); | 116 nullptr, false); |
116 window_tree_delegate.WaitForEmbed(); | 117 window_tree_delegate.WaitForEmbed(); |
117 ASSERT_TRUE(!child_client.GetRoots().empty()); | 118 ASSERT_TRUE(!child_client.GetRoots().empty()); |
118 window_tree_delegate.DestroyWindowTreeHost(); | 119 window_tree_delegate.DestroyWindowTreeHost(); |
119 } | 120 } |
120 | 121 |
121 } // namespace mus | 122 } // namespace mus |
122 } // namespace ash | 123 } // namespace ash |
OLD | NEW |