adaptivedemux: tests: corrected access to fakeHTTPsrc element
authorFlorin Apostol <florin.apostol@oregan.net>
Mon, 9 Nov 2015 14:14:34 +0000 (14:14 +0000)
committerVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Tue, 24 Nov 2015 16:37:23 +0000 (16:37 +0000)
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

tests/check/elements/dash_demux.c

index 01cc142..13211c2 100644 (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;
 
-    /* tell fake soup http src to post an error on the adaptive demux bus */
-    fakeHttpSrcPad =
+    srcBinPad =
         gst_pad_get_peer (testOutputStreamData->scratchData->internalPad);
-    fakeHttpSrcElement = gst_pad_get_parent (fakeHttpSrcPad);
+    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 */
     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;