@Test public void scheduleRefreshTimer_whenAdViewControllerNotConfiguredByResponse_shouldHaveDefaultRefreshTime() throws Exception { Robolectric.pauseMainLooper(); assertThat(Robolectric.getUiThreadScheduler().enqueuedTaskCount()).isEqualTo(0); subject.scheduleRefreshTimerIfEnabled(); assertThat(Robolectric.getUiThreadScheduler().enqueuedTaskCount()).isEqualTo(1); Robolectric.idleMainLooper(AdViewController.DEFAULT_REFRESH_TIME_MILLISECONDS - 1); assertThat(Robolectric.getUiThreadScheduler().enqueuedTaskCount()).isEqualTo(1); Robolectric.idleMainLooper(1); assertThat(Robolectric.getUiThreadScheduler().enqueuedTaskCount()).isEqualTo(0); }
void scheduleRefreshTimerIfEnabled() { cancelRefreshTimer(); if (mAutoRefreshEnabled && mRefreshTimeMillis != null && mRefreshTimeMillis > 0) { mHandler.postDelayed(mRefreshRunnable, Math.min(MAX_REFRESH_TIME_MILLISECONDS, mRefreshTimeMillis * (long) Math.pow(BACKOFF_FACTOR, mBackoffPower))); } }
AdViewController { void scheduleRefreshTimerIfEnabled() { cancelRefreshTimer(); if (mAutoRefreshEnabled && mRefreshTimeMillis != null && mRefreshTimeMillis > 0) { mHandler.postDelayed(mRefreshRunnable, Math.min(MAX_REFRESH_TIME_MILLISECONDS, mRefreshTimeMillis * (long) Math.pow(BACKOFF_FACTOR, mBackoffPower))); } } }
AdViewController { void scheduleRefreshTimerIfEnabled() { cancelRefreshTimer(); if (mAutoRefreshEnabled && mRefreshTimeMillis != null && mRefreshTimeMillis > 0) { mHandler.postDelayed(mRefreshRunnable, Math.min(MAX_REFRESH_TIME_MILLISECONDS, mRefreshTimeMillis * (long) Math.pow(BACKOFF_FACTOR, mBackoffPower))); } } AdViewController(@NonNull Context context, @NonNull MoPubView view); }
AdViewController { void scheduleRefreshTimerIfEnabled() { cancelRefreshTimer(); if (mAutoRefreshEnabled && mRefreshTimeMillis != null && mRefreshTimeMillis > 0) { mHandler.postDelayed(mRefreshRunnable, Math.min(MAX_REFRESH_TIME_MILLISECONDS, mRefreshTimeMillis * (long) Math.pow(BACKOFF_FACTOR, mBackoffPower))); } } AdViewController(@NonNull Context context, @NonNull MoPubView view); static void setShouldHonorServerDimensions(View view); @Nullable MoPubView getMoPubView(); void loadAd(); void reload(); String getKeywords(); void setKeywords(String keywords); Location getLocation(); void setLocation(Location location); String getAdUnitId(); void setAdUnitId(@NonNull String adUnitId); long getBroadcastIdentifier(); void setTimeout(int milliseconds); int getAdWidth(); int getAdHeight(); @Deprecated String getClickTrackingUrl(); @Deprecated String getRedirectUrl(); @Deprecated String getResponseString(); boolean getAutorefreshEnabled(); @Nullable AdReport getAdReport(); boolean getTesting(); void setTesting(boolean enabled); @Deprecated void customEventDidLoadAd(); @Deprecated void customEventDidFailToLoadAd(); @Deprecated void customEventActionWillBegin(); @Deprecated void setClickthroughUrl(String clickthroughUrl); @Deprecated boolean isFacebookSupported(); @Deprecated void setFacebookSupported(boolean enabled); }
AdViewController { void scheduleRefreshTimerIfEnabled() { cancelRefreshTimer(); if (mAutoRefreshEnabled && mRefreshTimeMillis != null && mRefreshTimeMillis > 0) { mHandler.postDelayed(mRefreshRunnable, Math.min(MAX_REFRESH_TIME_MILLISECONDS, mRefreshTimeMillis * (long) Math.pow(BACKOFF_FACTOR, mBackoffPower))); } } AdViewController(@NonNull Context context, @NonNull MoPubView view); static void setShouldHonorServerDimensions(View view); @Nullable MoPubView getMoPubView(); void loadAd(); void reload(); String getKeywords(); void setKeywords(String keywords); Location getLocation(); void setLocation(Location location); String getAdUnitId(); void setAdUnitId(@NonNull String adUnitId); long getBroadcastIdentifier(); void setTimeout(int milliseconds); int getAdWidth(); int getAdHeight(); @Deprecated String getClickTrackingUrl(); @Deprecated String getRedirectUrl(); @Deprecated String getResponseString(); boolean getAutorefreshEnabled(); @Nullable AdReport getAdReport(); boolean getTesting(); void setTesting(boolean enabled); @Deprecated void customEventDidLoadAd(); @Deprecated void customEventDidFailToLoadAd(); @Deprecated void customEventActionWillBegin(); @Deprecated void setClickthroughUrl(String clickthroughUrl); @Deprecated boolean isFacebookSupported(); @Deprecated void setFacebookSupported(boolean enabled);  }