GST_DEFINE_MINI_OBJECT_TYPE (GstValidateActionType, gst_validate_action_type);
static GstValidateActionType *gst_validate_action_type_new (void);
+struct _GstValidateActionTypePrivate
+{
+ gint n_calls;
+};
+
static void
_action_type_free (GstValidateActionType * type)
{
g_free (type->description);
g_free (type->name);
g_free (type->implementer_namespace);
+ g_free (type->priv);
if (type->overriden_type)
gst_mini_object_unref (GST_MINI_OBJECT (type->overriden_type));
static void
gst_validate_action_type_init (GstValidateActionType * type)
{
+ type->priv = g_new0 (GstValidateActionTypePrivate, 1);
+
gst_mini_object_init ((GstMiniObject *) type, 0,
_gst_validate_action_type_type, NULL, NULL,
(GstMiniObjectFreeFunction) _action_type_free);
action->priv->execution_time = gst_util_get_timestamp ();
action->priv->state = GST_VALIDATE_EXECUTE_ACTION_IN_PROGRESS;
+ action_type->priv->n_calls++;
res = action_type->execute (scenario, action);
gst_object_unref (scenario);
(gst_structure_get_boolean (action->structure, "as-config",
&is_config) && is_config == TRUE)) {
+ action_type->priv->n_calls++;
res = action_type->execute (scenario, action);
gst_validate_print_action (action, NULL);
}
static GstValidateExecuteActionReturn
+_execute_check_action_type_calls (GstValidateScenario * scenario,
+ GstValidateAction * action)
+{
+ const gchar *type;
+ GstValidateActionType *t;
+ GstValidateExecuteActionReturn res = GST_VALIDATE_EXECUTE_ACTION_OK;
+ gint n;
+
+ REPORT_UNLESS (gst_structure_get_int (action->structure, "n", &n),
+ done, "No `n`!");
+ REPORT_UNLESS ((type = gst_structure_get_string (action->structure, "type")),
+ done, "No `type`!");
+ REPORT_UNLESS ((t =
+ _find_action_type (type)), done, "Can't find `%s`!", type);
+ REPORT_UNLESS (t->priv->n_calls == n, done,
+ "%s called %d times instead of expected %d", type, t->priv->n_calls, n);
+
+
+done:
+ return res;
+}
+
+static GstValidateExecuteActionReturn
_execute_check_position (GstValidateScenario * scenario,
GstValidateAction * action)
{
{NULL}
}),
"Check current pipeline position.\n", GST_VALIDATE_ACTION_TYPE_NONE);
- /* *INDENT-ON* */
+
+ /* Internal actions types to test the validate scenario implementation */
+ REGISTER_ACTION_TYPE("priv_check-action-type-calls",
+ _execute_check_action_type_calls, NULL, NULL, 0);
+ /* *INDENT-ON* */
}
void