| 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 <stdint.h> | 5 #include <stdint.h> |
| 6 |
| 7 #include <memory> |
| 6 #include <utility> | 8 #include <utility> |
| 7 | 9 |
| 8 #include "base/bind.h" | 10 #include "base/bind.h" |
| 9 #include "base/macros.h" | 11 #include "base/macros.h" |
| 10 #include "components/mus/public/cpp/window.h" | 12 #include "components/mus/public/cpp/window.h" |
| 11 #include "components/mus/public/cpp/window_tree_connection.h" | 13 #include "components/mus/public/cpp/window_tree_connection.h" |
| 12 #include "components/mus/public/cpp/window_tree_delegate.h" | 14 #include "components/mus/public/cpp/window_tree_delegate.h" |
| 13 #include "components/mus/public/interfaces/window_tree.mojom.h" | 15 #include "components/mus/public/interfaces/window_tree.mojom.h" |
| 14 #include "mojo/shell/public/cpp/shell_test.h" | 16 #include "mojo/shell/public/cpp/shell_test.h" |
| 15 | 17 |
| (...skipping 27 matching lines...) Expand all Loading... |
| 43 } | 45 } |
| 44 | 46 |
| 45 TEST_F(WindowManagerTest, OpenWindow) { | 47 TEST_F(WindowManagerTest, OpenWindow) { |
| 46 WindowTreeDelegateImpl window_tree_delegate; | 48 WindowTreeDelegateImpl window_tree_delegate; |
| 47 | 49 |
| 48 // Bring up the the desktop_wm. | 50 // Bring up the the desktop_wm. |
| 49 connector()->Connect("mojo:desktop_wm"); | 51 connector()->Connect("mojo:desktop_wm"); |
| 50 | 52 |
| 51 // Connect to mus and create a new top level window. The request goes to | 53 // Connect to mus and create a new top level window. The request goes to |
| 52 // the |desktop_wm|, but is async. | 54 // the |desktop_wm|, but is async. |
| 53 scoped_ptr<mus::WindowTreeConnection> connection( | 55 std::unique_ptr<mus::WindowTreeConnection> connection( |
| 54 mus::WindowTreeConnection::Create(&window_tree_delegate, connector())); | 56 mus::WindowTreeConnection::Create(&window_tree_delegate, connector())); |
| 55 mus::Window* top_level_window = connection->NewTopLevelWindow(nullptr); | 57 mus::Window* top_level_window = connection->NewTopLevelWindow(nullptr); |
| 56 ASSERT_TRUE(top_level_window); | 58 ASSERT_TRUE(top_level_window); |
| 57 mus::Window* child_window = connection->NewWindow(); | 59 mus::Window* child_window = connection->NewWindow(); |
| 58 ASSERT_TRUE(child_window); | 60 ASSERT_TRUE(child_window); |
| 59 top_level_window->AddChild(child_window); | 61 top_level_window->AddChild(child_window); |
| 60 | 62 |
| 61 // Create another WindowTreeConnection by way of embedding in | 63 // Create another WindowTreeConnection by way of embedding in |
| 62 // |child_window|. This blocks until it succeeds. | 64 // |child_window|. This blocks until it succeeds. |
| 63 mus::mojom::WindowTreeClientPtr tree_client; | 65 mus::mojom::WindowTreeClientPtr tree_client; |
| 64 auto tree_client_request = GetProxy(&tree_client); | 66 auto tree_client_request = GetProxy(&tree_client); |
| 65 child_window->Embed(std::move(tree_client), base::Bind(&OnEmbed)); | 67 child_window->Embed(std::move(tree_client), base::Bind(&OnEmbed)); |
| 66 scoped_ptr<mus::WindowTreeConnection> child_connection( | 68 std::unique_ptr<mus::WindowTreeConnection> child_connection( |
| 67 mus::WindowTreeConnection::Create( | 69 mus::WindowTreeConnection::Create( |
| 68 &window_tree_delegate, std::move(tree_client_request), | 70 &window_tree_delegate, std::move(tree_client_request), |
| 69 mus::WindowTreeConnection::CreateType::WAIT_FOR_EMBED)); | 71 mus::WindowTreeConnection::CreateType::WAIT_FOR_EMBED)); |
| 70 ASSERT_TRUE(!child_connection->GetRoots().empty()); | 72 ASSERT_TRUE(!child_connection->GetRoots().empty()); |
| 71 } | 73 } |
| 72 | 74 |
| 73 } // namespace wm | 75 } // namespace wm |
| 74 } // namespace mash | 76 } // namespace mash |
| OLD | NEW |