OLD | NEW |
| (Empty) |
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. | |
4 | |
5 #include "mojo/services/test_service/test_request_tracker_application.h" | |
6 | |
7 #include <assert.h> | |
8 | |
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" | |
13 | |
14 namespace mojo { | |
15 namespace test { | |
16 | |
17 TestRequestTrackerApplication::TestRequestTrackerApplication() | |
18 : test_tracked_request_factory_(&context_) { | |
19 } | |
20 | |
21 TestRequestTrackerApplication::~TestRequestTrackerApplication() { | |
22 } | |
23 | |
24 bool TestRequestTrackerApplication::ConfigureIncomingConnection( | |
25 ApplicationConnection* connection) { | |
26 // Every instance of the service and recorder shares the context. | |
27 // Note, this app is single-threaded, so this is thread safe. | |
28 connection->AddService(&test_tracked_request_factory_); | |
29 connection->AddService<TestTimeService>(this); | |
30 connection->AddService<TestRequestTracker>(this); | |
31 return true; | |
32 } | |
33 | |
34 void TestRequestTrackerApplication::Create( | |
35 ApplicationConnection* connection, | |
36 InterfaceRequest<TestTimeService> request) { | |
37 new TestTimeServiceImpl(connection, request.Pass()); | |
38 } | |
39 | |
40 void TestRequestTrackerApplication::Create( | |
41 ApplicationConnection* connection, | |
42 InterfaceRequest<TestRequestTracker> request) { | |
43 TestRequestTrackerImpl* impl = | |
44 BindToRequest(new TestRequestTrackerImpl(&context_), &request); | |
45 impl->OnConnectionEstablished(); | |
46 } | |
47 | |
48 } // namespace test | |
49 } // namespace mojo | |
50 | |
51 MojoResult MojoMain(MojoHandle shell_handle) { | |
52 mojo::ApplicationRunner runner( | |
53 new mojo::test::TestRequestTrackerApplication); | |
54 return runner.Run(shell_handle); | |
55 } | |
OLD | NEW |