test-fpi-device: Verify device action error operations

This commit is contained in:
Marco Trevisan (Treviño) 2020-01-17 16:53:18 +01:00
parent ad514c3775
commit a87e9c546f
3 changed files with 231 additions and 46 deletions

View file

@ -35,9 +35,15 @@ fpi_device_fake_probe (FpDevice *device)
FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device); FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device); FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
fake_dev->last_called_function = fpi_device_fake_probe;
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_PROBE); g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_PROBE);
fake_dev->last_called_function = fpi_device_fake_probe; if (fake_dev->return_action_error)
{
fpi_device_action_error (device, fake_dev->ret_error);
return;
}
fpi_device_probe_complete (device, dev_class->id, dev_class->full_name, fpi_device_probe_complete (device, dev_class->id, dev_class->full_name,
fake_dev->ret_error); fake_dev->ret_error);
} }
@ -47,9 +53,15 @@ fpi_device_fake_open (FpDevice *device)
{ {
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device); FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
fake_dev->last_called_function = fpi_device_fake_open;
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_OPEN); g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_OPEN);
fake_dev->last_called_function = fpi_device_fake_open; if (fake_dev->return_action_error)
{
fpi_device_action_error (device, fake_dev->ret_error);
return;
}
fpi_device_open_complete (device, fake_dev->ret_error); fpi_device_open_complete (device, fake_dev->ret_error);
} }
@ -58,9 +70,15 @@ fpi_device_fake_close (FpDevice *device)
{ {
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device); FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
fake_dev->last_called_function = fpi_device_fake_close;
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_CLOSE); g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_CLOSE);
fake_dev->last_called_function = fpi_device_fake_close; if (fake_dev->return_action_error)
{
fpi_device_action_error (device, fake_dev->ret_error);
return;
}
fpi_device_close_complete (device, fake_dev->ret_error); fpi_device_close_complete (device, fake_dev->ret_error);
} }
@ -70,13 +88,20 @@ fpi_device_fake_enroll (FpDevice *device)
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device); FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
FpPrint *print = fake_dev->ret_print; FpPrint *print = fake_dev->ret_print;
fake_dev->last_called_function = fpi_device_fake_enroll;
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_ENROLL); g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_ENROLL);
if (fake_dev->return_action_error)
{
fpi_device_action_error (device, fake_dev->ret_error);
return;
}
fpi_device_get_enroll_data (device, (FpPrint **) &fake_dev->action_data); fpi_device_get_enroll_data (device, (FpPrint **) &fake_dev->action_data);
if (!print && !fake_dev->ret_error) if (!print && !fake_dev->ret_error)
fpi_device_get_enroll_data (device, &print); fpi_device_get_enroll_data (device, &print);
fake_dev->last_called_function = fpi_device_fake_enroll;
fpi_device_enroll_complete (device, fpi_device_enroll_complete (device,
print ? g_object_ref (print) : NULL, print ? g_object_ref (print) : NULL,
fake_dev->ret_error); fake_dev->ret_error);
@ -88,14 +113,20 @@ fpi_device_fake_verify (FpDevice *device)
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device); FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
FpPrint *print = fake_dev->ret_print; FpPrint *print = fake_dev->ret_print;
fake_dev->last_called_function = fpi_device_fake_verify;
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_VERIFY); g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_VERIFY);
if (fake_dev->return_action_error)
{
fpi_device_action_error (device, fake_dev->ret_error);
return;
}
fpi_device_get_verify_data (device, (FpPrint **) &fake_dev->action_data); fpi_device_get_verify_data (device, (FpPrint **) &fake_dev->action_data);
if (!print && !fake_dev->ret_error) if (!print && !fake_dev->ret_error)
fpi_device_get_verify_data (device, &print); fpi_device_get_verify_data (device, &print);
fake_dev->last_called_function = fpi_device_fake_verify;
if (!fake_dev->ret_error || fake_dev->ret_error->domain == FP_DEVICE_RETRY) if (!fake_dev->ret_error || fake_dev->ret_error->domain == FP_DEVICE_RETRY)
{ {
fpi_device_verify_report (device, fake_dev->ret_result, print, fake_dev->ret_error); fpi_device_verify_report (device, fake_dev->ret_result, print, fake_dev->ret_error);
@ -113,7 +144,15 @@ fpi_device_fake_identify (FpDevice *device)
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device); FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
FpPrint *match = fake_dev->ret_match; FpPrint *match = fake_dev->ret_match;
fake_dev->last_called_function = fpi_device_fake_identify;
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_IDENTIFY); g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_IDENTIFY);
if (fake_dev->return_action_error)
{
fpi_device_action_error (device, fake_dev->ret_error);
return;
}
fpi_device_get_identify_data (device, (GPtrArray **) &fake_dev->action_data); fpi_device_get_identify_data (device, (GPtrArray **) &fake_dev->action_data);
if (!match && !fake_dev->ret_error) if (!match && !fake_dev->ret_error)
@ -135,7 +174,6 @@ fpi_device_fake_identify (FpDevice *device)
} }
} }
fake_dev->last_called_function = fpi_device_fake_identify;
if (!fake_dev->ret_error || fake_dev->ret_error->domain == FP_DEVICE_RETRY) if (!fake_dev->ret_error || fake_dev->ret_error->domain == FP_DEVICE_RETRY)
{ {
fpi_device_identify_report (device, match, fake_dev->ret_print, fake_dev->ret_error); fpi_device_identify_report (device, match, fake_dev->ret_print, fake_dev->ret_error);
@ -152,10 +190,16 @@ fpi_device_fake_capture (FpDevice *device)
{ {
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device); FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_CAPTURE);
fpi_device_get_capture_data (device, (gboolean *) &fake_dev->action_data);
fake_dev->last_called_function = fpi_device_fake_capture; fake_dev->last_called_function = fpi_device_fake_capture;
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_CAPTURE);
if (fake_dev->return_action_error)
{
fpi_device_action_error (device, fake_dev->ret_error);
return;
}
fpi_device_get_capture_data (device, (gboolean *) &fake_dev->action_data);
fpi_device_capture_complete (device, fake_dev->ret_image, fake_dev->ret_error); fpi_device_capture_complete (device, fake_dev->ret_image, fake_dev->ret_error);
} }
@ -164,9 +208,15 @@ fpi_device_fake_list (FpDevice *device)
{ {
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device); FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
fake_dev->last_called_function = fpi_device_fake_list;
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_LIST); g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_LIST);
fake_dev->last_called_function = fpi_device_fake_list; if (fake_dev->return_action_error)
{
fpi_device_action_error (device, fake_dev->ret_error);
return;
}
fpi_device_list_complete (device, fake_dev->ret_list, fake_dev->ret_error); fpi_device_list_complete (device, fake_dev->ret_list, fake_dev->ret_error);
} }
@ -175,10 +225,16 @@ fpi_device_fake_delete (FpDevice *device)
{ {
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device); FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_DELETE);
fpi_device_get_delete_data (device, (gpointer) & fake_dev->action_data);
fake_dev->last_called_function = fpi_device_fake_delete; fake_dev->last_called_function = fpi_device_fake_delete;
g_assert_cmpuint (fpi_device_get_current_action (device), ==, FPI_DEVICE_ACTION_DELETE);
if (fake_dev->return_action_error)
{
fpi_device_action_error (device, fake_dev->ret_error);
return;
}
fpi_device_get_delete_data (device, (gpointer) (&fake_dev->action_data));
fpi_device_delete_complete (device, fake_dev->ret_error); fpi_device_delete_complete (device, fake_dev->ret_error);
} }
@ -187,9 +243,8 @@ fpi_device_fake_cancel (FpDevice *device)
{ {
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device); FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
g_assert_cmpuint (fpi_device_get_current_action (device), !=, FPI_DEVICE_ACTION_NONE);
fake_dev->last_called_function = fpi_device_fake_cancel; fake_dev->last_called_function = fpi_device_fake_cancel;
g_assert_cmpuint (fpi_device_get_current_action (device), !=, FPI_DEVICE_ACTION_NONE);
} }
static void static void

