dbus/bus dispatch.c,1.70,1.71
John Palmieri
johnp at freedesktop.org
Sat Jul 16 01:21:47 EST 2005
Update of /cvs/dbus/dbus/bus
In directory gabe:/tmp/cvs-serv27299/bus
Modified Files:
dispatch.c
Log Message:
* bus/dispatch.c, test/test-service.c: Add testcase
for sending messages to oneself (TODO item).
* python/service.py (class Object): Swap ordering of bus_name
and object_path parameters to better support inheritance.
* doc/dbus-tutorial.xml: change Python docs to reflect change
in parameter ordering and fix the inheritance section.
* doc/TODO: remove sending message to oneself TODO item
Index: dispatch.c
===================================================================
RCS file: /cvs/dbus/dbus/bus/dispatch.c,v
retrieving revision 1.70
retrieving revision 1.71
diff -u -d -r1.70 -r1.71
--- dispatch.c 14 Jul 2005 20:44:15 -0000 1.70
+++ dispatch.c 15 Jul 2005 15:21:43 -0000 1.71
@@ -2810,6 +2810,79 @@
}
#define TEST_ECHO_MESSAGE "Test echo message"
+#define TEST_RUN_HELLO_FROM_SELF_MESSAGE "Test sending message to self"
+
+/* returns TRUE if the correct thing happens,
+ * but the correct thing may include OOM errors.
+ */
+static dbus_bool_t
+check_existent_hello_from_self (BusContext *context,
+ DBusConnection *connection)
+{
+ DBusMessage *message;
+ dbus_uint32_t serial;
+ dbus_bool_t retval;
+ const char *base_service;
+ const char *text;
+
+ message = dbus_message_new_method_call (EXISTENT_SERVICE_NAME,
+ "/org/freedesktop/TestSuite",
+ "org.freedesktop.TestSuite",
+ "RunHelloFromSelf");
+
+ if (message == NULL)
+ return TRUE;
+
+ text = TEST_RUN_HELLO_FROM_SELF_MESSAGE;
+ if (!dbus_message_append_args (message,
+ DBUS_TYPE_STRING, &text,
+ DBUS_TYPE_INVALID))
+ {
+ dbus_message_unref (message);
+ return TRUE;
+ }
+
+ if (!dbus_connection_send (connection, message, &serial))
+ {
+ dbus_message_unref (message);
+ return TRUE;
+ }
+
+ dbus_message_unref (message);
+ message = NULL;
+
+ bus_test_run_everything (context);
+
+ /* Note: if this test is run in OOM mode, it will block when the bus
+ * doesn't send a reply due to OOM.
+ */
+ block_connection_until_message_from_bus (context, connection, "reply from running hello from self");
+
+ message = pop_message_waiting_for_memory (connection);
+ if (message == NULL)
+ {
+ _dbus_warn ("Failed to pop message! Should have been reply from RunHelloFromSelf message\n");
+ goto out;
+ }
+
+ if (dbus_message_get_reply_serial (message) != serial)
+ {
+ _dbus_warn ("Wrong reply serial\n");
+ goto out;
+ }
+
+ dbus_message_unref (message);
+ message = NULL;
+
+ retval = TRUE;
+
+ out:
+ if (message)
+ dbus_message_unref (message);
+
+ return retval;
+}
+
/* returns TRUE if the correct thing happens,
* but the correct thing may include OOM errors.
@@ -2985,7 +3058,10 @@
dbus_message_unref (message);
message = NULL;
-
+
+ if (!check_existent_hello_from_self (context, connection))
+ goto out;
+
if (!check_send_exit_to_service (context, connection,
EXISTENT_SERVICE_NAME,
base_service))
More information about the dbus-commit
mailing list