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" |
11 #include "components/mus/public/cpp/window_tree_connection.h" | 11 #include "components/mus/public/cpp/window_tree_connection.h" |
12 #include "components/mus/public/cpp/window_tree_delegate.h" | 12 #include "components/mus/public/cpp/window_tree_delegate.h" |
13 #include "components/mus/public/interfaces/window_manager.mojom.h" | 13 #include "components/mus/public/interfaces/window_manager.mojom.h" |
14 #include "components/mus/public/interfaces/window_tree.mojom.h" | 14 #include "components/mus/public/interfaces/window_tree.mojom.h" |
15 #include "mojo/shell/public/cpp/application_impl.h" | 15 #include "mojo/shell/public/cpp/application_impl.h" |
16 #include "mojo/shell/public/cpp/application_test_base.h" | 16 #include "mojo/shell/public/cpp/application_test_base.h" |
17 | 17 |
18 namespace mash { | 18 namespace mash { |
19 namespace wm { | 19 namespace wm { |
20 | 20 |
21 class WindowManagerAppTest : public mojo::test::ApplicationTestBase, | 21 class WindowManagerAppTest : public mojo::test::ApplicationTestBase, |
22 public mus::WindowTreeDelegate { | 22 public mus::WindowTreeDelegate { |
23 public: | 23 public: |
24 WindowManagerAppTest() {} | 24 WindowManagerAppTest() {} |
25 ~WindowManagerAppTest() override {} | 25 ~WindowManagerAppTest() override {} |
26 | 26 |
27 protected: | 27 protected: |
28 void ConnectToWindowManager(mus::mojom::WindowManagerPtr* window_manager) { | 28 void ConnectToWindowManager( |
| 29 mus::mojom::WindowManagerDeprecatedPtr* window_manager) { |
29 application_impl()->ConnectToService("mojo:desktop_wm", window_manager); | 30 application_impl()->ConnectToService("mojo:desktop_wm", window_manager); |
30 } | 31 } |
31 | 32 |
32 mus::Window* OpenWindow(mus::mojom::WindowManager* window_manager) { | 33 mus::Window* OpenWindow(mus::mojom::WindowManagerDeprecated* window_manager) { |
33 mus::mojom::WindowTreeClientPtr window_tree_client; | 34 mus::mojom::WindowTreeClientPtr window_tree_client; |
34 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> | 35 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> |
35 window_tree_client_request = GetProxy(&window_tree_client); | 36 window_tree_client_request = GetProxy(&window_tree_client); |
36 mojo::Map<mojo::String, mojo::Array<uint8_t>> properties; | 37 mojo::Map<mojo::String, mojo::Array<uint8_t>> properties; |
37 properties.mark_non_null(); | 38 properties.mark_non_null(); |
38 window_manager->OpenWindow(std::move(window_tree_client), | 39 window_manager->OpenWindow(std::move(window_tree_client), |
39 std::move(properties)); | 40 std::move(properties)); |
40 mus::WindowTreeConnection* connection = mus::WindowTreeConnection::Create( | 41 mus::WindowTreeConnection* connection = mus::WindowTreeConnection::Create( |
41 this, std::move(window_tree_client_request), | 42 this, std::move(window_tree_client_request), |
42 mus::WindowTreeConnection::CreateType::WAIT_FOR_EMBED); | 43 mus::WindowTreeConnection::CreateType::WAIT_FOR_EMBED); |
43 return *connection->GetRoots().begin(); | 44 return *connection->GetRoots().begin(); |
44 } | 45 } |
45 | 46 |
46 private: | 47 private: |
47 // mus::WindowTreeDelegate: | 48 // mus::WindowTreeDelegate: |
48 void OnEmbed(mus::Window* root) override {} | 49 void OnEmbed(mus::Window* root) override {} |
49 void OnConnectionLost(mus::WindowTreeConnection* connection) override {} | 50 void OnConnectionLost(mus::WindowTreeConnection* connection) override {} |
50 | 51 |
51 DISALLOW_COPY_AND_ASSIGN(WindowManagerAppTest); | 52 DISALLOW_COPY_AND_ASSIGN(WindowManagerAppTest); |
52 }; | 53 }; |
53 | 54 |
54 TEST_F(WindowManagerAppTest, OpenWindow) { | 55 TEST_F(WindowManagerAppTest, OpenWindow) { |
55 mus::mojom::WindowManagerPtr connection; | 56 mus::mojom::WindowManagerDeprecatedPtr connection; |
56 ConnectToWindowManager(&connection); | 57 ConnectToWindowManager(&connection); |
57 | 58 |
58 ASSERT_TRUE(OpenWindow(connection.get())); | 59 ASSERT_TRUE(OpenWindow(connection.get())); |
59 } | 60 } |
60 | 61 |
61 } // namespace wm | 62 } // namespace wm |
62 } // namespace mash | 63 } // namespace mash |
OLD | NEW |