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