tests: add test for mountpoints

This commit is contained in:
Wim Taymans 2012-11-28 11:07:57 +01:00
parent e5ba372808
commit 89974f2db1
2 changed files with 73 additions and 0 deletions

View file

@ -28,6 +28,7 @@ TESTS = $(check_PROGRAMS)
check_PROGRAMS = \ check_PROGRAMS = \
gst/rtspserver \ gst/rtspserver \
gst/client \ gst/client \
gst/mountpoints \
gst/addresspool gst/addresspool
# these tests don't even pass # these tests don't even pass

View file

@ -0,0 +1,72 @@
/* GStreamer
* Copyright (C) 2012 Wim Taymans <wim.taymans@gmail.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
* Boston, MA 02110-1301, USA.
*/
#include <gst/check/gstcheck.h>
#include <rtsp-mount-points.h>
GST_START_TEST (test_create)
{
GstRTSPMountPoints *mounts;
GstRTSPUrl *url, *url2;
GstRTSPMediaFactory *factory;
mounts = gst_rtsp_mount_points_new ();
fail_unless (gst_rtsp_url_parse ("rtsp://localhost:8554/test",
&url) == GST_RTSP_OK);
fail_unless (gst_rtsp_url_parse ("rtsp://localhost:8554/test2",
&url2) == GST_RTSP_OK);
fail_unless (gst_rtsp_mount_points_find_factory (mounts, url) == NULL);
factory = gst_rtsp_media_factory_new ();
gst_rtsp_mount_points_add_factory (mounts, "/test", factory);
fail_unless (gst_rtsp_mount_points_find_factory (mounts, url) == factory);
g_object_unref (factory);
fail_unless (gst_rtsp_mount_points_find_factory (mounts, url2) == NULL);
gst_rtsp_mount_points_remove_factory (mounts, "/test");
fail_unless (gst_rtsp_mount_points_find_factory (mounts, url) == NULL);
fail_unless (gst_rtsp_mount_points_find_factory (mounts, url2) == NULL);
gst_rtsp_url_free (url);
gst_rtsp_url_free (url2);
g_object_unref (mounts);
}
GST_END_TEST;
static Suite *
rtspmountpoints_suite (void)
{
Suite *s = suite_create ("rtspmountpoints");
TCase *tc = tcase_create ("general");
suite_add_tcase (s, tc);
tcase_set_timeout (tc, 20);
tcase_add_test (tc, test_create);
return s;
}
GST_CHECK_MAIN (rtspmountpoints);