Class ShadowWebSettings

java.lang.Object
org.robolectric.shadows.ShadowWebSettings

@Implements(android.webkit.WebSettings.class) public class ShadowWebSettings extends Object
Shadow of WebSettings which returns a dummy user a stub instance rather than the User-Agent used by a WebView.
  • Constructor Details

    • ShadowWebSettings

      public ShadowWebSettings()
  • Method Details

    • getDefaultUserAgent

      @Implementation protected static String getDefaultUserAgent(Context context)
      Returns the default User-Agent used by a WebView. An instance of WebView could use a different User-Agent if a call is made to WebSettings.setUserAgentString(String).
      Parameters:
      context - a Context object used to access application assets
    • setDefaultUserAgent

      public static void setDefaultUserAgent(@Nullable String defaultUserAgent)
      Sets the default user agent for the WebView. The value set here is returned from getDefaultUserAgent(Context).

      If the value is null, the default user agent will be provided by Robolectric.

    • reset

      @Resetter public static void reset()