1 #include <gst/check/gstharness.h>
2 #include <gst/check/gstcheck.h>
3
GST_START_TEST(netsim_stress)4 GST_START_TEST (netsim_stress)
5 {
6 GstHarness *h = gst_harness_new ("netsim");
7 GstCaps *caps = gst_caps_from_string ("mycaps");
8 GstBuffer *buf = gst_harness_create_buffer (h, 100);
9 GstHarnessThread *state, *push;
10 GstSegment segment;
11
12 gst_segment_init (&segment, GST_FORMAT_TIME);
13 state = gst_harness_stress_statechange_start (h);
14 push = gst_harness_stress_push_buffer_start (h, caps, &segment, buf);
15
16 g_usleep (G_USEC_PER_SEC * 1);
17
18 gst_harness_stress_thread_stop (state);
19 gst_harness_stress_thread_stop (push);
20
21 gst_caps_unref (caps);
22 gst_buffer_unref (buf);
23 gst_harness_teardown (h);
24 }
25
26 GST_END_TEST;
27
GST_START_TEST(netsim_stress_delayed)28 GST_START_TEST (netsim_stress_delayed)
29 {
30 GstHarness *h = gst_harness_new_parse ("netsim delay-probability=0.5");
31 GstCaps *caps = gst_caps_from_string ("mycaps");
32 GstBuffer *buf;
33 GstHarnessThread *state, *push;
34 GstSegment segment;
35
36 gst_harness_set_src_caps (h, gst_caps_ref (caps));
37 buf = gst_harness_create_buffer (h, 100);
38 gst_segment_init (&segment, GST_FORMAT_TIME);
39 state = gst_harness_stress_statechange_start (h);
40 push = gst_harness_stress_push_buffer_start (h, caps, &segment, buf);
41
42 g_usleep (G_USEC_PER_SEC * 1);
43
44 gst_harness_stress_thread_stop (state);
45 gst_harness_stress_thread_stop (push);
46
47 gst_caps_unref (caps);
48 gst_buffer_unref (buf);
49 gst_harness_teardown (h);
50 }
51
52 GST_END_TEST;
53
54 static Suite *
netsim_suite(void)55 netsim_suite (void)
56 {
57 Suite *s = suite_create ("netsim");
58 TCase *tc_chain;
59
60 suite_add_tcase (s, (tc_chain = tcase_create ("general")));
61 tcase_add_test (tc_chain, netsim_stress);
62 tcase_add_test (tc_chain, netsim_stress_delayed);
63
64 return s;
65 }
66
67 GST_CHECK_MAIN (netsim)
68