Add test ads response with two midrolls
Also clean up naming of test ads responses. PiperOrigin-RevId: 309728625
This commit is contained in:
parent
3c2e5df527
commit
99a3cc2877
@ -64,8 +64,6 @@ public final class ImaPlaybackTest {
|
|||||||
|
|
||||||
private static final String CONTENT_URI =
|
private static final String CONTENT_URI =
|
||||||
"https://storage.googleapis.com/exoplayer-test-media-1/mp4/android-screens-10s.mp4";
|
"https://storage.googleapis.com/exoplayer-test-media-1/mp4/android-screens-10s.mp4";
|
||||||
private static final String PREROLL_ADS_RESPONSE_FILE_NAME = "ad-responses/preroll.xml";
|
|
||||||
private static final String MIDROLL_ADS_RESPONSE_FILE_NAME = "ad-responses/midroll.xml";
|
|
||||||
|
|
||||||
private static final AdId CONTENT = new AdId(C.INDEX_UNSET, C.INDEX_UNSET);
|
private static final AdId CONTENT = new AdId(C.INDEX_UNSET, C.INDEX_UNSET);
|
||||||
|
|
||||||
@ -73,9 +71,9 @@ public final class ImaPlaybackTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void playbackWithPrerollAdTag_playsAdAndContent() throws Exception {
|
public void playbackWithPrerollAdTag_playsAdAndContent() throws Exception {
|
||||||
AdId[] expectedAdIds = new AdId[] {ad(0), CONTENT};
|
|
||||||
String adsResponse =
|
String adsResponse =
|
||||||
TestUtil.getString(/* context= */ testRule.getActivity(), PREROLL_ADS_RESPONSE_FILE_NAME);
|
TestUtil.getString(/* context= */ testRule.getActivity(), "ad-responses/preroll.xml");
|
||||||
|
AdId[] expectedAdIds = new AdId[] {ad(0), CONTENT};
|
||||||
ImaHostedTest hostedTest =
|
ImaHostedTest hostedTest =
|
||||||
new ImaHostedTest(Uri.parse(CONTENT_URI), adsResponse, expectedAdIds);
|
new ImaHostedTest(Uri.parse(CONTENT_URI), adsResponse, expectedAdIds);
|
||||||
|
|
||||||
@ -84,9 +82,22 @@ public final class ImaPlaybackTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void playbackWithMidrolls_playsAdAndContent() throws Exception {
|
public void playbackWithMidrolls_playsAdAndContent() throws Exception {
|
||||||
AdId[] expectedAdIds = new AdId[] {ad(0), CONTENT, ad(1), CONTENT, ad(2), CONTENT};
|
|
||||||
String adsResponse =
|
String adsResponse =
|
||||||
TestUtil.getString(/* context= */ testRule.getActivity(), MIDROLL_ADS_RESPONSE_FILE_NAME);
|
TestUtil.getString(
|
||||||
|
/* context= */ testRule.getActivity(), "ad-responses/preroll_midroll6s_postroll.xml");
|
||||||
|
AdId[] expectedAdIds = new AdId[] {ad(0), CONTENT, ad(1), CONTENT, ad(2), CONTENT};
|
||||||
|
ImaHostedTest hostedTest =
|
||||||
|
new ImaHostedTest(Uri.parse(CONTENT_URI), adsResponse, expectedAdIds);
|
||||||
|
|
||||||
|
testRule.getActivity().runTest(hostedTest, TIMEOUT_MS);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void playbackWithMidrolls1And7_playsAdsAndContent() throws Exception {
|
||||||
|
String adsResponse =
|
||||||
|
TestUtil.getString(
|
||||||
|
/* context= */ testRule.getActivity(), "ad-responses/midroll1s_midroll7s.xml");
|
||||||
|
AdId[] expectedAdIds = new AdId[] {CONTENT, ad(0), CONTENT, ad(1), CONTENT};
|
||||||
ImaHostedTest hostedTest =
|
ImaHostedTest hostedTest =
|
||||||
new ImaHostedTest(Uri.parse(CONTENT_URI), adsResponse, expectedAdIds);
|
new ImaHostedTest(Uri.parse(CONTENT_URI), adsResponse, expectedAdIds);
|
||||||
|
|
||||||
|
64
testdata/src/test/assets/ad-responses/midroll1s_midroll7s.xml
vendored
Normal file
64
testdata/src/test/assets/ad-responses/midroll1s_midroll7s.xml
vendored
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
<vmap:VMAP xmlns:vmap="http://www.iab.net/videosuite/vmap" version="1.0">
|
||||||
|
<vmap:AdBreak timeOffset="00:00:01.000" breakType="linear" breakId="midroll-1">
|
||||||
|
<vmap:AdSource id="midroll-1-ad-1" allowMultipleAds="false" followRedirects="true">
|
||||||
|
<vmap:VASTAdData>
|
||||||
|
<VAST xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vast.xsd" version="3.0">
|
||||||
|
<Ad id="710742616">
|
||||||
|
<InLine>
|
||||||
|
<AdSystem>GDFP</AdSystem>
|
||||||
|
<AdTitle>Midroll</AdTitle>
|
||||||
|
<Description>
|
||||||
|
<![CDATA[ Midroll ad ]]>
|
||||||
|
</Description>
|
||||||
|
<Creatives>
|
||||||
|
<Creative id="57861202456" sequence="1">
|
||||||
|
<Linear>
|
||||||
|
<Duration>00:00:05</Duration>
|
||||||
|
<MediaFiles>
|
||||||
|
<MediaFile id="GDFP" delivery="progressive" width="640" height="360" type="video/mp4" bitrate="450" scalable="true" maintainAspectRatio="true">
|
||||||
|
<![CDATA[
|
||||||
|
file:///android_asset/mp4/midroll-5s.mp4
|
||||||
|
]]>
|
||||||
|
</MediaFile>
|
||||||
|
</MediaFiles>
|
||||||
|
</Linear>
|
||||||
|
</Creative>
|
||||||
|
</Creatives>
|
||||||
|
</InLine>
|
||||||
|
</Ad>
|
||||||
|
</VAST>
|
||||||
|
</vmap:VASTAdData>
|
||||||
|
</vmap:AdSource>
|
||||||
|
</vmap:AdBreak>
|
||||||
|
<vmap:AdBreak timeOffset="00:00:07.000" breakType="linear" breakId="midroll-2">
|
||||||
|
<vmap:AdSource id="midroll-2-ad-1" allowMultipleAds="false" followRedirects="true">
|
||||||
|
<vmap:VASTAdData>
|
||||||
|
<VAST xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="vast.xsd" version="3.0">
|
||||||
|
<Ad id="710742616">
|
||||||
|
<InLine>
|
||||||
|
<AdSystem>GDFP</AdSystem>
|
||||||
|
<AdTitle>Midroll</AdTitle>
|
||||||
|
<Description>
|
||||||
|
<![CDATA[ Midroll ad ]]>
|
||||||
|
</Description>
|
||||||
|
<Creatives>
|
||||||
|
<Creative id="57861202456" sequence="1">
|
||||||
|
<Linear>
|
||||||
|
<Duration>00:00:05</Duration>
|
||||||
|
<MediaFiles>
|
||||||
|
<MediaFile id="GDFP" delivery="progressive" width="640" height="360" type="video/mp4" bitrate="450" scalable="true" maintainAspectRatio="true">
|
||||||
|
<![CDATA[
|
||||||
|
file:///android_asset/mp4/midroll-5s.mp4
|
||||||
|
]]>
|
||||||
|
</MediaFile>
|
||||||
|
</MediaFiles>
|
||||||
|
</Linear>
|
||||||
|
</Creative>
|
||||||
|
</Creatives>
|
||||||
|
</InLine>
|
||||||
|
</Ad>
|
||||||
|
</VAST>
|
||||||
|
</vmap:VASTAdData>
|
||||||
|
</vmap:AdSource>
|
||||||
|
</vmap:AdBreak>
|
||||||
|
</vmap:VMAP>
|
Loading…
x
Reference in New Issue
Block a user