use of org.prebid.mobile.rendering.listeners.CreativeViewListener in project prebid-mobile-android by prebid.
the class VideoCreativeTest method trackAdVideoEventTest.
@Test
public void trackAdVideoEventTest() throws Exception {
CreativeViewListener mockCreativeViewListener = mock(CreativeViewListener.class);
VideoPlayerView mockView = mock(VideoPlayerView.class);
mVideoCreative.setCreativeViewListener(mockCreativeViewListener);
when(mockView.getDuration()).thenReturn(0);
when(mockView.getVolume()).thenReturn(0f);
when(mMockVideoCreativeView.hasVideoStarted()).thenReturn(true);
when(mMockVideoCreativeView.isPlaying()).thenReturn(true);
when(mMockVideoCreativeView.getVideoPlayerView()).thenReturn(mockView);
mVideoCreative.complete();
verify(mMockModel).trackVideoEvent(VideoAdEvent.Event.AD_COMPLETE);
mockCreativeViewListener.creativeDidComplete(mVideoCreative);
mVideoCreative.onVolumeChanged(1);
verify(mMockOmAdSessionManager).trackVolumeChange(1);
mVideoCreative.onPlayerStateChanged(InternalPlayerState.NORMAL);
verify(mMockModel).trackPlayerStateChange(InternalPlayerState.NORMAL);
mVideoCreative.skip();
verify(mMockModel).trackVideoEvent(VideoAdEvent.Event.AD_SKIP);
mockCreativeViewListener.creativeDidComplete(mVideoCreative);
mVideoCreative.onEvent(VideoAdEvent.Event.AD_RESUME);
verify(mMockModel).trackVideoEvent(VideoAdEvent.Event.AD_RESUME);
mVideoCreative.onEvent(VideoAdEvent.Event.AD_PAUSE);
verify(mMockModel).trackVideoEvent(VideoAdEvent.Event.AD_PAUSE);
mVideoCreative.onEvent(VideoAdEvent.Event.AD_UNMUTE);
verify(mMockModel).trackVideoEvent(VideoAdEvent.Event.AD_UNMUTE);
mVideoCreative.onEvent(VideoAdEvent.Event.AD_MUTE);
verify(mMockModel).trackVideoEvent(VideoAdEvent.Event.AD_MUTE);
mVideoCreative.onEvent(VideoAdEvent.Event.AD_FULLSCREEN);
verify(mMockModel).trackVideoEvent(VideoAdEvent.Event.AD_FULLSCREEN);
mVideoCreative.onEvent(VideoAdEvent.Event.AD_EXITFULLSCREEN);
verify(mMockModel).trackVideoEvent(VideoAdEvent.Event.AD_EXITFULLSCREEN);
mVideoCreative.onEvent(VideoAdEvent.Event.AD_START);
verify(mMockModel).trackVideoEvent(VideoAdEvent.Event.AD_START);
mVideoCreative.mVideoCreativeView = null;
mVideoCreative.onEvent(VideoAdEvent.Event.AD_START);
verify(mMockModel, atLeastOnce()).trackVideoEvent(VideoAdEvent.Event.AD_START);
}
use of org.prebid.mobile.rendering.listeners.CreativeViewListener in project prebid-mobile-android by prebid.
the class VideoCreativeTest method whenOnVideoInterstitialClosed_DestroyCreativeViewAndCallCreativeDidComplete.
@Test
public void whenOnVideoInterstitialClosed_DestroyCreativeViewAndCallCreativeDidComplete() {
CreativeViewListener mockListener = mock(CreativeViewListener.class);
mVideoCreative.setCreativeViewListener(mockListener);
mVideoCreative.onVideoInterstitialClosed();
verify(mMockVideoCreativeView).destroy();
verify(mockListener).creativeDidComplete(any(AbstractCreative.class));
}
Aggregations