[farsight2/master] tests: Skip tests if no local candidates are produced
Olivier Crête
olivier.crete at collabora.co.uk
Sun Jan 3 17:25:28 PST 2010
---
tests/check/rtp/conference.c | 41 ++++++++++++++++++++++++++++++++++++++++-
tests/check/rtp/generic.h | 2 ++
2 files changed, 42 insertions(+), 1 deletions(-)
diff --git a/tests/check/rtp/conference.c b/tests/check/rtp/conference.c
index 8ca60ad..84c9dec 100644
--- a/tests/check/rtp/conference.c
+++ b/tests/check/rtp/conference.c
@@ -142,6 +142,8 @@ _new_local_candidate (FsStream *stream, FsCandidate *candidate)
if (candidate->component_id == FS_COMPONENT_RTCP && no_rtcp)
return;
+ st->got_candidates = TRUE;
+
GST_DEBUG ("%d:%d: Setting remote candidate for component %d",
other_st->dat->id,
other_st->target->id,
@@ -175,6 +177,20 @@ _current_send_codec_changed (FsSession *session, FsCodec *codec)
g_free (str);
}
+static void
+_local_candidates_prepared (FsStream *stream)
+{
+ struct SimpleTestStream *st = g_object_get_data (G_OBJECT (stream),
+ "SimpleTestStream");
+
+ if (!st->got_candidates)
+ {
+ g_debug ("Skipping test because there are no candidates");
+ g_main_loop_quit (loop);
+ }
+
+}
+
static gboolean
_bus_callback (GstBus *bus, GstMessage *message, gpointer user_data)
@@ -296,7 +312,8 @@ _bus_callback (GstBus *bus, GstMessage *message, gpointer user_data)
ts_fail_unless (
gst_implements_interface_check (GST_MESSAGE_SRC (message),
FS_TYPE_CONFERENCE),
- "Received farsight-error from non-farsight element");
+ "Received farsight-current-send-codec-change from non-farsight"
+ " element");
ts_fail_unless (
gst_structure_has_field_typed (s, "session", FS_TYPE_SESSION),
@@ -318,6 +335,28 @@ _bus_callback (GstBus *bus, GstMessage *message, gpointer user_data)
_current_send_codec_changed (session, codec);
}
+ else if (gst_structure_has_name (s,
+ "farsight-local-candidates-prepared"))
+ {
+ FsStream *stream;
+ const GValue *value;
+
+ ts_fail_unless (
+ gst_implements_interface_check (GST_MESSAGE_SRC (message),
+ FS_TYPE_CONFERENCE),
+ "Received farsight-local-candidates-prepared from non-farsight"
+ " element");
+
+ ts_fail_unless (
+ gst_structure_has_field_typed (s, "stream", FS_TYPE_STREAM),
+ "farsight-local-candidates-prepared structure"
+ " has no stream field");
+
+ value = gst_structure_get_value (s, "stream");
+ stream = g_value_get_object (value);
+
+ _local_candidates_prepared (stream);
+ }
}
break;
diff --git a/tests/check/rtp/generic.h b/tests/check/rtp/generic.h
index a5774f3..1167250 100644
--- a/tests/check/rtp/generic.h
+++ b/tests/check/rtp/generic.h
@@ -51,6 +51,8 @@ struct SimpleTestStream {
GCallback handoff_handler;
+ gboolean got_candidates;
+
gint flags;
};
--
1.5.6.5
More information about the farsight-commits
mailing list