1 // Copyright 2014 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.
5 #include "mojo/services/test_service/test_request_tracker_application.h"
9 #include "mojo/application/public/cpp/application_connection.h"
10 #include "mojo/application/public/cpp/application_runner.h"
11 #include "mojo/public/c/system/main.h"
12 #include "mojo/services/test_service/test_time_service_impl.h"
17 TestRequestTrackerApplication::TestRequestTrackerApplication()
18 : app_impl_(nullptr) {
21 TestRequestTrackerApplication::~TestRequestTrackerApplication() {
24 void TestRequestTrackerApplication::Initialize(ApplicationImpl
* app
) {
28 bool TestRequestTrackerApplication::ConfigureIncomingConnection(
29 ApplicationConnection
* connection
) {
30 // Every instance of the service and recorder shares the context.
31 // Note, this app is single-threaded, so this is thread safe.
32 connection
->AddService
<TestTimeService
>(this);
33 connection
->AddService
<TestRequestTracker
>(this);
34 connection
->AddService
<TestTrackedRequestService
>(this);
38 void TestRequestTrackerApplication::Create(
39 ApplicationConnection
* connection
,
40 InterfaceRequest
<TestTimeService
> request
) {
41 new TestTimeServiceImpl(app_impl_
, request
.Pass());
44 void TestRequestTrackerApplication::Create(
45 ApplicationConnection
* connection
,
46 InterfaceRequest
<TestRequestTracker
> request
) {
47 new TestRequestTrackerImpl(request
.Pass(), &context_
);
50 void TestRequestTrackerApplication::Create(
51 ApplicationConnection
* connection
,
52 InterfaceRequest
<TestTrackedRequestService
> request
) {
53 new TestTrackedRequestServiceImpl(request
.Pass(), &context_
);
59 MojoResult
MojoMain(MojoHandle shell_handle
) {
60 mojo::ApplicationRunner
runner(
61 new mojo::test::TestRequestTrackerApplication
);
62 return runner
.Run(shell_handle
);