[grilo/debian: 40/44] [tests] Check allowed errors when invoking registry_load_all() method
- From: Juan A. Suarez Romero <jasuarez src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo/debian: 40/44] [tests] Check allowed errors when invoking registry_load_all() method
- Date: Fri, 7 May 2010 21:21:24 +0000 (UTC)
commit 2eb841ddda2ec27645e15aed986bdaa92530e35b
Author: Juan A. Suarez Romero <jasuarez igalia com>
Date: Fri May 7 13:35:04 2010 +0200
[tests] Check allowed errors when invoking registry_load_all() method
Some warnings when loading all plugins should be allowed in the test. Mainly,
when a directory does not contain any plugin or when a plugin is not provided
with a required configuration.
In these cases, test should not fail.
src/tests/registry.c | 22 ++++++++++++++++++++++
1 files changed, 22 insertions(+), 0 deletions(-)
---
diff --git a/src/tests/registry.c b/src/tests/registry.c
index f5989f8..f76f607 100644
--- a/src/tests/registry.c
+++ b/src/tests/registry.c
@@ -28,6 +28,24 @@
#include <grilo.h>
+#if GLIB_CHECK_VERSION(2,22,0)
+static gboolean
+registry_load_error_handler (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *message,
+ gpointer user_data)
+{
+ if (g_str_has_prefix (message, "Failed to initialize plugin") ||
+ g_str_has_prefix (message, "Configuration not provided") ||
+ g_strcmp0 (message, "Missing configuration") == 0 ||
+ g_str_has_prefix (message, "Could not open plugin directory")) {
+ return FALSE;
+ }
+
+ return TRUE;
+}
+#endif
+
static void
registry_init (void)
{
@@ -43,6 +61,10 @@ registry_load (void)
GrlPluginRegistry *registry;
gboolean res;
+#if GLIB_CHECK_VERSION(2,22,0)
+ g_test_log_set_fatal_handler (registry_load_error_handler, NULL);
+#endif
+
registry = grl_plugin_registry_get_instance ();
res = grl_plugin_registry_load_all (registry);
g_assert_cmpint (res, ==, TRUE);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]