2 * Copyright (C) 2012 Wim Taymans <wim.taymans@gmail.com>
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17 * Boston, MA 02110-1301, USA.
20 #include <gst/check/gstcheck.h>
22 #include <rtsp-mount-points.h>
24 GST_START_TEST (test_create)
26 GstRTSPMountPoints *mounts;
27 GstRTSPUrl *url, *url2;
28 GstRTSPMediaFactory *factory;
30 mounts = gst_rtsp_mount_points_new ();
32 fail_unless (gst_rtsp_url_parse ("rtsp://localhost:8554/test",
33 &url) == GST_RTSP_OK);
34 fail_unless (gst_rtsp_url_parse ("rtsp://localhost:8554/test2",
35 &url2) == GST_RTSP_OK);
37 fail_unless (gst_rtsp_mount_points_find_factory (mounts, url) == NULL);
39 factory = gst_rtsp_media_factory_new ();
40 gst_rtsp_mount_points_add_factory (mounts, "/test", factory);
42 fail_unless (gst_rtsp_mount_points_find_factory (mounts, url) == factory);
43 g_object_unref (factory);
44 fail_unless (gst_rtsp_mount_points_find_factory (mounts, url2) == NULL);
46 gst_rtsp_mount_points_remove_factory (mounts, "/test");
48 fail_unless (gst_rtsp_mount_points_find_factory (mounts, url) == NULL);
49 fail_unless (gst_rtsp_mount_points_find_factory (mounts, url2) == NULL);
51 gst_rtsp_url_free (url);
52 gst_rtsp_url_free (url2);
54 g_object_unref (mounts);
60 rtspmountpoints_suite (void)
62 Suite *s = suite_create ("rtspmountpoints");
63 TCase *tc = tcase_create ("general");
65 suite_add_tcase (s, tc);
66 tcase_set_timeout (tc, 20);
67 tcase_add_test (tc, test_create);
72 GST_CHECK_MAIN (rtspmountpoints);