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

Side by Side Diff: mash/wm/window_manager_apptest.cc

Issue 1455833005: Convert ConnectToApplication to take a params class (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 5 years 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
« no previous file with comments | « mandoline/ui/desktop_ui/browser_window.cc ('k') | media/mojo/services/media_apptest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/window_manager.mojom.h" 9 #include "components/mus/public/interfaces/window_manager.mojom.h"
10 #include "components/mus/public/interfaces/window_tree.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 application_impl()->ConnectToService("mojo:example_wm", window_manager);
23 request->url = "mojo:example_wm";
24 application_impl()->ConnectToService(request.Pass(), window_manager);
25 } 23 }
26 24
27 mus::Window* OpenWindow(mus::mojom::WindowManager* window_manager) { 25 mus::Window* OpenWindow(mus::mojom::WindowManager* window_manager) {
28 mus::mojom::WindowTreeClientPtr window_tree_client; 26 mus::mojom::WindowTreeClientPtr window_tree_client;
29 mojo::InterfaceRequest<mus::mojom::WindowTreeClient> 27 mojo::InterfaceRequest<mus::mojom::WindowTreeClient>
30 window_tree_client_request = GetProxy(&window_tree_client); 28 window_tree_client_request = GetProxy(&window_tree_client);
31 mojo::Map<mojo::String, mojo::Array<uint8_t>> properties; 29 mojo::Map<mojo::String, mojo::Array<uint8_t>> properties;
32 window_manager->OpenWindow(window_tree_client.Pass(), properties.Pass()); 30 window_manager->OpenWindow(window_tree_client.Pass(), properties.Pass());
33 mus::WindowTreeConnection* connection = mus::WindowTreeConnection::Create( 31 mus::WindowTreeConnection* connection = mus::WindowTreeConnection::Create(
34 this, window_tree_client_request.Pass(), 32 this, window_tree_client_request.Pass(),
35 mus::WindowTreeConnection::CreateType::WAIT_FOR_EMBED); 33 mus::WindowTreeConnection::CreateType::WAIT_FOR_EMBED);
36 return connection->GetRoot(); 34 return connection->GetRoot();
37 } 35 }
38 36
39 private: 37 private:
40 // mus::WindowTreeDelegate: 38 // mus::WindowTreeDelegate:
41 void OnEmbed(mus::Window* root) override {} 39 void OnEmbed(mus::Window* root) override {}
42 void OnConnectionLost(mus::WindowTreeConnection* connection) override {} 40 void OnConnectionLost(mus::WindowTreeConnection* connection) override {}
43 41
44 DISALLOW_COPY_AND_ASSIGN(WindowManagerAppTest); 42 DISALLOW_COPY_AND_ASSIGN(WindowManagerAppTest);
45 }; 43 };
46 44
47 TEST_F(WindowManagerAppTest, OpenWindow) { 45 TEST_F(WindowManagerAppTest, OpenWindow) {
48 mus::mojom::WindowManagerPtr connection; 46 mus::mojom::WindowManagerPtr connection;
49 ConnectToWindowManager(&connection); 47 ConnectToWindowManager(&connection);
50 48
51 ASSERT_TRUE(OpenWindow(connection.get())); 49 ASSERT_TRUE(OpenWindow(connection.get()));
52 } 50 }
OLDNEW
« no previous file with comments | « mandoline/ui/desktop_ui/browser_window.cc ('k') | media/mojo/services/media_apptest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698