tests: Make sure packets are actually received
[platform/upstream/gstreamer.git] / tests / check / gst / mountpoints.c
1 /* GStreamer
2  * Copyright (C) 2012 Wim Taymans <wim.taymans@gmail.com>
3  *
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.
8  *
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.
13  *
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.
18  */
19
20 #include <gst/check/gstcheck.h>
21
22 #include <rtsp-mount-points.h>
23
24 GST_START_TEST (test_create)
25 {
26   GstRTSPMountPoints *mounts;
27   GstRTSPUrl *url, *url2;
28   GstRTSPMediaFactory *factory;
29
30   mounts = gst_rtsp_mount_points_new ();
31
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);
36
37   fail_unless (gst_rtsp_mount_points_find_factory (mounts, url) == NULL);
38
39   factory = gst_rtsp_media_factory_new ();
40   gst_rtsp_mount_points_add_factory (mounts, "/test", factory);
41
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);
45
46   gst_rtsp_mount_points_remove_factory (mounts, "/test");
47
48   fail_unless (gst_rtsp_mount_points_find_factory (mounts, url) == NULL);
49   fail_unless (gst_rtsp_mount_points_find_factory (mounts, url2) == NULL);
50
51   gst_rtsp_url_free (url);
52   gst_rtsp_url_free (url2);
53
54   g_object_unref (mounts);
55 }
56
57 GST_END_TEST;
58
59 static Suite *
60 rtspmountpoints_suite (void)
61 {
62   Suite *s = suite_create ("rtspmountpoints");
63   TCase *tc = tcase_create ("general");
64
65   suite_add_tcase (s, tc);
66   tcase_set_timeout (tc, 20);
67   tcase_add_test (tc, test_create);
68
69   return s;
70 }
71
72 GST_CHECK_MAIN (rtspmountpoints);