Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(782)

Side by Side Diff: components/mus/example/wm/window_manager_apptest.cc

Issue 1406153004: components/mus/public/interfaces View => Window (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Yet another rebase Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "components/mus/public/cpp/window.h" 6 #include "components/mus/public/cpp/window.h"
7 #include "components/mus/public/cpp/window_tree_connection.h" 7 #include "components/mus/public/cpp/window_tree_connection.h"
8 #include "components/mus/public/cpp/window_tree_delegate.h" 8 #include "components/mus/public/cpp/window_tree_delegate.h"
9 #include "components/mus/public/interfaces/view_tree.mojom.h"
10 #include "components/mus/public/interfaces/window_manager.mojom.h" 9 #include "components/mus/public/interfaces/window_manager.mojom.h"
10 #include "components/mus/public/interfaces/window_tree.mojom.h"
11 #include "mojo/application/public/cpp/application_impl.h" 11 #include "mojo/application/public/cpp/application_impl.h"
12 #include "mojo/application/public/cpp/application_test_base.h" 12 #include "mojo/application/public/cpp/application_test_base.h"
13 13
14 class WindowManagerAppTest : public mojo::test::ApplicationTestBase, 14 class WindowManagerAppTest : public mojo::test::ApplicationTestBase,
15 public mus::WindowTreeDelegate { 15 public mus::WindowTreeDelegate {
16 public: 16 public:
17 WindowManagerAppTest() {} 17 WindowManagerAppTest() {}
18 ~WindowManagerAppTest() override {} 18 ~WindowManagerAppTest() override {}
19 19
20 protected: 20 protected:
21 void ConnectToWindowManager(mus::mojom::WindowManagerPtr* window_manager) { 21 void ConnectToWindowManager(mus::mojom::WindowManagerPtr* window_manager) {
22 mojo::URLRequestPtr request(mojo::URLRequest::New()); 22 mojo::URLRequestPtr request(mojo::URLRequest::New());
23 request->url = "mojo:example_wm"; 23 request->url = "mojo:example_wm";
24 application_impl()->ConnectToService(request.Pass(), window_manager); 24 application_impl()->ConnectToService(request.Pass(), window_manager);
25 } 25 }
26 26
27 mus::Window* OpenWindow(mus::mojom::WindowManager* window_manager) { 27 mus::Window* OpenWindow(mus::mojom::WindowManager* window_manager) {
28 mojo::ViewTreeClientPtr view_tree_client; 28 mus::mojom::WindowTreeClientPtr window_tree_client;
29 mojo::InterfaceRequest<mojo::ViewTreeClient> view_tree_client_request = 29 mojo::InterfaceRequest<mus::mojom::WindowTreeClient>
30 GetProxy(&view_tree_client); 30 window_tree_client_request = GetProxy(&window_tree_client);
31 window_manager->OpenWindow(view_tree_client.Pass()); 31 window_manager->OpenWindow(window_tree_client.Pass());
32 mus::WindowTreeConnection* connection = mus::WindowTreeConnection::Create( 32 mus::WindowTreeConnection* connection = mus::WindowTreeConnection::Create(
33 this, view_tree_client_request.Pass(), 33 this, window_tree_client_request.Pass(),
34 mus::WindowTreeConnection::CreateType::WAIT_FOR_EMBED); 34 mus::WindowTreeConnection::CreateType::WAIT_FOR_EMBED);
35 return connection->GetRoot(); 35 return connection->GetRoot();
36 } 36 }
37 37
38 private: 38 private:
39 // mus::WindowTreeDelegate: 39 // mus::WindowTreeDelegate:
40 void OnEmbed(mus::Window* root) override {} 40 void OnEmbed(mus::Window* root) override {}
41 void OnConnectionLost(mus::WindowTreeConnection* connection) override {} 41 void OnConnectionLost(mus::WindowTreeConnection* connection) override {}
42 42
43 DISALLOW_COPY_AND_ASSIGN(WindowManagerAppTest); 43 DISALLOW_COPY_AND_ASSIGN(WindowManagerAppTest);
(...skipping 22 matching lines...) Expand all
66 66
67 succeeded = false; 67 succeeded = false;
68 connection1->CenterWindow( 68 connection1->CenterWindow(
69 window_from_connection2->id(), mojo::Size::New(), 69 window_from_connection2->id(), mojo::Size::New(),
70 [&succeeded](mus::mojom::WindowManagerErrorCode result) { 70 [&succeeded](mus::mojom::WindowManagerErrorCode result) {
71 succeeded = result == mus::mojom::WINDOW_MANAGER_ERROR_CODE_SUCCESS; 71 succeeded = result == mus::mojom::WINDOW_MANAGER_ERROR_CODE_SUCCESS;
72 }); 72 });
73 ASSERT_TRUE(connection1.WaitForIncomingResponse()); 73 ASSERT_TRUE(connection1.WaitForIncomingResponse());
74 EXPECT_FALSE(succeeded); 74 EXPECT_FALSE(succeeded);
75 } 75 }
OLDNEW
« no previous file with comments | « components/mus/example/wm/window_manager_application.h ('k') | components/mus/example/wm/window_manager_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698