@Test public void prepareVastVideoConfiguration_shouldHandleMultipleRedirects() throws Exception { mFakeHttpLayer.addPendingHttpResponse(200, TEST_VAST_XML_STRING); mFakeHttpLayer.addPendingHttpResponse(200, TEST_VAST_XML_STRING); mFakeHttpLayer.addPendingHttpResponse(200, TEST_NESTED_VAST_XML_STRING); mFakeHttpLayer.addPendingHttpResponse(200, "video_data"); prepareVastVideoConfiguration(); semaphore.acquire(); verify(vastManagerListener).onVastVideoConfigurationPrepared(any(VastVideoConfiguration.class)); assertThat(vastVideoConfiguration.getNetworkMediaFileUrl()).isEqualTo("https: final String expectedFilePathDiskCache = CacheService.getFilePathDiskCache(vastVideoConfiguration.getNetworkMediaFileUrl()); assertThat(vastVideoConfiguration.getDiskMediaFileUrl()).isEqualTo(expectedFilePathDiskCache); assertThat(vastVideoConfiguration.getClickThroughUrl()).isEqualTo("http: assertThat(vastVideoConfiguration.getImpressionTrackers().size()).isEqualTo(13); assertThat(vastVideoConfiguration.getAbsoluteTrackers().size()).isEqualTo(6); assertThat(vastVideoConfiguration.getAbsoluteTrackers().get(0).getTrackingMilliseconds()).isEqualTo(2000); assertThat(vastVideoConfiguration.getAbsoluteTrackers().get(1).getTrackingMilliseconds()).isEqualTo(2000); assertThat(vastVideoConfiguration.getAbsoluteTrackers().get(2).getTrackingMilliseconds()).isEqualTo(2000); assertThat(vastVideoConfiguration.getAbsoluteTrackers().get(3).getTrackingMilliseconds()).isEqualTo(3100); assertThat(vastVideoConfiguration.getAbsoluteTrackers().get(4).getTrackingMilliseconds()).isEqualTo(3100); assertThat(vastVideoConfiguration.getAbsoluteTrackers().get(5).getTrackingMilliseconds()).isEqualTo(3100); assertThat(vastVideoConfiguration.getFractionalTrackers().size()).isEqualTo(9); assertThat(vastVideoConfiguration.getFractionalTrackers().get(0).trackingFraction()).isEqualTo(0.25f); assertThat(vastVideoConfiguration.getFractionalTrackers().get(1).trackingFraction()).isEqualTo(0.25f); assertThat(vastVideoConfiguration.getFractionalTrackers().get(2).trackingFraction()).isEqualTo(0.25f); assertThat(vastVideoConfiguration.getFractionalTrackers().get(3).trackingFraction()).isEqualTo(0.5f); assertThat(vastVideoConfiguration.getFractionalTrackers().get(4).trackingFraction()).isEqualTo(0.5f); assertThat(vastVideoConfiguration.getFractionalTrackers().get(5).trackingFraction()).isEqualTo(0.5f); assertThat(vastVideoConfiguration.getFractionalTrackers().get(6).trackingFraction()).isEqualTo(0.75f); assertThat(vastVideoConfiguration.getFractionalTrackers().get(7).trackingFraction()).isEqualTo(0.75f); assertThat(vastVideoConfiguration.getFractionalTrackers().get(8).trackingFraction()).isEqualTo(0.75f); assertThat(vastVideoConfiguration.getCompleteTrackers().size()).isEqualTo(3); assertThat(vastVideoConfiguration.getCloseTrackers().size()).isEqualTo(4); assertThat(vastVideoConfiguration.getSkipTrackers().size()).isEqualTo(4); assertThat(vastVideoConfiguration.getClickTrackers().size()).isEqualTo(3); final VastCompanionAd vastCompanionAd = vastVideoConfiguration.getVastCompanionAd(); assertThat(vastCompanionAd.getWidth()).isEqualTo(300); assertThat(vastCompanionAd.getHeight()).isEqualTo(250); assertThat(vastCompanionAd.getImageUrl()).isEqualTo("http: assertThat(vastCompanionAd.getClickThroughUrl()).isEqualTo("http: assertThat(vastCompanionAd.getClickTrackers()) .containsOnly("http: }
public void prepareVastVideoConfiguration(final String vastXml, final VastManagerListener vastManagerListener) { if (mVastXmlManagerAggregator == null) { mVastManagerListener = vastManagerListener; mVastXmlManagerAggregator = new VastXmlManagerAggregator(this); try { AsyncTasks.safeExecuteOnExecutor(mVastXmlManagerAggregator, vastXml); } catch (Exception e) { MoPubLog.d("Failed to aggregate vast xml", e); mVastManagerListener.onVastVideoConfigurationPrepared(null); } } }
VastManager implements VastXmlManagerAggregatorListener { public void prepareVastVideoConfiguration(final String vastXml, final VastManagerListener vastManagerListener) { if (mVastXmlManagerAggregator == null) { mVastManagerListener = vastManagerListener; mVastXmlManagerAggregator = new VastXmlManagerAggregator(this); try { AsyncTasks.safeExecuteOnExecutor(mVastXmlManagerAggregator, vastXml); } catch (Exception e) { MoPubLog.d("Failed to aggregate vast xml", e); mVastManagerListener.onVastVideoConfigurationPrepared(null); } } } }
VastManager implements VastXmlManagerAggregatorListener { public void prepareVastVideoConfiguration(final String vastXml, final VastManagerListener vastManagerListener) { if (mVastXmlManagerAggregator == null) { mVastManagerListener = vastManagerListener; mVastXmlManagerAggregator = new VastXmlManagerAggregator(this); try { AsyncTasks.safeExecuteOnExecutor(mVastXmlManagerAggregator, vastXml); } catch (Exception e) { MoPubLog.d("Failed to aggregate vast xml", e); mVastManagerListener.onVastVideoConfigurationPrepared(null); } } } VastManager(final Context context); }
VastManager implements VastXmlManagerAggregatorListener { public void prepareVastVideoConfiguration(final String vastXml, final VastManagerListener vastManagerListener) { if (mVastXmlManagerAggregator == null) { mVastManagerListener = vastManagerListener; mVastXmlManagerAggregator = new VastXmlManagerAggregator(this); try { AsyncTasks.safeExecuteOnExecutor(mVastXmlManagerAggregator, vastXml); } catch (Exception e) { MoPubLog.d("Failed to aggregate vast xml", e); mVastManagerListener.onVastVideoConfigurationPrepared(null); } } } VastManager(final Context context); void prepareVastVideoConfiguration(final String vastXml, final VastManagerListener vastManagerListener); void cancel(); @Override void onAggregationComplete(final List<VastXmlManager> vastXmlManagers); }
VastManager implements VastXmlManagerAggregatorListener { public void prepareVastVideoConfiguration(final String vastXml, final VastManagerListener vastManagerListener) { if (mVastXmlManagerAggregator == null) { mVastManagerListener = vastManagerListener; mVastXmlManagerAggregator = new VastXmlManagerAggregator(this); try { AsyncTasks.safeExecuteOnExecutor(mVastXmlManagerAggregator, vastXml); } catch (Exception e) { MoPubLog.d("Failed to aggregate vast xml", e); mVastManagerListener.onVastVideoConfigurationPrepared(null); } } } VastManager(final Context context); void prepareVastVideoConfiguration(final String vastXml, final VastManagerListener vastManagerListener); void cancel(); @Override void onAggregationComplete(final List<VastXmlManager> vastXmlManagers);  }