View file

@ -30,6 +30,7 @@ struct _FpiDeviceFake
FpDevice parent; FpDevice parent;
gpointer last_called_function; gpointer last_called_function;
gboolean return_action_error;
GError *ret_error; GError *ret_error;
FpPrint *ret_print; FpPrint *ret_print;

View file

@ -42,6 +42,14 @@ auto_close_fake_device_new (void)
static void static void
auto_close_fake_device_free (FpAutoCloseDevice *device) auto_close_fake_device_free (FpAutoCloseDevice *device)
{ {
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
if (fake_dev->return_action_error)
{
fake_dev->return_action_error = FALSE;
fake_dev->ret_error = NULL;
}
if (fp_device_is_open (device)) if (fp_device_is_open (device))
g_assert_true (fp_device_close_sync (device, NULL, NULL)); g_assert_true (fp_device_close_sync (device, NULL, NULL));
@ -89,16 +97,6 @@ on_device_notify (FpDevice *device, GParamSpec *spec, gpointer user_data)
fake_dev->user_data = g_param_spec_ref (spec); fake_dev->user_data = g_param_spec_ref (spec);
} }
static void
test_driver_action_error_vfunc (FpDevice *device)
{
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
fake_dev->last_called_function = test_driver_action_error_vfunc;
fpi_device_action_error (device, fake_dev->user_data);
}
/* Tests */ /* Tests */
static void static void
@ -1421,7 +1419,7 @@ test_driver_cancel_fail (void)
g_cancellable_cancel (cancellable); g_cancellable_cancel (cancellable);
while (g_main_context_iteration (NULL, FALSE)) while (g_main_context_iteration (NULL, FALSE))
; continue;
g_assert (fake_dev->last_called_function == dev_class->delete); g_assert (fake_dev->last_called_function == dev_class->delete);
g_assert_no_error (error); g_assert_no_error (error);
@ -1643,45 +1641,176 @@ test_driver_action_error_error (void)
} }
static void static void
test_driver_action_error_open (void) test_driver_action_error_all (void)
{ {
g_autoptr(FpAutoResetClass) dev_class = auto_reset_device_class (); g_autoptr(FpAutoCloseDevice) device = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL);
g_autoptr(FpAutoCloseDevice) device = NULL; g_autoptr(FpPrint) enrolled_print = g_object_ref_sink (fp_print_new (device));
g_autoptr(GPtrArray) prints = g_ptr_array_new_with_free_func (g_object_unref);
g_autoptr(GError) error = NULL; g_autoptr(GError) error = NULL;
FpiDeviceFake *fake_dev; FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
dev_class->open = test_driver_action_error_vfunc;
device = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL);
fake_dev = FPI_DEVICE_FAKE (device); fake_dev = FPI_DEVICE_FAKE (device);
fake_dev->user_data = fpi_device_error_new (FP_DEVICE_ERROR_DATA_INVALID); fake_dev->return_action_error = TRUE;
fake_dev->ret_error = fpi_device_error_new (FP_DEVICE_ERROR_DATA_INVALID);
g_assert_false (fp_device_open_sync (device, NULL, &error)); g_assert_false (fp_device_open_sync (device, NULL, &error));
g_assert_true (fake_dev->last_called_function == dev_class->open);
g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_DATA_INVALID); g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_DATA_INVALID);
g_clear_error (&error);
g_assert (fake_dev->last_called_function == test_driver_action_error_vfunc); fake_dev->return_action_error = FALSE;
fake_dev->ret_error = NULL;
g_assert_true (fp_device_open_sync (device, NULL, NULL));
fake_dev->return_action_error = TRUE;
fake_dev->ret_error = fpi_device_error_new (FP_DEVICE_ERROR_DATA_INVALID);
g_assert_false (fp_device_close_sync (device, NULL, &error));
g_assert_true (fake_dev->last_called_function == dev_class->close);
g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_DATA_INVALID);
g_clear_error (&error);
fake_dev->ret_error = fpi_device_error_new (FP_DEVICE_ERROR_DATA_INVALID);
g_assert_null (fp_device_enroll_sync (device, fp_print_new (device), NULL,
NULL, NULL, &error));
g_assert_true (fake_dev->last_called_function == dev_class->enroll);
g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_DATA_INVALID);
g_clear_error (&error);
fake_dev->ret_error = fpi_device_error_new (FP_DEVICE_ERROR_DATA_INVALID);
g_assert_false (fp_device_verify_sync (device, enrolled_print, NULL,
NULL, NULL, NULL, NULL, &error));
g_assert_true (fake_dev->last_called_function == dev_class->verify);
g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_DATA_INVALID);
g_clear_error (&error);
fake_dev->ret_error = fpi_device_error_new (FP_DEVICE_ERROR_DATA_INVALID);
g_assert_false (fp_device_identify_sync (device, prints, NULL,
NULL, NULL, NULL, NULL, &error));
g_assert_true (fake_dev->last_called_function == dev_class->identify);
g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_DATA_INVALID);
g_clear_error (&error);
fake_dev->ret_error = fpi_device_error_new (FP_DEVICE_ERROR_DATA_INVALID);
g_assert_null (fp_device_capture_sync (device, TRUE, NULL, &error));
g_assert_true (fake_dev->last_called_function == dev_class->capture);
g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_DATA_INVALID);
g_clear_error (&error);
fake_dev->ret_error = fpi_device_error_new (FP_DEVICE_ERROR_DATA_INVALID);
g_assert_null (fp_device_list_prints_sync (device, NULL, &error));
g_assert_true (fake_dev->last_called_function == dev_class->list);
g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_DATA_INVALID);
g_clear_error (&error);
fake_dev->ret_error = fpi_device_error_new (FP_DEVICE_ERROR_DATA_INVALID);
g_assert_false (fp_device_delete_print_sync (device, enrolled_print, NULL, &error));
g_assert_true (fake_dev->last_called_function == dev_class->delete);
g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_DATA_INVALID);
g_clear_error (&error);
} }
static void static void
test_driver_action_error_fallback_open (void) test_driver_action_error_fallback_all (void)
{ {
g_autoptr(FpAutoResetClass) dev_class = auto_reset_device_class (); g_autoptr(FpAutoCloseDevice) device = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL);
g_autoptr(FpAutoCloseDevice) device = NULL; g_autoptr(FpPrint) enrolled_print = g_object_ref_sink (fp_print_new (device));
g_autoptr(GPtrArray) prints = g_ptr_array_new_with_free_func (g_object_unref);
g_autoptr(GError) error = NULL; g_autoptr(GError) error = NULL;
FpiDeviceFake *fake_dev; FpDeviceClass *dev_class = FP_DEVICE_GET_CLASS (device);
FpiDeviceFake *fake_dev = FPI_DEVICE_FAKE (device);
dev_class->open = test_driver_action_error_vfunc;
device = g_object_new (FPI_TYPE_DEVICE_FAKE, NULL);
fake_dev = FPI_DEVICE_FAKE (device); fake_dev = FPI_DEVICE_FAKE (device);
fake_dev->return_action_error = TRUE;
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING, g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING,
"*Device failed to pass an error to generic action " "*Device failed to pass an error to generic action "
"error function*"); "error function*");
g_assert_false (fp_device_open_sync (device, NULL, &error)); g_assert_false (fp_device_open_sync (device, NULL, &error));
g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_GENERAL);
g_assert (fake_dev->last_called_function == test_driver_action_error_vfunc);
g_test_assert_expected_messages (); g_test_assert_expected_messages ();
g_assert_true (fake_dev->last_called_function == dev_class->open);
g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_GENERAL);
g_clear_error (&error);
fake_dev->return_action_error = FALSE;
g_assert_true (fp_device_open_sync (device, NULL, NULL));
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING,
"*Device failed to pass an error to generic action "
"error function*");
fake_dev->return_action_error = TRUE;
g_assert_false (fp_device_close_sync (device, NULL, &error));
g_test_assert_expected_messages ();
g_assert_true (fake_dev->last_called_function == dev_class->close);
g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_GENERAL);
g_clear_error (&error);
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING,
"*Device failed to pass an error to generic action "
"error function*");
g_assert_null (fp_device_enroll_sync (device, fp_print_new (device), NULL,
NULL, NULL, &error));
g_test_assert_expected_messages ();
g_test_assert_expected_messages ();
g_assert_true (fake_dev->last_called_function == dev_class->enroll);
g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_GENERAL);
g_clear_error (&error);
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING,
"*Device failed to pass an error to generic action "
"error function*");
g_assert_false (fp_device_verify_sync (device, enrolled_print, NULL,
NULL, NULL, NULL, NULL, &error));
g_test_assert_expected_messages ();
g_assert_true (fake_dev->last_called_function == dev_class->verify);
g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_GENERAL);
g_clear_error (&error);
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING,
"*Device failed to pass an error to generic action "
"error function*");
g_assert_false (fp_device_identify_sync (device, prints, NULL,
NULL, NULL, NULL, NULL, &error));
g_test_assert_expected_messages ();
g_assert_true (fake_dev->last_called_function == dev_class->identify);
g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_GENERAL);
g_clear_error (&error);
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING,
"*Device failed to pass an error to generic action "
"error function*");
g_assert_null (fp_device_capture_sync (device, TRUE, NULL, &error));
g_test_assert_expected_messages ();
g_assert_true (fake_dev->last_called_function == dev_class->capture);
g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_GENERAL);
g_clear_error (&error);
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING,
"*Device failed to pass an error to generic action "
"error function*");
g_assert_null (fp_device_list_prints_sync (device, NULL, &error));
g_test_assert_expected_messages ();
g_assert_true (fake_dev->last_called_function == dev_class->list);
g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_GENERAL);
g_clear_error (&error);
g_test_expect_message (G_LOG_DOMAIN, G_LOG_LEVEL_WARNING,
"*Device failed to pass an error to generic action "
"error function*");
g_assert_false (fp_device_delete_print_sync (device, enrolled_print, NULL, &error));
g_test_assert_expected_messages ();
g_assert_true (fake_dev->last_called_function == dev_class->delete);
g_assert_error (error, FP_DEVICE_ERROR, FP_DEVICE_ERROR_GENERAL);
g_clear_error (&error);
} }
static void static void
@ -1867,8 +1996,8 @@ main (int argc, char *argv[])
g_test_add_func ("/driver/action_is_cancelled/error", test_driver_action_is_cancelled_error); g_test_add_func ("/driver/action_is_cancelled/error", test_driver_action_is_cancelled_error);
g_test_add_func ("/driver/complete_action/all/error", test_driver_complete_actions_errors); g_test_add_func ("/driver/complete_action/all/error", test_driver_complete_actions_errors);
g_test_add_func ("/driver/action_error/error", test_driver_action_error_error); g_test_add_func ("/driver/action_error/error", test_driver_action_error_error);
g_test_add_func ("/driver/action_error/open", test_driver_action_error_open); g_test_add_func ("/driver/action_error/all", test_driver_action_error_all);
g_test_add_func ("/driver/action_error/fail/open", test_driver_action_error_fallback_open); g_test_add_func ("/driver/action_error/fail", test_driver_action_error_fallback_all);
g_test_add_func ("/driver/timeout", test_driver_add_timeout); g_test_add_func ("/driver/timeout", test_driver_add_timeout);
g_test_add_func ("/driver/timeout/cancelled", test_driver_add_timeout_cancelled); g_test_add_func ("/driver/timeout/cancelled", test_driver_add_timeout_cancelled);