--- file_not_specified_in_diff +++ file_not_specified_in_diff @@ -153,0 +153,40 @@ + + /** Tests missing cookie path for a trivial URL fetch from the domain + * Note that this fails prior to a fix for BUG 38256 + */ + public void testMissingPath0() throws Exception { + URL url = new URL("http://d.e.f/goo.html"); + man.addCookieFromHeader("test=moo", url); + String s = man.getCookieHeaderForURL(new URL("http://d.e.f/")); + assertNotNull(s); + assertEquals("test=moo", s); + } + + /** Tests missing cookie path for a non-trivial URL fetch from the + * domain. Note that this fails prior to a fix for BUG 38256 + */ + public void testMissingPath1() throws Exception { + URL url = new URL("http://d.e.f/moo.html"); + man.addCookieFromHeader("test=moo", url); + String s = man.getCookieHeaderForURL(new URL("http://d.e.f/goo.html")); + assertNotNull(s); + assertEquals("test=moo", s); + } + + /** Tests explicit root path with a trivial URL fetch from the domain */ + public void testRootPath0() throws Exception { + URL url = new URL("http://d.e.f/goo.html"); + man.addCookieFromHeader("test=moo;path=/", url); + String s = man.getCookieHeaderForURL(new URL("http://d.e.f/")); + assertNotNull(s); + assertEquals("test=moo", s); + } + + /** Tests explicit root path with a non-trivial URL fetch from the domain */ + public void testRootPath1() throws Exception { + URL url = new URL("http://d.e.f/moo.html"); + man.addCookieFromHeader("test=moo;path=/", url); + String s = man.getCookieHeaderForURL(new URL("http://d.e.f/goo.html")); + assertNotNull(s); + assertEquals("test=moo", s); + }