OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/memory/ref_counted.h" | 5 #include "base/memory/ref_counted.h" |
6 #include "base/memory/scoped_ptr.h" | 6 #include "base/memory/scoped_ptr.h" |
7 #include "dbus/bus.h" | 7 #include "dbus/bus.h" |
8 #include "dbus/message.h" | 8 #include "dbus/message.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" |
(...skipping 19 matching lines...) Expand all Loading... |
30 dbus::Bus::Options client_bus_options; | 30 dbus::Bus::Options client_bus_options; |
31 client_bus_options.bus_type = dbus::Bus::SESSION; | 31 client_bus_options.bus_type = dbus::Bus::SESSION; |
32 client_bus_options.connection_type = dbus::Bus::PRIVATE; | 32 client_bus_options.connection_type = dbus::Bus::PRIVATE; |
33 client_bus_ = new dbus::Bus(client_bus_options); | 33 client_bus_ = new dbus::Bus(client_bus_options); |
34 object_proxy_ = client_bus_->GetObjectProxy("org.chromium.TestService", | 34 object_proxy_ = client_bus_->GetObjectProxy("org.chromium.TestService", |
35 "/org/chromium/TestObject"); | 35 "/org/chromium/TestObject"); |
36 ASSERT_FALSE(client_bus_->HasDBusThread()); | 36 ASSERT_FALSE(client_bus_->HasDBusThread()); |
37 } | 37 } |
38 | 38 |
39 virtual void TearDown() { | 39 virtual void TearDown() { |
40 test_service_->Shutdown(); | 40 test_service_->ShutdownAndBlock(); |
41 ASSERT_TRUE(test_service_->WaitUntilServiceIsShutdown()); | |
42 test_service_->Stop(); | 41 test_service_->Stop(); |
43 client_bus_->ShutdownAndBlock(); | 42 client_bus_->ShutdownAndBlock(); |
44 } | 43 } |
45 | 44 |
46 protected: | 45 protected: |
47 scoped_ptr<dbus::TestService> test_service_; | 46 scoped_ptr<dbus::TestService> test_service_; |
48 scoped_refptr<dbus::Bus> client_bus_; | 47 scoped_refptr<dbus::Bus> client_bus_; |
49 dbus::ObjectProxy* object_proxy_; | 48 dbus::ObjectProxy* object_proxy_; |
50 }; | 49 }; |
51 | 50 |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 } | 95 } |
97 | 96 |
98 TEST_F(EndToEndSyncTest, BrokenMethod) { | 97 TEST_F(EndToEndSyncTest, BrokenMethod) { |
99 dbus::MethodCall method_call("org.chromium.TestInterface", "BrokenMethod"); | 98 dbus::MethodCall method_call("org.chromium.TestInterface", "BrokenMethod"); |
100 | 99 |
101 const int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT; | 100 const int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT; |
102 scoped_ptr<dbus::Response> response( | 101 scoped_ptr<dbus::Response> response( |
103 object_proxy_->CallMethodAndBlock(&method_call, timeout_ms)); | 102 object_proxy_->CallMethodAndBlock(&method_call, timeout_ms)); |
104 ASSERT_FALSE(response.get()); | 103 ASSERT_FALSE(response.get()); |
105 } | 104 } |
OLD | NEW |