
com.xtremelabs.robolectric.shadows.ShadowCookieSyncManager Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of robolectric Show documentation
Show all versions of robolectric Show documentation
An alternative Android testing framework.
package com.xtremelabs.robolectric.shadows;
import android.content.Context;
import android.webkit.CookieSyncManager;
import com.xtremelabs.robolectric.Robolectric;
import com.xtremelabs.robolectric.internal.Implementation;
import com.xtremelabs.robolectric.internal.Implements;
/**
* Shadows the {@code android.webkit.CookieSyncManager} class.
*/
@Implements(CookieSyncManager.class)
public class ShadowCookieSyncManager {
private static CookieSyncManager sRef;
private boolean synced = false;
@Implementation
public static synchronized CookieSyncManager createInstance(Context ctx) {
if (sRef == null) {
sRef = Robolectric.newInstanceOf(CookieSyncManager.class);
}
return sRef;
}
@Implementation
public static CookieSyncManager getInstance() {
if (sRef == null) {
throw new IllegalStateException("createInstance must be called first");
}
return sRef;
}
@Implementation
public void sync() {
synced = true;
}
public boolean synced() {
return synced;
}
public void reset() {
synced = false;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy