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 // TODO(sky): convert to using aura. |
51 TEST_F(WindowManagerTest, DISABLED_OpenWindow) { | 52 TEST_F(WindowManagerTest, DISABLED_OpenWindow) { |
52 WindowTreeClientDelegate window_tree_delegate; | 53 WindowTreeClientDelegate window_tree_delegate; |
53 | 54 |
54 connector()->Connect("ash"); | 55 connector()->Connect("ash"); |
55 | 56 |
56 // Connect to mus and create a new top level window. The request goes to | 57 // Connect to mus and create a new top level window. The request goes to |
57 // |ash|, but is async. | 58 // |ash|, but is async. |
58 std::unique_ptr<ui::WindowTreeClient> client( | 59 std::unique_ptr<ui::WindowTreeClient> client( |
59 new ui::WindowTreeClient(&window_tree_delegate)); | 60 new ui::WindowTreeClient(&window_tree_delegate)); |
60 client->ConnectViaWindowTreeFactory(connector()); | 61 client->ConnectViaWindowTreeFactory(connector()); |
61 ui::Window* top_level_window = client->NewTopLevelWindow(nullptr); | 62 ui::Window* top_level_window = client->NewTopLevelWindow(nullptr); |
62 ASSERT_TRUE(top_level_window); | 63 ASSERT_TRUE(top_level_window); |
63 ui::Window* child_window = client->NewWindow(); | 64 ui::Window* child_window = client->NewWindow(); |
64 ASSERT_TRUE(child_window); | 65 ASSERT_TRUE(child_window); |
65 top_level_window->AddChild(child_window); | 66 top_level_window->AddChild(child_window); |
66 | 67 |
67 // Create another WindowTreeClient by way of embedding in | 68 // Create another WindowTreeClient by way of embedding in |
68 // |child_window|. This blocks until it succeeds. | 69 // |child_window|. This blocks until it succeeds. |
69 ui::mojom::WindowTreeClientPtr tree_client; | 70 ui::mojom::WindowTreeClientPtr tree_client; |
70 auto tree_client_request = GetProxy(&tree_client); | 71 auto tree_client_request = GetProxy(&tree_client); |
71 child_window->Embed(std::move(tree_client), base::Bind(&OnEmbed)); | 72 child_window->Embed(std::move(tree_client), base::Bind(&OnEmbed)); |
72 std::unique_ptr<ui::WindowTreeClient> child_client(new ui::WindowTreeClient( | 73 std::unique_ptr<ui::WindowTreeClient> child_client(new ui::WindowTreeClient( |
73 &window_tree_delegate, nullptr, std::move(tree_client_request))); | 74 &window_tree_delegate, nullptr, std::move(tree_client_request))); |
74 child_client->WaitForEmbed(); | 75 child_client->WaitForEmbed(); |
75 ASSERT_TRUE(!child_client->GetRoots().empty()); | 76 ASSERT_TRUE(!child_client->GetRoots().empty()); |
76 } | 77 } |
77 | 78 |
78 } // namespace mus | 79 } // namespace mus |
79 } // namespace ash | 80 } // namespace ash |
OLD | NEW |