diff options
Diffstat (limited to 'dbus/end_to_end_sync_unittest.cc')
-rw-r--r-- | dbus/end_to_end_sync_unittest.cc | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/dbus/end_to_end_sync_unittest.cc b/dbus/end_to_end_sync_unittest.cc index 26a9011..9cddea4 100644 --- a/dbus/end_to_end_sync_unittest.cc +++ b/dbus/end_to_end_sync_unittest.cc @@ -104,3 +104,35 @@ TEST_F(EndToEndSyncTest, BrokenMethod) { object_proxy_->CallMethodAndBlock(&method_call, timeout_ms)); ASSERT_FALSE(response.get()); } + +TEST_F(EndToEndSyncTest, InvalidObjectPath) { + // Trailing '/' is only allowed for the root path. + const dbus::ObjectPath invalid_object_path("/org/chromium/TestObject/"); + + // Replace object proxy with new one. + object_proxy_ = client_bus_->GetObjectProxy("org.chromium.TestService", + invalid_object_path); + + dbus::MethodCall method_call("org.chromium.TestInterface", "Echo"); + + const int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT; + scoped_ptr<dbus::Response> response( + object_proxy_->CallMethodAndBlock(&method_call, timeout_ms)); + ASSERT_FALSE(response.get()); +} + +TEST_F(EndToEndSyncTest, InvalidServiceName) { + // Bus name cannot contain '/'. + const std::string invalid_service_name = ":1/2"; + + // Replace object proxy with new one. + object_proxy_ = client_bus_->GetObjectProxy( + invalid_service_name, dbus::ObjectPath("org.chromium.TestObject")); + + dbus::MethodCall method_call("org.chromium.TestInterface", "Echo"); + + const int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT; + scoped_ptr<dbus::Response> response( + object_proxy_->CallMethodAndBlock(&method_call, timeout_ms)); + ASSERT_FALSE(response.get()); +} |