From f34dabdeb6ff9e25515bb68bac78af7f49ce6f3a Mon Sep 17 00:00:00 2001 From: "vlaviano@chromium.org" Date: Thu, 24 Nov 2011 02:23:33 +0000 Subject: chrome: dbus: support asynchronous method replies BUG=chromium-os:23241 TEST=Unit tests and manual testing on device. Change-Id: I4d665897687030f4ab2379e4f6ddb9b3ebe02af4 Review URL: http://codereview.chromium.org/8637002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111479 0039d316-1c4b-4281-b951-d872f2087c98 --- dbus/end_to_end_async_unittest.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to '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 2f486f4..5c98fe9 100644 --- a/dbus/end_to_end_async_unittest.cc +++ b/dbus/end_to_end_async_unittest.cc @@ -223,6 +223,24 @@ TEST_F(EndToEndAsyncTest, Timeout) { ASSERT_EQ("", response_strings_[0]); } +// Tests calling a method that sends its reply asynchronously. +TEST_F(EndToEndAsyncTest, AsyncEcho) { + const char* kHello = "hello"; + + // Create the method call. + dbus::MethodCall method_call("org.chromium.TestInterface", "AsyncEcho"); + dbus::MessageWriter writer(&method_call); + writer.AppendString(kHello); + + // Call the method. + const int timeout_ms = dbus::ObjectProxy::TIMEOUT_USE_DEFAULT; + CallMethod(&method_call, timeout_ms); + + // Check the response. + WaitForResponses(1); + EXPECT_EQ(kHello, response_strings_[0]); +} + TEST_F(EndToEndAsyncTest, NonexistentMethod) { dbus::MethodCall method_call("org.chromium.TestInterface", "Nonexistent"); -- cgit v1.1