/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* @test
* @bug 6644726 6873543
* @summary Cookie management issues
*/
public class B6644726 {
}
// Let's test the default path
// Then some alternate expires format
// Then Netscape draft cookies and domains
// Test for secure tag
// Test for passing cookies between http and https
// There should be 5 cookies if all dates parsed correctly
fail("Should have 5 cookies. Got only "+ cookies.size() + ", expires probably didn't parse correctly");
}
// Check Path for first Cookie
for (HttpCookie c : cookies) {
}
}
}
// We should get 1 Cookie: MyCookie4, because of the domain
emptyMap);
} else {
}
}
// We should get 4 cookies for non secure URI, and 5 for the secure one
}
fail("We should have gotten only 4 cookies over http (non secure), got " +
}
// myCookie5 (the secure one) shouldn't be here
fail("Got the secure cookie over a non secure link");
}
// Let's check that empty path is treated correctly
fail("Missing a cookie when using an empty path");
}
// And now, the other way around:
fail("Missing a cookie when using an empty path");
}
// Let's make sure the 'Port' optional attributes is enforced
// myCookie10 should have been rejected
for (HttpCookie c : cookies) {
fail("A cookie with an invalid port list was accepted");
}
}
// We should find both myCookie8 and myCookie9 but not myCookie10
fail("Missing a cookie on port 80");
}
// We should find only myCookie9
fail("Missing a cookie on port 80");
}
fail("A cookie with an invalid port list was returned");
}
// Test httpOnly flag (CR# 6873543)
// URI scheme was http: so we should get the cookie
fail("Missing cookie with httpOnly flag");
}
// URI scheme was neither http or https so we shouldn't get the cookie
fail("Should get the cookie with httpOnly when scheme is javascript:");
}
}
return false;
}
if (s.startsWith(cookie))
return true;
}
return false;
}
throw new RuntimeException(msg);
}
}