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

Side by Side Diff: content/public/test/test_mojo_app.cc

Issue 1674903003: Extract shell methods from ApplicationImpl into a base class, and pass this to Initialize() instead. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojom
Patch Set: . Created 4 years, 10 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 "content/public/test/test_mojo_app.h" 5 #include "content/public/test/test_mojo_app.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "mojo/shell/public/cpp/application_connection.h" 10 #include "mojo/shell/public/cpp/application_connection.h"
11 #include "mojo/shell/public/cpp/application_impl.h" 11 #include "mojo/shell/public/cpp/shell.h"
12 12
13 namespace content { 13 namespace content {
14 14
15 const char kTestMojoAppUrl[] = "system:content_mojo_test"; 15 const char kTestMojoAppUrl[] = "system:content_mojo_test";
16 16
17 TestMojoApp::TestMojoApp() : service_binding_(this), app_(nullptr) { 17 TestMojoApp::TestMojoApp() : service_binding_(this), shell_(nullptr) {
18 } 18 }
19 19
20 TestMojoApp::~TestMojoApp() { 20 TestMojoApp::~TestMojoApp() {
21 } 21 }
22 22
23 void TestMojoApp::Initialize(mojo::ApplicationImpl* app) { 23 void TestMojoApp::Initialize(mojo::Shell* shell, const std::string& url,
24 app_ = app; 24 uint32_t id) {
25 shell_ = shell;
25 } 26 }
26 27
27 bool TestMojoApp::AcceptConnection( 28 bool TestMojoApp::AcceptConnection(
28 mojo::ApplicationConnection* connection) { 29 mojo::ApplicationConnection* connection) {
29 requestor_url_ = GURL(connection->GetRemoteApplicationURL()); 30 requestor_url_ = GURL(connection->GetRemoteApplicationURL());
30 connection->AddService<TestMojoService>(this); 31 connection->AddService<TestMojoService>(this);
31 return true; 32 return true;
32 } 33 }
33 34
34 void TestMojoApp::Create(mojo::ApplicationConnection* connection, 35 void TestMojoApp::Create(mojo::ApplicationConnection* connection,
35 mojo::InterfaceRequest<TestMojoService> request) { 36 mojo::InterfaceRequest<TestMojoService> request) {
36 DCHECK(!service_binding_.is_bound()); 37 DCHECK(!service_binding_.is_bound());
37 service_binding_.Bind(std::move(request)); 38 service_binding_.Bind(std::move(request));
38 } 39 }
39 40
40 void TestMojoApp::DoSomething(const DoSomethingCallback& callback) { 41 void TestMojoApp::DoSomething(const DoSomethingCallback& callback) {
41 callback.Run(); 42 callback.Run();
42 DCHECK(app_); 43 DCHECK(shell_);
43 app_->Quit(); 44 shell_->Quit();
44 } 45 }
45 46
46 void TestMojoApp::GetRequestorURL(const GetRequestorURLCallback& callback) { 47 void TestMojoApp::GetRequestorURL(const GetRequestorURLCallback& callback) {
47 callback.Run(requestor_url_.spec()); 48 callback.Run(requestor_url_.spec());
48 } 49 }
49 50
50 } // namespace content 51 } // namespace content
OLDNEW
« no previous file with comments | « content/public/test/test_mojo_app.h ('k') | content/renderer/mus/render_widget_mus_connection.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698