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/public/c/system/main.h"
10 #include "mojo/public/cpp/application/application_connection.h"
11 #include "mojo/public/cpp/application/application_runner.h"
12 #include "mojo/services/test_service/test_time_service_impl.h"
17 TestRequestTrackerApplication::TestRequestTrackerApplication()
18 : test_tracked_request_factory_(&context_
),
19 test_request_tracker_factory_(&context_
) {
22 TestRequestTrackerApplication::~TestRequestTrackerApplication() {
25 bool TestRequestTrackerApplication::ConfigureIncomingConnection(
26 ApplicationConnection
* connection
) {
27 // Every instance of the service and recorder shares the context.
28 // Note, this app is single-threaded, so this is thread safe.
29 connection
->AddService(&test_tracked_request_factory_
);
30 connection
->AddService(&test_request_tracker_factory_
);
31 connection
->AddService(this);
35 void TestRequestTrackerApplication::Create(
36 ApplicationConnection
* connection
,
37 InterfaceRequest
<TestTimeService
> request
) {
38 BindToRequest(new TestTimeServiceImpl(connection
), &request
);
44 MojoResult
MojoMain(MojoHandle shell_handle
) {
45 mojo::ApplicationRunner
runner(
46 new mojo::test::TestRequestTrackerApplication
);
47 return runner
.Run(shell_handle
);