blob: 13cb9affcd543b9bc2ea636eb3ae00950c77bf58 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
|
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "content/public/test/test_mojo_app.h"
#include "base/logging.h"
#include "mojo/application/public/cpp/application_connection.h"
#include "mojo/application/public/cpp/application_impl.h"
namespace content {
const char kTestMojoAppUrl[] = "system:content_mojo_test";
TestMojoApp::TestMojoApp() : service_binding_(this), app_(nullptr) {
}
TestMojoApp::~TestMojoApp() {
}
void TestMojoApp::Initialize(mojo::ApplicationImpl* app) {
app_ = app;
}
bool TestMojoApp::ConfigureIncomingConnection(
mojo::ApplicationConnection* connection) {
requestor_url_ = GURL(connection->GetRemoteApplicationURL());
connection->AddService<TestMojoService>(this);
return true;
}
void TestMojoApp::Create(mojo::ApplicationConnection* connection,
mojo::InterfaceRequest<TestMojoService> request) {
DCHECK(!service_binding_.is_bound());
service_binding_.Bind(request.Pass());
}
void TestMojoApp::DoSomething(const DoSomethingCallback& callback) {
callback.Run();
DCHECK(app_);
app_->Quit();
}
void TestMojoApp::GetRequestorURL(const GetRequestorURLCallback& callback) {
callback.Run(requestor_url_.spec());
}
} // namespace content
|