OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_path.h" | 9 #include "dbus/object_path.h" |
10 #include "dbus/object_proxy.h" | 10 #include "dbus/object_proxy.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 } | 97 } |
98 | 98 |
99 TEST_F(EndToEndSyncTest, BrokenMethod) { | 99 TEST_F(EndToEndSyncTest, BrokenMethod) { |
100 dbus::MethodCall method_call("org.chromium.TestInterface", "BrokenMethod"); | 100 dbus::MethodCall method_call("org.chromium.TestInterface", "BrokenMethod"); |
101 | 101 |
102 const int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT; | 102 const int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT; |
103 scoped_ptr<dbus::Response> response( | 103 scoped_ptr<dbus::Response> response( |
104 object_proxy_->CallMethodAndBlock(&method_call, timeout_ms)); | 104 object_proxy_->CallMethodAndBlock(&method_call, timeout_ms)); |
105 ASSERT_FALSE(response.get()); | 105 ASSERT_FALSE(response.get()); |
106 } | 106 } |
| 107 |
| 108 TEST_F(EndToEndSyncTest, InvalidObjectPath) { |
| 109 // Trailing '/' is only allowed for the root path. |
| 110 const dbus::ObjectPath invalid_object_path("/org/chromium/TestObject/"); |
| 111 |
| 112 // Replace object proxy with new one. |
| 113 object_proxy_ = client_bus_->GetObjectProxy("org.chromium.TestService", |
| 114 invalid_object_path); |
| 115 |
| 116 dbus::MethodCall method_call("org.chromium.TestInterface", "Echo"); |
| 117 |
| 118 const int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT; |
| 119 scoped_ptr<dbus::Response> response( |
| 120 object_proxy_->CallMethodAndBlock(&method_call, timeout_ms)); |
| 121 ASSERT_FALSE(response.get()); |
| 122 } |
| 123 |
| 124 TEST_F(EndToEndSyncTest, InvalidServiceName) { |
| 125 // Bus name cannot contain '/'. |
| 126 const std::string invalid_service_name = ":1/2"; |
| 127 |
| 128 // Replace object proxy with new one. |
| 129 object_proxy_ = client_bus_->GetObjectProxy( |
| 130 invalid_service_name, dbus::ObjectPath("org.chromium.TestObject")); |
| 131 |
| 132 dbus::MethodCall method_call("org.chromium.TestInterface", "Echo"); |
| 133 |
| 134 const int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT; |
| 135 scoped_ptr<dbus::Response> response( |
| 136 object_proxy_->CallMethodAndBlock(&method_call, timeout_ms)); |
| 137 ASSERT_FALSE(response.get()); |
| 138 } |
OLD | NEW |