diff options
author | Wim Taymans <wim.taymans@collabora.co.uk> | 2013-07-03 10:25:46 +0200 |
---|---|---|
committer | Wim Taymans <wim.taymans@collabora.co.uk> | 2013-07-03 10:45:51 +0200 |
commit | df08a2dd9e70c490e03e45b5dbc7ef69a1b423c9 (patch) | |
tree | 3284238b3972f641f8dd2dd51e83011050b9be92 /tests | |
parent | a22889ac082ec68cecd974cb9dbac926dc749478 (diff) |
mount-points: improve mount point searching
Use a GSequence to keep track of the mount points.
Match a URL to the longest matching registered mount point. This should be the
URL to perform aggreagate control and the remainder is the stream specific
control part.
Add some unit tests for this.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/check/gst/mountpoints.c | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/tests/check/gst/mountpoints.c b/tests/check/gst/mountpoints.c index 209975d..e620f16 100644 --- a/tests/check/gst/mountpoints.c +++ b/tests/check/gst/mountpoints.c @@ -56,6 +56,66 @@ GST_START_TEST (test_create) GST_END_TEST; +static const gchar *paths[] = { + "/test", + "/booz/fooz", + "/booz/foo/zoop", + "/tark/bar", + "/tark/bar/baz", + "/tark/bar/baz/t", + "/boozop", +}; + +GST_START_TEST (test_match) +{ + GstRTSPMountPoints *mounts; + GstRTSPMediaFactory *f[G_N_ELEMENTS (paths)], *tmp; + gint i, matched; + + mounts = gst_rtsp_mount_points_new (); + + for (i = 0; i < G_N_ELEMENTS (paths); i++) { + f[i] = gst_rtsp_media_factory_new (); + gst_rtsp_mount_points_add_factory (mounts, paths[i], f[i]); + } + + tmp = gst_rtsp_mount_points_match (mounts, "/test", &matched); + fail_unless (tmp == f[0]); + fail_unless (matched == 5); + tmp = gst_rtsp_mount_points_match (mounts, "/test/stream=1", &matched); + fail_unless (tmp == f[0]); + fail_unless (matched == 5); + tmp = gst_rtsp_mount_points_match (mounts, "/booz", &matched); + fail_unless (tmp == NULL); + tmp = gst_rtsp_mount_points_match (mounts, "/booz/foo", &matched); + fail_unless (tmp == NULL); + tmp = gst_rtsp_mount_points_match (mounts, "/booz/fooz", &matched); + fail_unless (tmp == f[1]); + fail_unless (matched == 10); + tmp = gst_rtsp_mount_points_match (mounts, "/booz/fooz/zoo", &matched); + fail_unless (tmp == f[1]); + fail_unless (matched == 10); + tmp = gst_rtsp_mount_points_match (mounts, "/booz/foo/zoop", &matched); + fail_unless (tmp == f[2]); + fail_unless (matched == 14); + tmp = gst_rtsp_mount_points_match (mounts, "/tark/bar", &matched); + fail_unless (tmp == f[3]); + fail_unless (matched == 9); + tmp = gst_rtsp_mount_points_match (mounts, "/tark/bar/boo", &matched); + fail_unless (tmp == f[3]); + fail_unless (matched == 9); + tmp = gst_rtsp_mount_points_match (mounts, "/tark/bar/ba", &matched); + fail_unless (tmp == f[3]); + fail_unless (matched == 9); + tmp = gst_rtsp_mount_points_match (mounts, "/tark/bar/baz", &matched); + fail_unless (tmp == f[4]); + fail_unless (matched == 13); + + g_object_unref (mounts); +} + +GST_END_TEST; + static Suite * rtspmountpoints_suite (void) { @@ -65,6 +125,7 @@ rtspmountpoints_suite (void) suite_add_tcase (s, tc); tcase_set_timeout (tc, 20); tcase_add_test (tc, test_create); + tcase_add_test (tc, test_match); return s; } |