| 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 #include <utility> | 6 #include <utility> |
| 7 | 7 |
| 8 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/macros.h" | 9 #include "base/macros.h" |
| 10 #include "components/mus/public/cpp/window.h" | 10 #include "components/mus/public/cpp/window.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 using WindowManagerAppTest = mojo::test::ApplicationTestBase; | 32 using WindowManagerAppTest = mojo::test::ApplicationTestBase; |
| 33 | 33 |
| 34 void OnEmbed(bool success, uint16_t id) { | 34 void OnEmbed(bool success, uint16_t id) { |
| 35 ASSERT_TRUE(success); | 35 ASSERT_TRUE(success); |
| 36 } | 36 } |
| 37 | 37 |
| 38 TEST_F(WindowManagerAppTest, OpenWindow) { | 38 TEST_F(WindowManagerAppTest, OpenWindow) { |
| 39 WindowTreeDelegateImpl window_tree_delegate; | 39 WindowTreeDelegateImpl window_tree_delegate; |
| 40 | 40 |
| 41 // Bring up the the desktop_wm. | 41 // Bring up the the desktop_wm. |
| 42 shell()->Connect("mojo:desktop_wm"); | 42 connector()->Connect("mojo:desktop_wm"); |
| 43 | 43 |
| 44 // Connect to mus and create a new top level window. The request goes to | 44 // Connect to mus and create a new top level window. The request goes to |
| 45 // the |desktop_wm|, but is async. | 45 // the |desktop_wm|, but is async. |
| 46 scoped_ptr<mus::WindowTreeConnection> connection( | 46 scoped_ptr<mus::WindowTreeConnection> connection( |
| 47 mus::WindowTreeConnection::Create(&window_tree_delegate, shell())); | 47 mus::WindowTreeConnection::Create(&window_tree_delegate, connector())); |
| 48 mus::Window* top_level_window = connection->NewTopLevelWindow(nullptr); | 48 mus::Window* top_level_window = connection->NewTopLevelWindow(nullptr); |
| 49 ASSERT_TRUE(top_level_window); | 49 ASSERT_TRUE(top_level_window); |
| 50 mus::Window* child_window = connection->NewWindow(); | 50 mus::Window* child_window = connection->NewWindow(); |
| 51 ASSERT_TRUE(child_window); | 51 ASSERT_TRUE(child_window); |
| 52 top_level_window->AddChild(child_window); | 52 top_level_window->AddChild(child_window); |
| 53 | 53 |
| 54 // Create another WindowTreeConnection by way of embedding in | 54 // Create another WindowTreeConnection by way of embedding in |
| 55 // |child_window|. This blocks until it succeeds. | 55 // |child_window|. This blocks until it succeeds. |
| 56 mus::mojom::WindowTreeClientPtr tree_client; | 56 mus::mojom::WindowTreeClientPtr tree_client; |
| 57 auto tree_client_request = GetProxy(&tree_client); | 57 auto tree_client_request = GetProxy(&tree_client); |
| 58 child_window->Embed(std::move(tree_client), | 58 child_window->Embed(std::move(tree_client), |
| 59 mus::mojom::WindowTree::kAccessPolicyDefault, | 59 mus::mojom::WindowTree::kAccessPolicyDefault, |
| 60 base::Bind(&OnEmbed)); | 60 base::Bind(&OnEmbed)); |
| 61 scoped_ptr<mus::WindowTreeConnection> child_connection( | 61 scoped_ptr<mus::WindowTreeConnection> child_connection( |
| 62 mus::WindowTreeConnection::Create( | 62 mus::WindowTreeConnection::Create( |
| 63 &window_tree_delegate, std::move(tree_client_request), | 63 &window_tree_delegate, std::move(tree_client_request), |
| 64 mus::WindowTreeConnection::CreateType::WAIT_FOR_EMBED)); | 64 mus::WindowTreeConnection::CreateType::WAIT_FOR_EMBED)); |
| 65 ASSERT_TRUE(!child_connection->GetRoots().empty()); | 65 ASSERT_TRUE(!child_connection->GetRoots().empty()); |
| 66 } | 66 } |
| 67 | 67 |
| 68 } // namespace wm | 68 } // namespace wm |
| 69 } // namespace mash | 69 } // namespace mash |
| OLD | NEW |