summaryrefslogtreecommitdiffstats
path: root/dbus/end_to_end_async_unittest.cc
diff options
context:
space:
mode:
authorsatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-11 08:36:22 +0000
committersatorux@chromium.org <satorux@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-11 08:36:22 +0000
commit65e8e25eee8e389374532e483b46e53ad66ee5c8 (patch)
treebcd2687ea46778ec751a26e537910a0dd8aece36 /dbus/end_to_end_async_unittest.cc
parent442d0ba82dec256585282a85c15ff78e9e2d4f59 (diff)
downloadchromium_src-65e8e25eee8e389374532e483b46e53ad66ee5c8.zip
chromium_src-65e8e25eee8e389374532e483b46e53ad66ee5c8.tar.gz
chromium_src-65e8e25eee8e389374532e483b46e53ad66ee5c8.tar.bz2
dbus: Add ObjectProxy::EmptyResponseCallback().
This can be used when the caller is not interested in the response from the D-bus method. BUG=none TEST=added a unit test Review URL: http://codereview.chromium.org/8536007 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109598 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'dbus/end_to_end_async_unittest.cc')
-rw-r--r--dbus/end_to_end_async_unittest.cc23
1 files changed, 23 insertions, 0 deletions
diff --git a/dbus/end_to_end_async_unittest.cc b/dbus/end_to_end_async_unittest.cc
index 7d52130..7ba782b 100644
--- a/dbus/end_to_end_async_unittest.cc
+++ b/dbus/end_to_end_async_unittest.cc
@@ -10,6 +10,7 @@
#include "base/memory/scoped_ptr.h"
#include "base/message_loop.h"
#include "base/stl_util.h"
+#include "base/test/test_timeouts.h"
#include "base/threading/thread.h"
#include "base/threading/thread_restrictions.h"
#include "dbus/bus.h"
@@ -225,6 +226,28 @@ TEST_F(EndToEndAsyncTest, BrokenMethod) {
ASSERT_EQ("", response_strings_[0]);
}
+TEST_F(EndToEndAsyncTest, EmptyResponseCallback) {
+ const char* kHello = "hello";
+
+ // Create the method call.
+ dbus::MethodCall method_call("org.chromium.TestInterface", "Echo");
+ dbus::MessageWriter writer(&method_call);
+ writer.AppendString(kHello);
+
+ // Call the method with an empty callback.
+ const int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT;
+ object_proxy_->CallMethod(&method_call,
+ timeout_ms,
+ dbus::ObjectProxy::EmptyResponseCallback());
+ // Post a delayed task to quit the message loop.
+ message_loop_.PostDelayedTask(FROM_HERE,
+ MessageLoop::QuitClosure(),
+ TestTimeouts::tiny_timeout_ms());
+ message_loop_.Run();
+ // We cannot tell if the empty callback is called, but at least we can
+ // check if the test does not crash.
+}
+
TEST_F(EndToEndAsyncTest, TestSignal) {
const char kMessage[] = "hello, world";
// Send the test signal from the exported object.