Search in sources :

Example 1 with WebViewDelegate

use of org.prebid.mobile.rendering.listeners.WebViewDelegate in project prebid-mobile-android by prebid.

the class PrebidWebViewBaseTest method openMRAIDExternalLinkTest.

@Test
public void openMRAIDExternalLinkTest() {
    WebViewDelegate mockDelegate = mock(WebViewDelegate.class);
    mPrebidWebViewBase.mWebViewDelegate = mockDelegate;
    mPrebidWebViewBase.openMraidExternalLink("test");
    verify(mockDelegate).webViewShouldOpenMRAIDLink(eq("test"));
}
Also used : WebViewDelegate(org.prebid.mobile.rendering.listeners.WebViewDelegate) Test(org.junit.Test)

Example 2 with WebViewDelegate

use of org.prebid.mobile.rendering.listeners.WebViewDelegate in project prebid-mobile-android by prebid.

the class PrebidWebViewBaseTest method openExternalLinkTest.

@Test
public void openExternalLinkTest() {
    WebViewDelegate mockDelegate = mock(WebViewDelegate.class);
    mPrebidWebViewBase.mWebViewDelegate = mockDelegate;
    mPrebidWebViewBase.openExternalLink("test");
    verify(mockDelegate).webViewShouldOpenExternalLink(eq("test"));
}
Also used : WebViewDelegate(org.prebid.mobile.rendering.listeners.WebViewDelegate) Test(org.junit.Test)

Example 3 with WebViewDelegate

use of org.prebid.mobile.rendering.listeners.WebViewDelegate 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();
}
Also used : WebViewDelegate(org.prebid.mobile.rendering.listeners.WebViewDelegate) ViewGroup(android.view.ViewGroup) InterstitialManager(org.prebid.mobile.rendering.views.interstitial.InterstitialManager) MraidEvent(org.prebid.mobile.rendering.models.internal.MraidEvent) AdException(org.prebid.mobile.rendering.errors.AdException) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)3 WebViewDelegate (org.prebid.mobile.rendering.listeners.WebViewDelegate)3 ViewGroup (android.view.ViewGroup)1 AdException (org.prebid.mobile.rendering.errors.AdException)1 MraidEvent (org.prebid.mobile.rendering.models.internal.MraidEvent)1 InterstitialManager (org.prebid.mobile.rendering.views.interstitial.InterstitialManager)1