Commit Graph

580 Commits

Author SHA1 Message Date
Alexander Larsson
e041843b3e Support resource:/// uris 2012-01-13 17:12:57 +01:00
Alexander Larsson
75439298f8 Add tests for GResource 2012-01-13 17:12:53 +01:00
Javier Jardón
ee044fd839 gio/tests: Use g_list_free_full() convenience function 2012-01-02 23:18:22 +01:00
Simon McVittie
34e3881f2f Add test for GDBusConnection singleton access racing with destruction
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=665211
2012-01-02 12:29:57 -05:00
Simon McVittie
fa4792c35e various tests: do not provoke SIGTRAP with -m no-undefined
Some of the GLib tests deliberately provoke warnings (or even fatal
errors) in a forked child. Normally, this is fine, but under valgrind
it's somewhat undesirable. We do want to follow fork(), so we can check
for leaks in child processes that exit gracefully; but we don't want to
be told about "leaks" in processes that are crashing, because there'd
be no point in cleaning those up anyway.

https://bugzilla.gnome.org/show_bug.cgi?id=666116
2011-12-27 17:51:09 -05:00
Matthias Clasen
f077127d01 Add a test for ids on submenu and section elements
The test checks that menus which are created via
<submenu id=...> or <section id=...> end up in the objects
hash table.
2011-12-24 22:59:10 -05:00
Dan Winship
3f3e141ec8 Add GSocketClient::event, for tracking socket client status
This can be used for debugging, or for progress UIs ("Connecting to
example.com..."), or to do low-level tweaking on the connection at
various points in the process.

https://bugzilla.gnome.org/show_bug.cgi?id=665805
2011-12-22 15:44:24 -05:00
Ryan Lortie
5e8a10daf1 gitignore 2011-12-19 13:38:09 -05:00
Ryan Lortie
0c094d6607 Drop the GApplication menu test 2011-12-19 12:34:16 -05:00
Chris Coulson
162bafee37 Initialize service_loop before running the service thread
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=666129
2011-12-14 21:15:35 -05:00
Simon McVittie
a1bd6e0717 tls-interaction test: use a weak pointer instead of a deliberate use-after-free
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=666115
Reviewed-by: Dan Winship <danw@gnome.org>
2011-12-14 15:59:29 +00:00
Ryan Lortie
0a7930d048 gdbus tests: remove buggy use of GMainLoop
g_main_loop_quit() only quits mainloops that are currently running --
not ones that may run in the future.  The way the gdbus-threading tests
are written can possibly result in a call to g_main_loop_quit() before
g_main_loop_run() has started.

The mainloops aren't actually used for anything other than signalling
the completion of the threads, so just use g_thread_join() for that.

https://bugzilla.gnome.org/show_bug.cgi?id=666129
2011-12-14 09:33:30 -05:00
Simon McVittie
995a2eb50b Plug some leaks in the GIO tests
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=666115
Reviewed-by: Matthias Clasen <mclasen@redhat.com>
2011-12-14 12:41:15 +00:00
Matthias Clasen
b386d9ffb7 Add another menu parser test
This one concerns itself with objects.
2011-12-14 00:10:34 -05:00
Ryan Lortie
a6366dc289 GDBusActionGroup: make API just like GDBusMenuModel
Have one simple _get() API that returns the group immediately, in an
empty state.  The group is initialised on the first attempt to interact
with it.

Leave a secret 'back door' for GApplication to do a blocking
initialisation.
2011-12-08 18:07:47 -05:00
Ryan Lortie
0fdd9985bb GDBusActionGroup: drop ability to 'inject'
Also drop the GDBusActionGroupFlags that were only meant to facilitate
injection-based usage.
2011-12-08 18:05:15 -05:00
Matthias Clasen
39bebbed82 Don't use deprecated GApplication api in examples 2011-12-08 18:05:15 -05:00
Ryan Lortie
25ffde957c menu threaded test: run the mainloop after export
GDBusConnection now dispatches GDestroyNotify calls back to the
mainloop.  Adding an idle to the mainloop is O(n) in the number of idles
already there.  We therefore need to periodically empty the mainloop to
avoid quadratic behaviour with a very large 'n'.
2011-12-08 18:05:15 -05:00
Ryan Lortie
1c036cb9f5 Rename GMenuProxy to GDBusMenuModel
This improves consistency with GDBusActionGroup.
2011-12-08 18:05:15 -05:00
Ryan Lortie
14900d37f4 action exporter: clarify threading situation
Exporting can only be done relative to a particular given main context
and all interaction with the action group must be on that same context.

Fix up the implementation so that the user can specify that context with
the normal (thread default) mechanism and document the limitation on the
API.

Adjust the testcase to adhere to the documentation limitations.  It
passes now.
2011-12-08 18:05:15 -05:00
Matthias Clasen
328bf4616a Add testcase for threaded menu exporter use
This currently fails
2011-12-08 18:05:14 -05:00
Matthias Clasen
f1a403e809 Add a test for multithreaded action group exporter use 2011-12-08 18:05:14 -05:00
Ryan Lortie
ef8c443092 menumodel test: don't get stuck in a loop
Sometimes randa and randb end up having the same state, causing them to
return the same stream of 'random numbers'.  This is a problem for the
testcase that is looping to find unequal menus.

If we find ourselves in this state, throw one of the random generators
away and recreate it so we have a better chance of getting some unequal
menus.
2011-12-08 18:05:14 -05:00
Ryan Lortie
cfbc1b5a4b Menu model exporter: clean up the API
Give it the same treatment as the exporter for GActionGroup just got.

There is a wart here: the exporter attempt to re-enter GDBusConnection
when it is freed in order to cancel outstanding name watches.
GDBusConnection holds its own lock while calling the destroy notify, so
the attempt at reentrancy results in a deadlock.

We have a workaround to deal with that for now...
2011-12-08 18:05:14 -05:00
Ryan Lortie
f7886d6adb Action group exporter: clean up the API
Make it look more like a typical GDBusConnection API with integer
registration ID and corresponding unexport call.  Kill the 'query' call.
2011-12-08 18:05:14 -05:00
Ryan Lortie
3821627366 GApplication: make distinction about menus
Rename g_application_set_menu to g_application_set_app_menu and make a
couple of fixups.  Clarify the documentation about exactly what this
menu is meant to be.

Add g_application_set_menubar and document that as well.
2011-12-08 18:05:14 -05:00
Ryan Lortie
a0a94cd6c6 menu tests: keep mirror of proxy
Create a 'mirror' model of the proxy for the testcase.  In addition to
testing that the proxy model emits the proper signals this also keeps
the proxy alive (by holding references to it from the mirror).

The previous code would create the submenu proxies and destroy them
right away (from the recursive step in the equality comparison
functions).  This means that the subscription would go out over D-Bus
and the proxy would be destroyed before it returned.  Keeping the model
alive allows it to be actually updated.
2011-12-08 18:05:13 -05:00
Matthias Clasen
ad09498fa7 Expand dbus action group tests
The new tests check that activation and state changes propagate
back.
2011-12-08 18:05:13 -05:00
Matthias Clasen
5718804e58 Some more assertions 2011-12-08 18:05:13 -05:00
Matthias Clasen
22c9d20b7a Add some dbus action group tests 2011-12-08 18:05:13 -05:00
Matthias Clasen
2cf4866e33 Avoid cross-talk between tests
Each test needs to remove the sources that it attaches
to the default main context, or else things will work
fine in isolation, but go bad in a full test run.
2011-12-08 18:05:13 -05:00
Matthias Clasen
ff833ccac9 Remove unused variable 2011-12-08 18:05:13 -05:00
Matthias Clasen
500f8fbac5 Add a test for menu subscriptions 2011-12-08 18:05:13 -05:00
Matthias Clasen
0f88b7af33 Add some tests for links 2011-12-08 18:05:13 -05:00
Matthias Clasen
0760bf5850 Add parser roundtrip tests 2011-12-08 18:05:13 -05:00
Matthias Clasen
41c19c7df8 GApplication: Add a menu example to the docs 2011-12-08 18:05:13 -05:00
Matthias Clasen
db34b1aebe Rename exporter APIs
There are no public 'exporter' objects, so don't allude to them
in the function names. At the same time, we want to make it clear
that these functions are D-Bus specific.

The new APIs are
g_action_group_dbus_export_start
g_action_group_dbus_export_query
g_action_group_dbus_export_stop
g_menu_model_dbus_export_start
g_menu_model_dbus_export_query
g_menu_model_dbus_export_stop
2011-12-08 18:05:12 -05:00
Ryan Lortie
6dfb9d583f Add GMenuModel testcases 2011-12-08 18:05:12 -05:00
David Zeuthen
70dacf83d2 Bug 665733 – GDBusConnection holds lock while calling destroynotify
Fix this problem by always running the destroynotify from an idle.

https://bugzilla.gnome.org/show_bug.cgi?id=665733

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-12-07 10:30:42 -05:00
Tristan Van Berkom
a00530ecb0 GDBusInterfaceSkeleton: make it possible to export on multiple connections
This is useful in peer-to-peer connections.

With minor changes by David Zeuthen <davidz@redhat.com>.

https://bugzilla.gnome.org/show_bug.cgi?id=662718

Signed-off-by: David Zeuthen <davidz@redhat.com>
2011-12-02 11:20:21 -05:00
Dan Winship
e798349587 GMemoryInputStream/GMemoryOutputStream: fix bug in previous commit
A g_input_stream_read_async() implementation can't call
g_input_stream_read() on itself directly because it will fail because
the pending flag is already set. So fix that by invoking the vmethod
directly rather than calling the wrapper. Likewise with
GMemoryOutputStream.

Add a test to gio/tests/memory-input-stream.c to catch read_async
failures in the future.
2011-12-01 13:10:25 +01:00
Ryan Lortie
345688c9e9 GApplication: don't fail if can't get session bus
If we can't get on the session bus, just behave like a normal non-unique
application.

This turns out to be remarkably easy to implement and lets us avoid
adding a 'dummy' backend.

Add a test for this case as well.

Idea from Zachary Dovel.

https://bugzilla.gnome.org/show_bug.cgi?id=651997
2011-11-22 17:35:56 -05:00
Rico Tzschichholz
38a00cec67 gio/tests: Fix for -Werror=format-security 2011-11-21 23:06:15 +01:00
Ryan Lortie
59623973fa dist gio/tests/key8.pem 2011-11-21 14:23:17 -05:00
Simon McVittie
4bb411948c Add test case for #662395
Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662395
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-11-21 18:16:51 +00:00
Simon McVittie
96deb40caa GDBus tests: factor out TestIOStream, test_pipe and test_bidi_pipe
These might even make useful public API if they grew a Windows
implementation, but for now they can be Unix-only test API.

Bug: https://bugzilla.gnome.org/show_bug.cgi?id=662395
Signed-off-by: Simon McVittie <simon.mcvittie@collabora.co.uk>
Reviewed-by: Cosimo Alfarano <cosimo.alfarano@collabora.co.uk>
2011-11-21 18:15:26 +00:00
Dan Winship
1dc8d1f932 GTlsCertificate: support unencrypted PKCS#8 private keys
PKCS#8 is the "right" way to encode private keys. Although the APIs do
not currently support encrypted keys, we should at least support
unencrypted PKCS#8 keys.

https://bugzilla.gnome.org/show_bug.cgi?id=664321
2011-11-18 20:26:58 -05:00
Matthias Clasen
011a71cf71 'make dist' fixes 2011-11-17 14:03:39 +00:00
Matthias Clasen
97cf2d78c5 settings-source test: Check returned error as well 2011-11-17 14:03:39 +00:00
Jasper St. Pierre
6339b5fe2d schema source: avoid introspection confusion
Any method that has its prefix'd argument as its first parameter will be
interpreted by introspection as a method. We don't want this, so we need
to swap the first two parameters.
2011-11-17 14:03:39 +00:00