dbus/test/glib run-test.sh,1.6,1.7 test-service-glib.c,1.4,1.5

Havoc Pennington hp at freedesktop.org
Sat Jan 29 21:18:46 PST 2005


Update of /cvs/dbus/dbus/test/glib
In directory gabe:/tmp/cvs-serv13826/test/glib

Modified Files:
	run-test.sh test-service-glib.c 
Log Message:
2005-01-30  Havoc Pennington  <hp at redhat.com>

        dbus-viewer introspected and displayed the bus driver
	
	* dbus/dbus-object-tree.c 
	(object_tree_test_iteration): add tests for a handler registered on "/"

	* dbus/dbus-object-tree.c
	(_dbus_decompose_path): fix to handle path "/" properly
	(run_decompose_tests): add tests for path decomposition
	
	* glib/dbus-gutils.c (_dbus_gutils_split_path): fix to handle "/"
	properly

	* glib/dbus-gobject.c (handle_introspect): fix quotes

	* test/glib/run-test.sh: support launching the bus, then running
	dbus-viewer

	* test/glib/test-service-glib.c (main): put in a trivial gobject
	subclass and register it on the connection

	* bus/driver.c (bus_driver_handle_introspect): implement
	introspection of the bus driver service

	* dbus/dbus-protocol.h: add #defines for the XML namespace,
	identifiers, doctype decl

	* bus/driver.c (bus_driver_handle_get_service_owner): handle
	attempts to get owner of DBUS_SERVICE_ORG_FREEDESKTOP_DBUS by 
	returning the service unchanged.
	(bus_driver_handle_message): remove old check for reply_serial in
	method calls, now the message type deals with that
	(bus_driver_handle_message): handle NULL interface

	* glib/dbus-gproxy.c (dbus_g_proxy_get_bus_name): new function

	* glib/dbus-gloader-expat.c (description_load_from_string): allow
	-1 for len

	* tools/dbus-viewer.c: add support for introspecting a service on
	a bus

	* glib/dbus-gproxy.c (dbus_g_pending_call_ref): add
	(dbus_g_pending_call_unref): add



Index: run-test.sh
===================================================================
RCS file: /cvs/dbus/dbus/test/glib/run-test.sh,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- run-test.sh	18 Jan 2005 22:20:38 -0000	1.6
+++ run-test.sh	30 Jan 2005 05:18:44 -0000	1.7
@@ -57,12 +57,21 @@
 export DBUS_TEST_GLIB_RUN_TEST_SCRIPT=1
 
 if test x$MODE = xprofile ; then
+  echo "profiling type $PROFILE_TYPE"
   sleep 2 ## this lets the bus get started so its startup time doesn't affect the profile too much
   if test x$PROFILE_TYPE = x ; then
       PROFILE_TYPE=all
   fi
   libtool --mode=execute $DEBUG $DBUS_TOP_BUILDDIR/test/glib/test-profile $PROFILE_TYPE || die "test-profile failed"
+elif test x$MODE = xviewer ; then
+  echo "Launching dbus-viewer"
+  ARGS=
+  if test x$DEBUG = x ; then
+      ARGS="--services org.freedesktop.DBus"
+  fi
+  libtool --mode=execute $DEBUG $DBUS_TOP_BUILDDIR/tools/dbus-viewer $ARGS || die "could not run dbus-viewer"
 else
+  echo "running test-dbus-glib"
   libtool --mode=execute $DEBUG $DBUS_TOP_BUILDDIR/test/glib/test-dbus-glib || die "test-dbus-glib failed"
 fi
 

Index: test-service-glib.c
===================================================================
RCS file: /cvs/dbus/dbus/test/glib/test-service-glib.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- test-service-glib.c	18 Jan 2005 20:42:15 -0000	1.4
+++ test-service-glib.c	30 Jan 2005 05:18:44 -0000	1.5
@@ -4,6 +4,43 @@
 #include <stdlib.h>
 #include <string.h>
 
+typedef struct MyObject MyObject;
+typedef struct MyObjectClass MyObjectClass;
+
+GType my_object_get_type (void);
+
+struct MyObject
+{
+  GObject parent;
+};
+
+struct MyObjectClass
+{
+  GObjectClass parent;
+};
+
+#define MY_TYPE_OBJECT              (my_object_get_type ())
+#define MY_OBJECT_OBJECT(object)    (G_TYPE_CHECK_INSTANCE_CAST ((object), MY_TYPE_OBJECT, MyObject))
+#define MY_OBJECT_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), MY_TYPE_OBJECT, MyObjectClass))
+#define MY_IS_OBJECT(object)        (G_TYPE_CHECK_INSTANCE_TYPE ((object), MY_TYPE_OBJECT))
+#define MY_IS_OBJECT_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), MY_TYPE_OBJECT))
+#define MY_OBJECT_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), MY_TYPE_OBJECT, MyObjectClass))
+
+G_DEFINE_TYPE(MyObject, my_object, G_TYPE_OBJECT)
+
+
+static void
+my_object_init (MyObject *obj)
+{
+  
+}
+
+static void
+my_object_class_init (MyObjectClass *obj_class)
+{
+  
+}
+     
 static GMainLoop *loop;
 
 int
@@ -11,6 +48,7 @@
 {
   DBusGConnection *connection;
   GError *error;
+  GObject *obj;
   
   g_type_init ();
   
@@ -27,7 +65,15 @@
       exit (1);
     }
 
+  obj = g_object_new (MY_TYPE_OBJECT, NULL);
+
+  dbus_g_connection_register_g_object (connection,
+                                       "/org/freedesktop/my_test_object",
+                                       obj);
   
+  g_print ("GLib test service entering main loop\n");
+
+  g_main_loop_run (loop);
   
   g_print ("Successfully completed %s\n", argv[0]);
   



More information about the dbus-commit mailing list