OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/public/test/test_mojo_app.h" |
| 6 |
| 7 #include "base/logging.h" |
| 8 #include "mojo/application/public/cpp/application_connection.h" |
| 9 #include "mojo/application/public/cpp/application_impl.h" |
| 10 |
| 11 namespace content { |
| 12 |
| 13 const char kTestMojoAppUrl[] = "system:content_mojo_test"; |
| 14 |
| 15 TestMojoApp::TestMojoApp() : service_binding_(this), app_(nullptr) { |
| 16 } |
| 17 |
| 18 TestMojoApp::~TestMojoApp() { |
| 19 } |
| 20 |
| 21 void TestMojoApp::Initialize(mojo::ApplicationImpl* app) { |
| 22 app_ = app; |
| 23 } |
| 24 |
| 25 bool TestMojoApp::ConfigureIncomingConnection( |
| 26 mojo::ApplicationConnection* connection) { |
| 27 connection->AddService<TestMojoService>(this); |
| 28 return true; |
| 29 } |
| 30 |
| 31 void TestMojoApp::Create(mojo::ApplicationConnection* connection, |
| 32 mojo::InterfaceRequest<TestMojoService> request) { |
| 33 DCHECK(!service_binding_.is_bound()); |
| 34 service_binding_.Bind(request.Pass()); |
| 35 } |
| 36 |
| 37 void TestMojoApp::DoSomething(const DoSomethingCallback& callback) { |
| 38 callback.Run(); |
| 39 DCHECK(app_); |
| 40 app_->Terminate(); |
| 41 } |
| 42 |
| 43 } // namespace content |
OLD | NEW |