robolectric/robolectric

Investigate the better completed backend for RoboCookieManager

Open

#6.568 geöffnet am 24. Juni 2021

Auf GitHub ansehen
 (2 Kommentare) (0 Reaktionen) (0 zugewiesene Personen)Java (1.356 Forks)batch import
help wanted

Repository-Metriken

Stars
 (5.755 Stars)
PR-Merge-Metriken
 (Durchschn. Merge 16h 48m) (64 gemergte PRs in 30 T)

Beschreibung

Description

As we discussed at https://github.com/robolectric/robolectric/pull/6517, RoboCookieManager supports partial cookie header, not completed now. I have shown some potential backend for RoboCookieManager at comment https://github.com/robolectric/robolectric/pull/6517#issuecomment-860077886, including JDK's HttpCookie and java-cookie. This issue is created to track the progress or thoughts about the better completed backend for RoboCookieManager.

Steps to Reproduce

There is a simple test that succeeds on official emulator, but fails on Robolectric:

  @Test
  public void setCookie_shouldReturnsNullForNonEqualsURL() {
    final String httpsUrl = "https://robolectric.org/";
    final CookieManager cookieManager = CookieManager.getInstance();
    cookieManager.setCookie(httpsUrl, "ID=test-id; path=/some/path; domain=.other.org");
    String cookie = cookieManager.getCookie(httpsUrl);
    assertThat(cookie).isNull();
  }

CTS' CookieManagerTest has more completed test cases for cookie header.

Robolectric & Android Version

All

Link to a public git repo demonstrating the problem:

None

Contributor Guide