| 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 <memory> | 5 #include <memory> |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "services/service_manager/public/cpp/service_test.h" | 9 #include "services/service_manager/public/cpp/service_test.h" |
| 10 #include "services/ui/public/cpp/window.h" | 10 #include "services/ui/public/cpp/window.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 void OnEmbed(bool success) { | 43 void OnEmbed(bool success) { |
| 44 ASSERT_TRUE(success); | 44 ASSERT_TRUE(success); |
| 45 } | 45 } |
| 46 | 46 |
| 47 // Fails when the Ash material design shelf is enabled by default | 47 // Fails when the Ash material design shelf is enabled by default |
| 48 // (ash::MaterialDesignController::IsShelfMaterial()). See | 48 // (ash::MaterialDesignController::IsShelfMaterial()). See |
| 49 // crbug.com/660194 and crbug.com/642879. | 49 // crbug.com/660194 and crbug.com/642879. |
| 50 // TODO(rockot): Reenable this test. | 50 // TODO(rockot): Reenable this test. |
| 51 #if defined(USE_OZONE) | 51 TEST_F(WindowManagerTest, DISABLED_OpenWindow) { |
| 52 #define MAYBE_OpenWindow OpenWindow | |
| 53 #else | |
| 54 #define MAYBE_OpenWindow DISABLED_OpenWindow | |
| 55 #endif // defined(USE_OZONE) | |
| 56 TEST_F(WindowManagerTest, MAYBE_OpenWindow) { | |
| 57 WindowTreeClientDelegate window_tree_delegate; | 52 WindowTreeClientDelegate window_tree_delegate; |
| 58 | 53 |
| 59 connector()->Connect("ash"); | 54 connector()->Connect("ash"); |
| 60 | 55 |
| 61 // Connect to mus and create a new top level window. The request goes to | 56 // Connect to mus and create a new top level window. The request goes to |
| 62 // |ash|, but is async. | 57 // |ash|, but is async. |
| 63 std::unique_ptr<ui::WindowTreeClient> client( | 58 std::unique_ptr<ui::WindowTreeClient> client( |
| 64 new ui::WindowTreeClient(&window_tree_delegate)); | 59 new ui::WindowTreeClient(&window_tree_delegate)); |
| 65 client->ConnectViaWindowTreeFactory(connector()); | 60 client->ConnectViaWindowTreeFactory(connector()); |
| 66 ui::Window* top_level_window = client->NewTopLevelWindow(nullptr); | 61 ui::Window* top_level_window = client->NewTopLevelWindow(nullptr); |
| 67 ASSERT_TRUE(top_level_window); | 62 ASSERT_TRUE(top_level_window); |
| 68 ui::Window* child_window = client->NewWindow(); | 63 ui::Window* child_window = client->NewWindow(); |
| 69 ASSERT_TRUE(child_window); | 64 ASSERT_TRUE(child_window); |
| 70 top_level_window->AddChild(child_window); | 65 top_level_window->AddChild(child_window); |
| 71 | 66 |
| 72 // Create another WindowTreeClient by way of embedding in | 67 // Create another WindowTreeClient by way of embedding in |
| 73 // |child_window|. This blocks until it succeeds. | 68 // |child_window|. This blocks until it succeeds. |
| 74 ui::mojom::WindowTreeClientPtr tree_client; | 69 ui::mojom::WindowTreeClientPtr tree_client; |
| 75 auto tree_client_request = GetProxy(&tree_client); | 70 auto tree_client_request = GetProxy(&tree_client); |
| 76 child_window->Embed(std::move(tree_client), base::Bind(&OnEmbed)); | 71 child_window->Embed(std::move(tree_client), base::Bind(&OnEmbed)); |
| 77 std::unique_ptr<ui::WindowTreeClient> child_client(new ui::WindowTreeClient( | 72 std::unique_ptr<ui::WindowTreeClient> child_client(new ui::WindowTreeClient( |
| 78 &window_tree_delegate, nullptr, std::move(tree_client_request))); | 73 &window_tree_delegate, nullptr, std::move(tree_client_request))); |
| 79 child_client->WaitForEmbed(); | 74 child_client->WaitForEmbed(); |
| 80 ASSERT_TRUE(!child_client->GetRoots().empty()); | 75 ASSERT_TRUE(!child_client->GetRoots().empty()); |
| 81 } | 76 } |
| 82 | 77 |
| 83 } // namespace mus | 78 } // namespace mus |
| 84 } // namespace ash | 79 } // namespace ash |
| OLD | NEW |