| 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 "base/bind.h" | 10 #include "base/bind.h" |
| 10 #include "base/macros.h" | 11 #include "base/macros.h" |
| 11 #include "base/run_loop.h" | 12 #include "base/run_loop.h" |
| 12 #include "services/service_manager/public/cpp/service_test.h" | 13 #include "services/service_manager/public/cpp/service_test.h" |
| 13 #include "services/ui/public/cpp/property_type_converters.h" | 14 #include "services/ui/public/cpp/property_type_converters.h" |
| 14 #include "services/ui/public/interfaces/window_tree.mojom.h" | 15 #include "services/ui/public/interfaces/window_tree.mojom.h" |
| 15 #include "ui/aura/env.h" | 16 #include "ui/aura/env.h" |
| 16 #include "ui/aura/mus/property_converter.h" | 17 #include "ui/aura/mus/property_converter.h" |
| 17 #include "ui/aura/mus/window_tree_client.h" | 18 #include "ui/aura/mus/window_tree_client.h" |
| 18 #include "ui/aura/mus/window_tree_client_delegate.h" | 19 #include "ui/aura/mus/window_tree_client_delegate.h" |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 77 |
| 77 TEST_F(WindowManagerTest, OpenWindow) { | 78 TEST_F(WindowManagerTest, OpenWindow) { |
| 78 display::ScreenBase screen; | 79 display::ScreenBase screen; |
| 79 screen.display_list().AddDisplay( | 80 screen.display_list().AddDisplay( |
| 80 display::Display(1, gfx::Rect(0, 0, 200, 200)), | 81 display::Display(1, gfx::Rect(0, 0, 200, 200)), |
| 81 display::DisplayList::Type::PRIMARY); | 82 display::DisplayList::Type::PRIMARY); |
| 82 display::Screen::SetScreenInstance(&screen); | 83 display::Screen::SetScreenInstance(&screen); |
| 83 | 84 |
| 84 WindowTreeClientDelegate window_tree_delegate; | 85 WindowTreeClientDelegate window_tree_delegate; |
| 85 | 86 |
| 86 connector()->Connect("ash"); | 87 connector()->Connect(mojom::kServiceName); |
| 87 | 88 |
| 88 // Connect to mus and create a new top level window. The request goes to | 89 // Connect to mus and create a new top level window. The request goes to |
| 89 // |ash|, but is async. | 90 // |ash|, but is async. |
| 90 aura::WindowTreeClient client(connector(), &window_tree_delegate); | 91 aura::WindowTreeClient client(connector(), &window_tree_delegate); |
| 91 client.ConnectViaWindowTreeFactory(); | 92 client.ConnectViaWindowTreeFactory(); |
| 92 aura::test::EnvTestHelper().SetWindowTreeClient(&client); | 93 aura::test::EnvTestHelper().SetWindowTreeClient(&client); |
| 93 std::map<std::string, std::vector<uint8_t>> properties; | 94 std::map<std::string, std::vector<uint8_t>> properties; |
| 94 properties[ui::mojom::WindowManager::kWindowType_InitProperty] = | 95 properties[ui::mojom::WindowManager::kWindowType_InitProperty] = |
| 95 mojo::ConvertTo<std::vector<uint8_t>>( | 96 mojo::ConvertTo<std::vector<uint8_t>>( |
| 96 static_cast<int32_t>(ui::mojom::WindowType::WINDOW)); | 97 static_cast<int32_t>(ui::mojom::WindowType::WINDOW)); |
| (...skipping 10 matching lines...) Expand all Loading... |
| 107 client.Embed(child_window, std::move(tree_client), 0u, base::Bind(&OnEmbed)); | 108 client.Embed(child_window, std::move(tree_client), 0u, base::Bind(&OnEmbed)); |
| 108 aura::WindowTreeClient child_client(connector(), &window_tree_delegate, | 109 aura::WindowTreeClient child_client(connector(), &window_tree_delegate, |
| 109 nullptr, std::move(tree_client_request)); | 110 nullptr, std::move(tree_client_request)); |
| 110 window_tree_delegate.WaitForEmbed(); | 111 window_tree_delegate.WaitForEmbed(); |
| 111 ASSERT_TRUE(!child_client.GetRoots().empty()); | 112 ASSERT_TRUE(!child_client.GetRoots().empty()); |
| 112 window_tree_delegate.DestroyWindowTreeHost(); | 113 window_tree_delegate.DestroyWindowTreeHost(); |
| 113 } | 114 } |
| 114 | 115 |
| 115 } // namespace mus | 116 } // namespace mus |
| 116 } // namespace ash | 117 } // namespace ash |
| OLD | NEW |