adaptivedemux: tests: corrected access to fakeHTTPsrc element

The src element for adaptivedemux is now a bin. Updated the tests to
correctly reach into the bin and get the fakeHTTPsrc element

https://bugzilla.gnome.org/show_bug.cgi?id=757776
This commit is contained in:
Florin Apostol 2015-11-09 14:14:34 +00:00 committed by Vincent Penquerc'h
parent 7f3d47deb3
commit 665eb6fcca

View file

@ -1099,11 +1099,20 @@ testSeekOnStateChanged (GstBus * bus, GstMessage * msg, gpointer data)
if (strstr (srcName, "fakesouphttpsrc") == srcName &&
old_state == GST_STATE_PLAYING && new_state == GST_STATE_PAUSED) {
GList *pads = GST_ELEMENT_PADS (msg->src);
GstObject *srcBin;
/* src is a fake http src element. It should have only 1 pad */
fail_unless (pads != NULL);
fail_unless (g_list_length (pads) == 1);
/* fakeHTTPsrc element is placed inside a bin. Get the bin */
srcBin = gst_object_get_parent (msg->src);
/* the bin should have only 1 output pad */
pads = GST_ELEMENT_PADS (srcBin);
fail_unless (pads != NULL);
fail_unless (g_list_length (pads) == 1);
internalPad = gst_pad_get_peer (GST_PAD (pads->data));
testOutputStreamData = getTestOutputDataByPad (testData, internalPad);
gst_object_unref (internalPad);
@ -1118,6 +1127,7 @@ testSeekOnStateChanged (GstBus * bus, GstMessage * msg, gpointer data)
}
g_mutex_unlock (&testData->scratchData->seekTaskStateLock);
}
gst_object_unref (srcBin);
}
}
@ -1289,18 +1299,23 @@ testFragmentDownloadErrorCheckDataReceived (GstDashDemuxTestData * testData,
checkDataReceived (testData, testOutputStreamData, buffer);
if (testOutputStreamData->scratchData->segmentReceivedSize > 2000) {
GstPad *fakeHttpSrcPad;
GstObject *fakeHttpSrcElement;
GstPad *srcBinPad;
GstObject *srcBin;
GstElement *fakeHttpSrcElement;
srcBinPad =
gst_pad_get_peer (testOutputStreamData->scratchData->internalPad);
srcBin = gst_pad_get_parent (srcBinPad);
fakeHttpSrcElement = gst_bin_get_by_interface (GST_BIN (srcBin),
GST_TYPE_URI_HANDLER);
/* tell fake soup http src to post an error on the adaptive demux bus */
fakeHttpSrcPad =
gst_pad_get_peer (testOutputStreamData->scratchData->internalPad);
fakeHttpSrcElement = gst_pad_get_parent (fakeHttpSrcPad);
gst_fake_soup_http_src_simulate_download_error ((GstFakeSoupHTTPSrc *)
fakeHttpSrcElement, 404);
gst_object_unref (fakeHttpSrcPad);
gst_object_unref (srcBinPad);
gst_object_unref (srcBin);
gst_object_unref (fakeHttpSrcElement);
testData->expectError = TRUE;