OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "dbus/bus.h" | 8 #include "dbus/bus.h" |
9 #include "dbus/object_proxy.h" | 9 #include "dbus/object_proxy.h" |
10 #include "dbus/test_service.h" | 10 #include "dbus/test_service.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
12 | 12 |
13 namespace dbus { | 13 namespace dbus { |
14 namespace { | 14 namespace { |
15 | 15 |
16 class ObjectProxyTest : public testing::Test { | 16 class ObjectProxyTest : public testing::Test { |
17 protected: | 17 protected: |
18 virtual void SetUp() OVERRIDE { | 18 virtual void SetUp() override { |
19 Bus::Options bus_options; | 19 Bus::Options bus_options; |
20 bus_options.bus_type = Bus::SESSION; | 20 bus_options.bus_type = Bus::SESSION; |
21 bus_options.connection_type = Bus::PRIVATE; | 21 bus_options.connection_type = Bus::PRIVATE; |
22 bus_ = new Bus(bus_options); | 22 bus_ = new Bus(bus_options); |
23 | 23 |
24 object_proxy_ = bus_->GetObjectProxy( | 24 object_proxy_ = bus_->GetObjectProxy( |
25 "org.chromium.TestService", ObjectPath("/org/chromium/TestObject")); | 25 "org.chromium.TestService", ObjectPath("/org/chromium/TestObject")); |
26 } | 26 } |
27 | 27 |
28 virtual void TearDown() OVERRIDE { | 28 virtual void TearDown() override { |
29 bus_->ShutdownAndBlock(); | 29 bus_->ShutdownAndBlock(); |
30 } | 30 } |
31 | 31 |
32 base::MessageLoopForIO message_loop_; | 32 base::MessageLoopForIO message_loop_; |
33 scoped_refptr<Bus> bus_; | 33 scoped_refptr<Bus> bus_; |
34 ObjectProxy* object_proxy_; | 34 ObjectProxy* object_proxy_; |
35 }; | 35 }; |
36 | 36 |
37 // Used as a WaitForServiceToBeAvailableCallback. | 37 // Used as a WaitForServiceToBeAvailableCallback. |
38 void OnServiceIsAvailable(scoped_ptr<base::RunLoop>* run_loop, | 38 void OnServiceIsAvailable(scoped_ptr<base::RunLoop>* run_loop, |
(...skipping 28 matching lines...) Expand all Loading... |
67 base::Bind(&OnServiceIsAvailable, &run_loop)); | 67 base::Bind(&OnServiceIsAvailable, &run_loop)); |
68 run_loop->Run(); | 68 run_loop->Run(); |
69 | 69 |
70 // Shut down the service. | 70 // Shut down the service. |
71 test_service.ShutdownAndBlock(); | 71 test_service.ShutdownAndBlock(); |
72 test_service.Stop(); | 72 test_service.Stop(); |
73 } | 73 } |
74 | 74 |
75 } // namespace | 75 } // namespace |
76 } // namespace dbus | 76 } // namespace dbus |
OLD | NEW |