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

Unified Diff: dbus/end_to_end_async_unittest.cc

Issue 10409065: Change setters of dbus::Message to return false instead of aborting on errors (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: _ Created 8 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | dbus/end_to_end_sync_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dbus/end_to_end_async_unittest.cc
diff --git a/dbus/end_to_end_async_unittest.cc b/dbus/end_to_end_async_unittest.cc
index a4438e4ae521cf7834b6d66580da88a9bd3c5599..d5e278fc436b30827984eb0fb5ac82e7fc660f1f 100644
--- a/dbus/end_to_end_async_unittest.cc
+++ b/dbus/end_to_end_async_unittest.cc
@@ -453,6 +453,44 @@ TEST_F(EndToEndAsyncTest, BrokenMethodWithErrorCallback) {
ASSERT_EQ(DBUS_ERROR_FAILED, error_names_[0]);
}
+TEST_F(EndToEndAsyncTest, 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_ = 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;
+ CallMethodWithErrorCallback(&method_call, timeout_ms);
+ WaitForErrors(1);
+
+ // Should fail because of the invalid path.
+ ASSERT_TRUE(response_strings_.empty());
+ ASSERT_EQ("", error_names_[0]);
+}
+
+TEST_F(EndToEndAsyncTest, InvalidServiceName) {
+ // Bus name cannot contain '/'.
+ const std::string invalid_service_name = ":1/2";
+
+ // Replace object proxy with new one.
+ object_proxy_ = 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;
+ CallMethodWithErrorCallback(&method_call, timeout_ms);
+ WaitForErrors(1);
+
+ // Should fail because of the invalid bus name.
+ ASSERT_TRUE(response_strings_.empty());
+ ASSERT_EQ("", error_names_[0]);
+}
+
TEST_F(EndToEndAsyncTest, EmptyResponseCallback) {
const char* kHello = "hello";
« no previous file with comments | « no previous file | dbus/end_to_end_sync_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698