MraidActivity extends BaseInterstitialActivity { @Override public void onCreate(@Nullable Bundle savedInstanceState) { super.onCreate(savedInstanceState); broadcastAction(this, getBroadcastIdentifier(), ACTION_INTERSTITIAL_SHOW); if (VERSION.SDK_INT >= VERSION_CODES.ICE_CREAM_SANDWICH) { getWindow().setFlags( WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED, WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED); } }  static void preRenderHtml(@NonNull final Context context,
            @NonNull final CustomEventInterstitialListener customEventInterstitialListener,
            @NonNull final String htmlData); static void start(@NonNull Context context, @NonNull String htmlData,
            @NonNull AdConfiguration adConfiguration); @Override View getAdView(); @Override void onCreate(@Nullable Bundle savedInstanceState); @VisibleForTesting void setDebugListener(@Nullable MraidWebViewDebugListener debugListener);  }
@Ignore("Mraid 2.0") @Test public void onCreate_shouldSetContentView() throws Exception { subject.onCreate(null); assertThat(getContentView().getChildCount()).isEqualTo(1); }
@Ignore("Mraid 2.0") @Test public void onCreate_shouldSetupAnMraidView() throws Exception { subject.onCreate(null); assertThat(getContentView().getChildAt(0)).isSameAs(mraidWebView); verify(mraidController).setMraidListener(any(MraidListener.class)); verify(mraidBridge).setContentHtml(EXPECTED_SOURCE); }
@Ignore("Mraid 2.0") @Test public void onCreate_shouldSetLayoutOfMraidView() throws Exception { subject.onCreate(null); ArgumentCaptor<FrameLayout.LayoutParams> captor = ArgumentCaptor.forClass( FrameLayout.LayoutParams.class); verify(mraidWebView).setLayoutParams(captor.capture()); FrameLayout.LayoutParams actualLayoutParams = captor.getValue(); assertThat(actualLayoutParams.width).isEqualTo(FrameLayout.LayoutParams.MATCH_PARENT); assertThat(actualLayoutParams.height).isEqualTo(FrameLayout.LayoutParams.MATCH_PARENT); }
@Config(reportSdk = VERSION_CODES.ICE_CREAM_SANDWICH) @Ignore("Mraid 2.0") @Test public void onCreate_atLeastIcs_shouldSetHardwareAcceleratedFlag() throws Exception { subject.onCreate(null); boolean hardwareAccelerated = shadowOf(subject.getWindow()).getFlag(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED); assertThat(hardwareAccelerated).isTrue(); }
@Config(reportSdk = VERSION_CODES.HONEYCOMB_MR2) @Ignore("Mraid 2.0") @Test public void onCreate_beforeIcs_shouldNotSetHardwareAcceleratedFlag() throws Exception { subject.onCreate(null); boolean hardwareAccelerated = shadowOf(subject.getWindow()).getFlag(WindowManager.LayoutParams.FLAG_HARDWARE_ACCELERATED); assertThat(hardwareAccelerated).isFalse(); }