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 | 7 |
7 #include "base/bind.h" | 8 #include "base/bind.h" |
8 #include "base/macros.h" | 9 #include "base/macros.h" |
9 #include "components/mus/public/cpp/window.h" | 10 #include "components/mus/public/cpp/window.h" |
10 #include "components/mus/public/cpp/window_tree_connection.h" | 11 #include "components/mus/public/cpp/window_tree_connection.h" |
11 #include "components/mus/public/cpp/window_tree_delegate.h" | 12 #include "components/mus/public/cpp/window_tree_delegate.h" |
12 #include "components/mus/public/interfaces/window_manager.mojom.h" | 13 #include "components/mus/public/interfaces/window_manager.mojom.h" |
13 #include "components/mus/public/interfaces/window_tree.mojom.h" | 14 #include "components/mus/public/interfaces/window_tree.mojom.h" |
14 #include "mojo/application/public/cpp/application_impl.h" | 15 #include "mojo/application/public/cpp/application_impl.h" |
15 #include "mojo/application/public/cpp/application_test_base.h" | 16 #include "mojo/application/public/cpp/application_test_base.h" |
(...skipping 11 matching lines...) Expand all Loading... |
27 void ConnectToWindowManager(mus::mojom::WindowManagerPtr* window_manager) { | 28 void ConnectToWindowManager(mus::mojom::WindowManagerPtr* window_manager) { |
28 application_impl()->ConnectToService("mojo:desktop_wm", window_manager); | 29 application_impl()->ConnectToService("mojo:desktop_wm", window_manager); |
29 } | 30 } |
30 | 31 |
31 mus::Window* OpenWindow(mus::mojom::WindowManager* window_manager) { | 32 mus::Window* OpenWindow(mus::mojom::WindowManager* window_manager) { |
32 mus::mojom::WindowTreeClientPtr window_tree_client; | 33 mus::mojom::WindowTreeClientPtr window_tree_client; |
33 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> | 34 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> |
34 window_tree_client_request = GetProxy(&window_tree_client); | 35 window_tree_client_request = GetProxy(&window_tree_client); |
35 mojo::Map<mojo::String, mojo::Array<uint8_t>> properties; | 36 mojo::Map<mojo::String, mojo::Array<uint8_t>> properties; |
36 properties.mark_non_null(); | 37 properties.mark_non_null(); |
37 window_manager->OpenWindow(window_tree_client.Pass(), properties.Pass()); | 38 window_manager->OpenWindow(std::move(window_tree_client), |
| 39 std::move(properties)); |
38 mus::WindowTreeConnection* connection = mus::WindowTreeConnection::Create( | 40 mus::WindowTreeConnection* connection = mus::WindowTreeConnection::Create( |
39 this, window_tree_client_request.Pass(), | 41 this, std::move(window_tree_client_request), |
40 mus::WindowTreeConnection::CreateType::WAIT_FOR_EMBED); | 42 mus::WindowTreeConnection::CreateType::WAIT_FOR_EMBED); |
41 return connection->GetRoot(); | 43 return connection->GetRoot(); |
42 } | 44 } |
43 | 45 |
44 private: | 46 private: |
45 // mus::WindowTreeDelegate: | 47 // mus::WindowTreeDelegate: |
46 void OnEmbed(mus::Window* root) override {} | 48 void OnEmbed(mus::Window* root) override {} |
47 void OnConnectionLost(mus::WindowTreeConnection* connection) override {} | 49 void OnConnectionLost(mus::WindowTreeConnection* connection) override {} |
48 | 50 |
49 DISALLOW_COPY_AND_ASSIGN(WindowManagerAppTest); | 51 DISALLOW_COPY_AND_ASSIGN(WindowManagerAppTest); |
50 }; | 52 }; |
51 | 53 |
52 TEST_F(WindowManagerAppTest, OpenWindow) { | 54 TEST_F(WindowManagerAppTest, OpenWindow) { |
53 mus::mojom::WindowManagerPtr connection; | 55 mus::mojom::WindowManagerPtr connection; |
54 ConnectToWindowManager(&connection); | 56 ConnectToWindowManager(&connection); |
55 | 57 |
56 ASSERT_TRUE(OpenWindow(connection.get())); | 58 ASSERT_TRUE(OpenWindow(connection.get())); |
57 } | 59 } |
58 | 60 |
59 } // namespace wm | 61 } // namespace wm |
60 } // namespace mash | 62 } // namespace mash |
OLD | NEW |