e_test_server_utils_bootstrap_timeout (FixturePair *pair)
{
g_error ("Timed out while waiting for ESource creation from the registry");
+
+ pair->fixture->timeout_source_id = 0;
return FALSE;
}
switch (pair->closure->type) {
case E_TEST_SERVER_ADDRESS_BOOK:
+ case E_TEST_SERVER_DIRECT_ADDRESS_BOOK:
if (g_strcmp0 (e_source_get_uid (source), ADDRESS_BOOK_SOURCE_UID) != 0)
return;
- if (g_getenv ("DEBUG_DIRECT") != NULL)
+ if (pair->closure->type == E_TEST_SERVER_DIRECT_ADDRESS_BOOK)
pair->fixture->service.book_client = (EBookClient *)
e_book_client_connect_direct_sync (pair->fixture->registry, source, NULL, &error);
else
/* Create an address book */
switch (pair->closure->type) {
case E_TEST_SERVER_ADDRESS_BOOK:
+ case E_TEST_SERVER_DIRECT_ADDRESS_BOOK:
case E_TEST_SERVER_DEPRECATED_ADDRESS_BOOK:
scratch = e_source_new_with_uid (ADDRESS_BOOK_SOURCE_UID, NULL, &error);
}
if (pair->closure->type != E_TEST_SERVER_NONE)
- g_timeout_add (20 * 1000, (GSourceFunc) e_test_server_utils_bootstrap_timeout, pair);
+ pair->fixture->timeout_source_id =
+ g_timeout_add (20 * 1000, (GSourceFunc) e_test_server_utils_bootstrap_timeout, pair);
else
g_main_loop_quit (pair->fixture->loop);
g_idle_add ((GSourceFunc) e_test_server_utils_bootstrap_idle, &pair);
g_main_loop_run (fixture->loop);
+
+ /* This needs to be explicitly removed, otherwise the timeout source
+ * stays in the default GMainContext and after running tests for 20 seconds
+ * in the same test suite... the tests bail out.
+ */
+ if (fixture->timeout_source_id) {
+ g_source_remove (fixture->timeout_source_id);
+ fixture->timeout_source_id = 0;
+ }
+
g_signal_handlers_disconnect_by_func (fixture->registry, e_test_server_utils_source_added, &pair);
}
switch (closure->type) {
case E_TEST_SERVER_ADDRESS_BOOK:
+ case E_TEST_SERVER_DIRECT_ADDRESS_BOOK:
if (!e_client_remove_sync (E_CLIENT (fixture->service.book_client), NULL, &error)) {
g_message ("Failed to remove test book: %s (ignoring)", error->message);
g_clear_error (&error);
* ETestServiceType:
* @E_TEST_SERVER_NONE: Only the #ESourceRegistry will be created
* @E_TEST_SERVER_ADDRESS_BOOK: An #EBookCLient will be created and opened for the test
+ * @E_TEST_SERVER_DIRECT_ADDRESS_BOOK: An #EBookCLient in direct read access mode will be created and opened for the test
* @E_TEST_SERVER_CALENDAR: An #ECalClient will be created and opened for the test
* @E_TEST_SERVER_DEPRECATED_ADDRESS_BOOK: An #EBook will be created and opened for the test
*
typedef enum {
E_TEST_SERVER_NONE = 0,
E_TEST_SERVER_ADDRESS_BOOK,
+ E_TEST_SERVER_DIRECT_ADDRESS_BOOK,
E_TEST_SERVER_CALENDAR,
E_TEST_SERVER_DEPRECATED_ADDRESS_BOOK,
E_TEST_SERVER_DEPRECATED_CALENDAR
* @dbus: The D-Bus test scaffold
* @registry: An #ESourceRegistry
* @service: The #ETestService
+ * @timeout_source_id: A private detail, tracks the idle source which times out if the registry cannot create an ESource.
*
* A fixture for running tests on the Evolution Data Server
* components in an encapsulated D-Bus environment.
GTestDBus *dbus;
ESourceRegistry *registry;
ETestService service;
+ guint timeout_source_id;
};
void e_test_server_utils_setup (ETestServerFixture *fixture,