@Config(reportSdk = VERSION_CODES.JELLY_BEAN_MR1) @Test public void beforeJellyBeanMr1_shouldDisablePluginsByDefault() throws Exception { subject = new BaseWebView(context); WebSettings webSettings = subject.getSettings(); assertThat(webSettings.getPluginState()).isEqualTo(WebSettings.PluginState.OFF); subject.enablePlugins(true); assertThat(webSettings.getPluginState()).isEqualTo(WebSettings.PluginState.ON); }
protected void enablePlugins(final boolean enabled) { if (VersionCode.currentApiLevel().isAtLeast(VersionCode.JELLY_BEAN_MR2)) { return; } if (enabled) { getSettings().setPluginState(WebSettings.PluginState.ON); } else { getSettings().setPluginState(WebSettings.PluginState.OFF); } }
BaseWebView extends WebView { protected void enablePlugins(final boolean enabled) { if (VersionCode.currentApiLevel().isAtLeast(VersionCode.JELLY_BEAN_MR2)) { return; } if (enabled) { getSettings().setPluginState(WebSettings.PluginState.ON); } else { getSettings().setPluginState(WebSettings.PluginState.OFF); } } }
BaseWebView extends WebView { protected void enablePlugins(final boolean enabled) { if (VersionCode.currentApiLevel().isAtLeast(VersionCode.JELLY_BEAN_MR2)) { return; } if (enabled) { getSettings().setPluginState(WebSettings.PluginState.ON); } else { getSettings().setPluginState(WebSettings.PluginState.OFF); } } BaseWebView(Context context); }
BaseWebView extends WebView { protected void enablePlugins(final boolean enabled) { if (VersionCode.currentApiLevel().isAtLeast(VersionCode.JELLY_BEAN_MR2)) { return; } if (enabled) { getSettings().setPluginState(WebSettings.PluginState.ON); } else { getSettings().setPluginState(WebSettings.PluginState.OFF); } } BaseWebView(Context context); @Override void destroy(); }
BaseWebView extends WebView { protected void enablePlugins(final boolean enabled) { if (VersionCode.currentApiLevel().isAtLeast(VersionCode.JELLY_BEAN_MR2)) { return; } if (enabled) { getSettings().setPluginState(WebSettings.PluginState.ON); } else { getSettings().setPluginState(WebSettings.PluginState.OFF); } } BaseWebView(Context context); @Override void destroy();  }