Skip to content

Instantly share code, notes, and snippets.

@kingargyle
Created June 11, 2014 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kingargyle/a0a3668ac9bd548bef5e to your computer and use it in GitHub Desktop.
Save kingargyle/a0a3668ac9bd548bef5e to your computer and use it in GitHub Desktop.
Extension of Robolectric ShadowCookieManager that implements setAcceptFileSchemeCookies and allowFileSchemeCookies
@Implements(value = CookieManager.class, inheritImplementationMethods = true)
public class ShadowCookieManager extends org.robolectric.shadows.ShadowCookieManager {
private static boolean acceptsFileSchemeCookies = false;
@Implementation
public static void setAcceptFileSchemeCookies(boolean fileSchemeCookies) {
acceptsFileSchemeCookies = fileSchemeCookies;
}
@Implementation
public static boolean allowFileSchemeCookies() {
return acceptsFileSchemeCookies;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment