Commit Graph

1524 Commits

Author SHA1 Message Date
Matthias Clasen
584787f580 Improve the async result test coverage 2010-08-08 21:32:03 -04:00
Matthias Clasen
7c129c9011 Improve dbus address test coverage 2010-08-08 21:32:03 -04:00
Matthias Clasen
51ad83f711 Make g_dbus_error_unregister_error work 2010-08-07 18:56:12 -04:00
Matthias Clasen
8e236f7ec1 Add some more test about gdbus_error apis 2010-08-07 18:55:21 -04:00
Matthias Clasen
7de6658f74 Make g_simple_async_result_is_valid work without source
The problem was pointed out by Xavier Claessens in bug 626208.
2010-08-07 17:10:17 -04:00
Matthias Clasen
402ad1958c Make the closure variants of name owning and watching actually work
The GClosure API is a bit funky (and badly documented), and requires
you to set a marshaller on the closure, and the marshaller has an
implicit 'this' argument, and the caller is reponsible for unsetting
the values after invoking the closure.

I've added some calls of the _with_closures variants to the
gdbus-names test now.
2010-08-07 17:10:17 -04:00
Ryan Lortie
b91f9274d9 Fix volumemonitor test case
Don't blindly g_object_unref() that which may be NULL.
2010-08-06 13:12:20 -04:00
Ryan Lortie
889a7f81dd gio.symbols: add g_dbus_message_[gs]et_byte_order 2010-08-06 13:11:38 -04:00
Ryan Lortie
b3b7ea8e22 Replace -I with $(glib_INCLUDES) and friends
Stop using ad hoc -I in all of our Makefile.am.  Use the new variables
instead.
2010-08-06 13:10:34 -04:00
Ryan Lortie
ba0208b3a8 Clean up improper #includes
We have a lot of broken #including going on around the tree.  This has
gone unnoticed due to our sloppy use of -I.
2010-08-06 13:05:18 -04:00
paul
9f6faaffb6 Add $(top_builddir)/glib to includes
This is required to find glibconfig.h during srcdir != builddir builds
2010-08-05 09:08:34 -04:00
David Zeuthen
d52e1c33f7 GDBus: Add `return' debug option
This prints all GDBusMethodInvocation API usage and is normally used
with the `incoming' option. Example:

 # G_DBUS_DEBUG=incoming,return ./polkitd --replace
 Entering main event loop
 Connected to the system bus
 Registering null backend at priority -10
 [...]
 Acquired the name org.freedesktop.PolicyKit1
 [...]

 ========================================================================
 GDBus-debug:Incoming:
  <<<< METHOD INVOCATION org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgent()
       on object /org/freedesktop/PolicyKit1/Authority
       invoked by name :1.26
       serial 299
 ========================================================================
 GDBus-debug:Return:
  >>>> METHOD ERROR org.freedesktop.PolicyKit1.Error.Failed
       message `Cannot determine session the caller is in'
       in response to org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgent()
       on object /org/freedesktop/PolicyKit1/Authority
       to name :1.26
       reply-serial 299

 [...]

 ========================================================================
 GDBus-debug:Incoming:
  <<<< METHOD INVOCATION org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgent()
       on object /org/freedesktop/PolicyKit1/Authority
       invoked by name :1.2402
       serial 25
 ========================================================================
 GDBus-debug:Return:
  >>>> METHOD RETURN
       in response to org.freedesktop.PolicyKit1.Authority.RegisterAuthenticationAgent()
       on object /org/freedesktop/PolicyKit1/Authority
       to name :1.2402
       reply-serial 25

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-04 16:59:26 -04:00
David Zeuthen
89a1b571ad GDBusMessage: Validate header fields when serializing/deserializing
The D-Bus spec mentions exactly what header fields are required for
various message types. Add tests for this as well.

Also disallow empty interfaces for signals since the D-Bus spec says
this is Verboten already.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-04 14:38:51 -04:00
David Zeuthen
6f070be65b GDBusMessage: Add a way to get/set byte order of a message
Also use this in the test cases to check that serialization to and
from both big and little endian works.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-04 13:34:14 -04:00
David Zeuthen
6e723e8b3e GDBusMessage: Assert various things when serializing to a blob
We use g_assert() instead of setting the GError because it is a
programming error if the GVariant contains invalid data - see commit
5e6f762d61 for where the last hole in
GVariant was closed.

So if we can trust GVariant to only contain valid data (ignoring the
case where unsafe API such as g_variant_new_from_data() is used), why
g_assert() at all with costly g_utf8_validate() checks? Because a) it
is relatively inexpensive; and b) it helps find bugs such as the one
fixed in commit 5e6f762d61.

If performance is a concern we can play games like introducing
environment variables or other machinery to avoid such "costly"
checks. I doubt it will ever be an issue.

Also replace two "Hmm" TODO item with a static assert - the code that
serializes a gdouble into the D-Bus wire format by treating it as a
guint64 is indeed correct - endianess needs to be taken into account
(see the D-Bus reference implementation for similar code). But we want
to make sure that we're indeed using an architecture/compiler where a
gdouble takes up 8 bytes - hence the assertion.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-04 12:24:22 -04:00
David Zeuthen
5bd34a820e GDBusMessage: Validate UTF-8 strings when serializing from blob
Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-04 11:26:48 -04:00
Dan Winship
e62bc8e8f6 remove a junk line 2010-08-04 07:36:34 -04:00
David Zeuthen
f5cd8ddeaa GDBusConnection: Debug messages when receiving signals and method invocations
Spell out "RECEIVED SIGNAL" instead of "SIGNAL" to emphasize this is
about receiving a signal, not emitting one (which is "SIGNAL
EMISSION"). Also make the "arrows" point in the "right" direction
("<<<<" vs ">>>>") - like this:

 ========================================================================
 GDBus-debug:Signal:
  <<<< RECEIVED SIGNAL org.freedesktop.DBus.NameOwnerChanged
       on object /org/freedesktop/DBus
       sent by name org.freedesktop.DBus

and

 ========================================================================
 GDBus-debug:Incoming:
  <<<< METHOD INVOCATION org.freedesktop.PolicyKit1.Authority.EnumerateTemporaryAuthorizations()
       on object /org/freedesktop/PolicyKit1/Authority
       invoked by name :1.2176

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-03 15:36:16 -04:00
David Zeuthen
69341e2ba9 glib-compile-schemas: Pass a C string, not a GString wrapper
Commit 5e6f762d61 (introducing UTF-8
validity checks for GVariant instances containing strsings) actually
uncovered a bug in glib-compile-schemas - a GString was passed when a
C string was expected.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-03 14:32:29 -04:00
David Zeuthen
86d947f01f Fix gdbus-exit-on-close test case
Forgot to update the test case after last commit.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-03 12:47:07 -04:00
David Zeuthen
6a492a4519 GDBus: If exiting b/c remote peer disconnected and error is set, print it
This should make things easier to debug:

  g_dbus_connection_real_closed: Remote peer vanished with error:
  Underlying GIOStream returned 0 bytes on an async read
  (g-io-error-quark, 0). Exiting.

Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-03 12:24:48 -04:00
David Zeuthen
3940cc9a11 GDBusProxy: Don't leak a GSimpleAsyncResult when doing async calls
Signed-off-by: David Zeuthen <davidz@redhat.com>
2010-08-03 11:14:21 -04:00
Matthias Clasen
b2715bbc5e Fix a possible deadlock
the FdSource was calling g_cancellable_disconnect while holding the
main context lock, which is bad news if the ::cancelled handler is
trying to get that lock to wake up the mainloop...

Bug 586432
2010-08-03 10:41:21 -04:00
Emmanuele Bassi
b3de028a43 Update the Git ignore files 2010-08-03 14:21:02 +01:00
Ryan Lortie
ca3b7b75bf GSettings: add G_SETTINGS_BIND_INVERT_BOOLEAN flag
When binding a boolean setting to a boolean property, invert the values.
This avoids the requirement for writing a pair of mapping functions for
this extremely common case.

Add a test.

https://bugzilla.gnome.org/show_bug.cgi?id=625833
2010-08-03 02:09:10 -04:00
Fridrich Štrba
dd2bbc9533 On windows, export also symbols defined in gio/gwin32appinfo.c 2010-08-02 10:16:29 +02:00
Carlos Garcia Campos
892012b951 GDBusConnection: fix message flags in g_dbus_connection_call_sync()
GDBusCallFlags were used instead of GDBusSendMessageFlags for
g_dbus_connection_send_message_with_reply_sync(). Fixes bug #625753.
2010-08-01 17:27:58 +02:00
Milan Crha
d01a437490 Silence valgrind
Initialize all fields of struct msghdr. Bug 625472.
2010-07-31 23:51:45 -04:00
Matthias Clasen
8246bf4bde Improve gdbus test coverage 2010-07-31 00:13:02 -04:00
Matthias Clasen
116b945c94 Fix a typo
Its credentials, not crendentials
2010-07-30 23:44:30 -04:00
Matthias Clasen
eb3e926b09 Fix an off-by-one error 2010-07-30 19:53:29 -04:00
Matthias Clasen
5033be80d1 Add a test for g_dbus_proxy_get_cached_property_names 2010-07-30 19:51:22 -04:00
Matthias Clasen
aa196c60df Improve coverage of buffered output stream tests 2010-07-30 19:51:21 -04:00
Matthias Clasen
ffa938fc65 Improve coverage of credentials tests 2010-07-30 19:51:21 -04:00
Matthias Clasen
670528c187 Improve coverage of converter stream tests 2010-07-30 19:51:21 -04:00
Matthias Clasen
9794a648a9 Improve coverage of memory stream tests 2010-07-30 19:51:21 -04:00
Matthias Clasen
620582e59c Remove redundant include 2010-07-30 19:51:20 -04:00
Matthias Clasen
17d4898d75 Improve coverage of icon tests 2010-07-30 19:51:20 -04:00
Matthias Clasen
7710c50fb2 Improve coverage of application tests 2010-07-30 19:51:20 -04:00
Matthias Clasen
758c3216cd Improve coverage of stream tests 2010-07-30 19:51:20 -04:00
Matthias Clasen
c6b0507167 Reenable unix-streams test 2010-07-30 19:51:20 -04:00
Matthias Clasen
04c7abba11 Work around deadlock in unix-streams test 2010-07-30 19:51:20 -04:00
Matthias Clasen
b463b2ea25 Add tests about file associations 2010-07-30 19:51:20 -04:00
Matthias Clasen
13ac9f94fd Add some more GFile tests 2010-07-30 19:51:19 -04:00
Matthias Clasen
8263d691cb Improve compressor test coverage a bit 2010-07-30 19:51:19 -04:00
Matthias Clasen
b77a19f238 Test g_settings_list_schemas 2010-07-30 19:51:19 -04:00
Matthias Clasen
caa9453b72 Fix a warning 2010-07-30 19:51:18 -04:00
Matthias Clasen
d0750c9d6e Don't leak in converter test 2010-07-30 19:51:18 -04:00
Matthias Clasen
63bdeb0dab Fix an icon test 2010-07-30 19:51:17 -04:00
Matthias Clasen
a8f83ea834 Add tests for GNetworkAddress 2010-07-30 19:51:17 -04:00