Home | History | Annotate | Download | only in net

Lines Matching defs:cookie

97         server.enqueue(new MockResponse().addHeader("Set-Cookie: a=android; "
106 HttpCookie cookie = cookies.get(0);
107 assertEquals("a", cookie.getName());
108 assertEquals("android", cookie.getValue());
109 assertEquals(null, cookie.getComment());
110 assertEquals(null, cookie.getCommentURL());
111 assertEquals(false, cookie.getDiscard());
112 assertEquals(server.getCookieDomain(), cookie.getDomain());
113 assertTrue(cookie.getMaxAge() > 100000000000L);
114 assertEquals("/path", cookie.getPath());
115 assertEquals(true, cookie.getSecure());
116 assertEquals(0, cookie.getVersion());
125 server.enqueue(new MockResponse().addHeader("Set-Cookie: a=android; "
126 + "Comment=this cookie is delicious; "
136 HttpCookie cookie = cookies.get(0);
137 assertEquals("a", cookie.getName());
138 assertEquals("android", cookie.getValue());
139 assertEquals("this cookie is delicious", cookie.getComment());
140 assertEquals(null, cookie.getCommentURL());
141 assertEquals(false, cookie.getDiscard());
142 assertEquals(server.getCookieDomain(), cookie.getDomain());
143 assertEquals(60, cookie.getMaxAge());
144 assertEquals("/path", cookie.getPath());
145 assertEquals(true, cookie.getSecure());
146 assertEquals(1, cookie.getVersion());
156 + "Comment=this cookie is delicious; "
169 HttpCookie cookie = cookies.get(0);
170 assertEquals("a", cookie.getName());
171 assertEquals("android", cookie.getValue());
172 assertEquals("this cookie is delicious", cookie.getComment());
173 assertEquals("http://google.com/", cookie.getCommentURL());
174 assertEquals(true, cookie.getDiscard());
175 assertEquals(server.getCookieDomain(), cookie.getDomain());
176 assertEquals(60, cookie.getMaxAge());
177 assertEquals("/path", cookie.getPath());
178 assertEquals("80,443," + server.getPort(), cookie.getPortlist());
179 assertEquals(true, cookie.getSecure());
180 assertEquals(1, cookie.getVersion());
191 + "Comment=\"this cookie is delicious\"; "
204 HttpCookie cookie = cookies.get(0);
205 assertEquals("a", cookie.getName());
206 assertEquals("android", cookie.getValue());
207 assertEquals("this cookie is delicious", cookie.getComment());
208 assertEquals("http://google.com/", cookie.getCommentURL());
209 assertEquals(true, cookie.getDiscard());
210 assertEquals(server.getCookieDomain(), cookie.getDomain());
211 assertEquals(60, cookie.getMaxAge());
212 assertEquals("/path", cookie.getPath());
213 assertEquals("80,443," + server.getPort(), cookie.getPortlist());
214 assertEquals(true, cookie.getSecure());
215 assertEquals(1, cookie.getVersion());
288 || (cookieHeaders.size() == 1 && cookieHeaders.get("Cookie").isEmpty()));
354 assertContains(receivedHeaders, "Cookie: $Version=\"1\"; "
372 HttpCookie cookie = createCookie("c", "cookie", redirectSource.getCookieDomain(), "/");
374 cookie.setPortlist(portList);
375 cookieManager.getCookieStore().add(redirectSource.getUrl("/").toURI(), cookie);
381 assertContains(request.getHeaders(), "Cookie: $Version=\"1\"; "
382 + "c=\"cookie\";$Path=\"/\";$Domain=\"" + redirectSource.getCookieDomain()
386 if (header.startsWith("Cookie")) {
395 * Test which headers show up where. The cookie manager should be notified
397 * named {@code Cookie} or {@code Cookie2} that are returned by the cookie
409 result.put("Cookie", Collections.singletonList("Bar=bar"));
433 assertFalse(cookieHandlerHeaders.containsKey("Cookie"));
444 assertContainsAll(connection.getRequestProperties().keySet(), "Cookie", "Cookie2");
449 assertContainsAll(request.getHeaders(), "Foo: foo", "Cookie: Bar=bar", "Cookie2: Baz=baz");
458 result.put("COOKIE", Collections.singletonList("Bar=bar"));
469 assertContainsAll(request.getHeaders(), "COOKIE: Bar=bar", "cooKIE2: Baz=baz");
514 HttpCookie cookie = new HttpCookie("Foo", "foo");
515 cookie.setDomain("localhost");
516 assertEquals("localhost", cookie.getDomain());
565 assertFalse("Expected remove() to take the cookie URI into account.", // RI6 fails this
635 // the host/domain but not handling other cookie rules: it ignores the scheme (e.g. "secure"
648 * CookieStoreImpl.get(URI) not handling ports properly in the absence of an explicit cookie
653 HttpCookie cookie = new HttpCookie("theme", "light");
654 // Deliberately not setting the cookie domain or path.
655 cookieStore.add(new URI("http://a.com:12345"), cookie);
664 HttpCookie cookie = createCookie("theme", "light", "a.com", "/path");
665 cookie.setSecure(true);
666 cookieStore.add(new URI("https://a.com/path"), cookie);
767 return Collections.singletonMap("Set-Cookie", Arrays.asList(headers));
773 public void add(URI uri, HttpCookie cookie) {
774 cookies.add(cookie);
778 for (HttpCookie cookie : cookies) {
779 if (cookie.getName().equals(name)) {
780 return cookie;
783 throw new IllegalArgumentException("No cookie " + name + " in " + cookies);
798 public boolean remove(URI uri, HttpCookie cookie) {
818 List<String> actualCookieHeaderStrings = cookieHeaders.get("Cookie");
820 // For simplicity, we concatenate the cookie header strings if there are multiple ones.
829 * Creates a well-formed cookie. The behavior when domain is unset varies between
834 HttpCookie cookie = new HttpCookie(name, value);
835 cookie.setDomain(domain);
836 cookie.setPath(path);
837 return cookie;
850 HttpCookie cookie = new HttpCookie("name1", "value1");
851 cookie.setDiscard(true);
853 // This needn't throw. We should use the cookie's domain, if set.
854 // If no domain is set, this cookie will languish in the store until
856 cookieStore.add(null, cookie);
872 cookieStore.add(uri, cookie);
875 assertTrue(list.contains(cookie));
904 // expired cookie won't be selected.
976 // expired cookie won't be selected.
1030 // duplicated cookie won't be selected.
1034 // expired cookie won't be selected.
1118 // uri from the one originally associated with the cookie.
1274 * Unlike the RI, we flatten all matching cookies into a single Cookie header
1275 * instead of sending down multiple cookie headers. Also, when no cookies match
1281 // cookie-key | (content, URI)...
1283 { "Set-cookie",
1284 "Set-cookie:PREF=test;path=/;domain=.b.c;", "http://a.b.c/",
1285 "Set-cookie:PREF1=test2;path=/;domain=.beg.com;", "http://a.b.c/" },
1290 { "Set-cookie",
1305 // requires path of cookie is the prefix of uri
1306 // domain of cookie must match that of uri
1318 List<String> list = map.get("Cookie");
1321 // requires path of cookie is the prefix of uri
1323 list = map.get("Cookie");
1330 // ,no matter the value cookie-key
1334 list = map.get("Cookie");
1338 // cookie-key will not have effect on determining cookie version
1342 list = map.get("Cookie");
1346 // When key is null, no cookie can be stored/retrieved, even if policy =
1352 list = map.get("Cookie");
1360 list = map.get("Cookie");
1366 list = map.get("Cookie");
1398 public void add(URI uri, HttpCookie cookie) {
1414 public boolean remove(URI uri, HttpCookie cookie) {
1453 responseHeaders.put("Set-cookie", list);
1475 HttpCookie cookie = new HttpCookie("foo", "bar");
1476 cookie.setDomain("http://www.foo.com");
1477 cookie.setVersion(0);
1479 fscs.setNextCookie(cookie);
1484 List<String> cookies = cookieHeaders.get("Cookie");
1489 * A cookie store that always returns one cookie per URI (without any sort of
1490 * rule matching). The cookie that's returned is provided via a call to setNextCookie
1495 void setNextCookie(HttpCookie cookie) {
1496 cookies = Collections.singletonList(cookie);
1500 public void add(URI uri, HttpCookie cookie) {
1519 public boolean remove(URI uri, HttpCookie cookie) {
1534 Cookie",
1548 // http://b/31039416. Android supports cookie "expires" values without a
1557 value.add("cookie=1234567890test; domain=.test.com; path=/; " +
1559 header.put("Set-Cookie", value);
1564 HttpCookie cookie = cookies.get(0);
1566 assertEquals("1234567890test", cookie.getValue());
1568 assertTrue(cookie.getMaxAge() > 100000000000L);
1571 // http://b/33034917. Android supports clearing cookie by re-adding is with
1580 value.add("cookie=1234567890test; domain=.test.com; path=/; " +
1582 header.put("Set-Cookie", value);
1590 value.add("cookie=1234567890test; domain=.test.com; path=/; " +
1592 header.put("Set-Cookie", value);