diff options
Diffstat (limited to 'tests/check/libs/player.c')
-rw-r--r-- | tests/check/libs/player.c | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/check/libs/player.c b/tests/check/libs/player.c index 52a7ca04a..e0fcf9266 100644 --- a/tests/check/libs/player.c +++ b/tests/check/libs/player.c @@ -1612,6 +1612,58 @@ START_TEST (test_restart) END_TEST; +#define TEST_USER_AGENT "test user agent" + +static void +source_setup_cb (GstElement * playbin, GstElement * source, GMainLoop * loop) +{ + gchar *user_agent; + + g_object_get (source, "user-agent", &user_agent, NULL); + fail_unless_equals_string (user_agent, TEST_USER_AGENT); + g_free (user_agent); + + g_main_loop_quit (loop); +} + +START_TEST (test_user_agent) +{ + GstPlayer *player; + GMainLoop *loop; + GstElement *pipeline; + GstStructure *config; + gchar *user_agent; + + loop = g_main_loop_new (NULL, FALSE); + player = gst_player_new (NULL, NULL); + fail_unless (player != NULL); + + gst_player_set_uri (player, "http://badger.com/test.mkv"); + + config = gst_player_get_config (player); + gst_player_config_set_user_agent (config, TEST_USER_AGENT); + + user_agent = gst_player_config_get_user_agent (config); + fail_unless_equals_string (user_agent, TEST_USER_AGENT); + g_free (user_agent); + + gst_player_set_config (player, config); + + pipeline = gst_player_get_pipeline (player); + g_signal_connect (pipeline, "source-setup", G_CALLBACK (source_setup_cb), + loop); + + gst_player_pause (player); + g_main_loop_run (loop); + + gst_object_unref (pipeline); + + g_object_unref (player); + g_main_loop_unref (loop); +} + +END_TEST; + static Suite * player_suite (void) { @@ -1654,6 +1706,7 @@ player_suite (void) tcase_add_test (tc_general, test_play_backward_rate); tcase_add_test (tc_general, test_play_audio_video_seek_done); tcase_add_test (tc_general, test_restart); + tcase_add_test (tc_general, test_user_agent); suite_add_tcase (s, tc_general); |