use of org.prebid.mobile.rendering.models.internal.MraidEvent in project prebid-mobile-android by prebid.
the class BaseJSInterfaceTest method onOrientationPropertiesChangedTest.
@Test
public void onOrientationPropertiesChangedTest() throws Exception {
Field field = WhiteBox.field(BaseJSInterface.class, "mMraidEvent");
mSpyBaseJSInterface.onOrientationPropertiesChanged("test");
MraidEvent event = (MraidEvent) field.get(mSpyBaseJSInterface);
assertEquals(JSInterface.ACTION_ORIENTATION_CHANGE, event.mraidAction);
assertEquals("test", event.mraidActionHelper);
verify(mMockMraidController).handleMraidEvent(eq(event), eq(mMockCreative), any(WebViewBase.class), any());
}
use of org.prebid.mobile.rendering.models.internal.MraidEvent in project prebid-mobile-android by prebid.
the class BaseJSInterfaceTest method expandWithUrlTest.
@Test
public void expandWithUrlTest() throws Exception {
Field field = WhiteBox.field(BaseJSInterface.class, "mMraidEvent");
mSpyBaseJSInterface.expand(null);
MraidEvent event = (MraidEvent) field.get(mSpyBaseJSInterface);
assertEquals(JSInterface.ACTION_EXPAND, event.mraidAction);
verify(mMockMraidController).handleMraidEvent(eq(event), eq(mMockCreative), any(WebViewBase.class), any());
}
use of org.prebid.mobile.rendering.models.internal.MraidEvent in project prebid-mobile-android by prebid.
the class PrebidWebViewBannerTest method preloadedTest.
@Test
public void preloadedTest() {
WebViewDelegate mockDelegate = mock(WebViewDelegate.class);
InterstitialManager mockManager = mock(InterstitialManager.class);
mBanner.mWebViewDelegate = mockDelegate;
mBanner.mInterstitialManager = mockManager;
MraidEvent mockEvent = mock(MraidEvent.class);
when(mMockWebViewBanner.getMraidEvent()).thenReturn(mockEvent);
mBanner.preloaded(null);
verify(mockDelegate).webViewFailedToLoad(any(AdException.class));
mMockWebViewBanner.mMRAIDBridgeName = "twopart";
mBanner.preloaded(mMockWebViewBanner);
verify(mockManager).displayPrebidWebViewForMraid(eq(mMockWebViewBanner), eq(true));
mMockWebViewBanner.mMRAIDBridgeName = "else";
mBanner.preloaded(mMockWebViewBanner);
// verify render
verify(mMockWebViewBanner).setAdWidth(anyInt());
when(mMockWebViewBanner.getParent()).thenReturn(mock(ViewGroup.class));
mBanner.preloaded(mMockWebViewBanner);
verify(mMockWebViewBanner).bringToFront();
verify(mockDelegate, times(3)).webViewReadyToDisplay();
}
use of org.prebid.mobile.rendering.models.internal.MraidEvent in project prebid-mobile-android by prebid.
the class BaseJSInterfaceTest method expandNoUrlTest.
@Test
public void expandNoUrlTest() throws Exception {
Field field = WhiteBox.field(BaseJSInterface.class, "mMraidEvent");
mSpyBaseJSInterface.expand();
MraidEvent event = (MraidEvent) field.get(mSpyBaseJSInterface);
assertEquals(JSInterface.ACTION_EXPAND, event.mraidAction);
assertNull(event.mraidActionHelper);
verify(mMockMraidController).handleMraidEvent(eq(event), eq(mMockCreative), any(WebViewBase.class), any());
}
use of org.prebid.mobile.rendering.models.internal.MraidEvent in project prebid-mobile-android by prebid.
the class MraidControllerTest method handleMraidEventWhenExpandEventAndHelperEmpty_RunTwoPartRunnable.
@Test
public void handleMraidEventWhenExpandEventAndHelperEmpty_RunTwoPartRunnable() {
HTMLCreative mockCreative = mock(HTMLCreative.class);
MraidEvent event = createMraidEvent(JSInterface.ACTION_EXPAND, "twoPart");
WebViewBase mockOldWebView = mock(WebViewBase.class);
when(mockOldWebView.getMraidListener()).thenReturn(mock(MraidEventsManager.MraidListener.class));
when(mockOldWebView.getContext()).thenReturn(mContext);
mMraidController.handleMraidEvent(event, mockCreative, mockOldWebView, mock(PrebidWebViewBase.class));
ShadowLooper.runUiThreadTasks();
verify(mMraidController, times(1)).expand(any(WebViewBase.class), any(PrebidWebViewBase.class), eq(event));
}
Aggregations