Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(710)

Side by Side Diff: mojo/services/test_service/test_service_application.cc

Issue 349303006: mojo: add some end-to-end shell tests and a new test sample app (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: no icu Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "mojo/services/test_service/test_service_application.h" 5 #include "mojo/services/test_service/test_service_application.h"
6 6
7 #include <assert.h> 7 #include <assert.h>
8 8
9 #include "mojo/public/cpp/application/application_connection.h" 9 #include "mojo/public/cpp/application/application_connection.h"
10 #include "mojo/public/cpp/utility/run_loop.h" 10 #include "mojo/public/cpp/utility/run_loop.h"
11 #include "mojo/services/test_service/test_service_impl.h" 11 #include "mojo/services/test_service/test_service_impl.h"
12 #include "mojo/services/test_service/test_time_service_impl.h"
12 13
13 namespace mojo { 14 namespace mojo {
14 namespace test { 15 namespace test {
15 16
16 TestServiceApplication::TestServiceApplication() : ref_count_(0) { 17 TestServiceApplication::TestServiceApplication() : ref_count_(0) {
17 } 18 }
18 19
19 TestServiceApplication::~TestServiceApplication() { 20 TestServiceApplication::~TestServiceApplication() {
20 } 21 }
21 22
22 bool TestServiceApplication::ConfigureIncomingConnection( 23 bool TestServiceApplication::ConfigureIncomingConnection(
23 ApplicationConnection* connection) { 24 ApplicationConnection* connection) {
24 connection->AddService<TestServiceImpl>(this); 25 connection->AddService<TestServiceImpl>(this);
26 connection->AddService<TestTimeServiceImpl>();
25 return true; 27 return true;
26 } 28 }
27 29
28 void TestServiceApplication::AddRef() { 30 void TestServiceApplication::AddRef() {
29 assert(ref_count_ >= 0); 31 assert(ref_count_ >= 0);
30 ref_count_++; 32 ref_count_++;
31 } 33 }
32 34
33 void TestServiceApplication::ReleaseRef() { 35 void TestServiceApplication::ReleaseRef() {
34 assert(ref_count_ > 0); 36 assert(ref_count_ > 0);
35 ref_count_--; 37 ref_count_--;
36 if (ref_count_ <= 0) 38 if (ref_count_ <= 0)
37 RunLoop::current()->Quit(); 39 RunLoop::current()->Quit();
38 } 40 }
39 41
40 } // namespace test 42 } // namespace test
41 43
42 // static 44 // static
43 ApplicationDelegate* ApplicationDelegate::Create() { 45 ApplicationDelegate* ApplicationDelegate::Create() {
44 return new mojo::test::TestServiceApplication(); 46 return new mojo::test::TestServiceApplication();
45 } 47 }
46 48
47 } // namespace mojo 49 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/services/test_service/test_service.mojom ('k') | mojo/services/test_service/test_service_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698