@MediumTest
  @Feature({"AndroidWebView", "Privacy"})
  public void testRemoveSessionCookiesNullCallback() throws Throwable {
    final String url = "http://www.example.com";
    final String sessionCookie = "cookie1=peter";
    final String normalCookie = "cookie2=sue";

    mCookieManager.setCookie(url, sessionCookie);
    mCookieManager.setCookie(url, makeExpiringCookie(normalCookie, 600));
    String allCookies = mCookieManager.getCookie(url);
    assertTrue(allCookies.contains(sessionCookie));
    assertTrue(allCookies.contains(normalCookie));

    mCookieManager.removeSessionCookies(null);

    // Eventually the session cookie is removed.
    poll(
        new Callable<Boolean>() {
          @Override
          public Boolean call() throws Exception {
            String c = mCookieManager.getCookie(url);
            return !c.contains(sessionCookie) && c.contains(normalCookie);
          }
        });
  }
  @MediumTest
  @Feature({"AndroidWebView", "Privacy"})
  public void testRemoveSessionCookies() throws Exception {
    final String url = "http://www.example.com";
    final String sessionCookie = "cookie1=peter";
    final String normalCookie = "cookie2=sue";

    mCookieManager.setCookie(url, sessionCookie);
    mCookieManager.setCookie(url, makeExpiringCookie(normalCookie, 600));

    mCookieManager.removeSessionCookies();

    String allCookies = mCookieManager.getCookie(url);
    assertFalse(allCookies.contains(sessionCookie));
    assertTrue(allCookies.contains(normalCookie));
  }
Esempio n. 3
0
 // TODO(hjd): remove after landing android update to use new calls.
 public void removeSessionCookie() {
   removeSessionCookies();
 }