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

Unified Diff: dbus/end_to_end_async_unittest.cc

Issue 8536007: dbus: Add ObjectProxy::EmptyResponseCallback(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup Created 9 years, 1 month 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/object_proxy.h » ('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 7d52130b954190904461701979f2edc7ea5982ee..7ba782ba54870e186c17e3ac3e1f01c67bc76c6b 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.
« no previous file with comments | « no previous file | dbus/object_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698