本文整理汇总了C++中Cookie::isDiscard方法的典型用法代码示例。如果您正苦于以下问题:C++ Cookie::isDiscard方法的具体用法?C++ Cookie::isDiscard怎么用?C++ Cookie::isDiscard使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Cookie
的用法示例。
在下文中一共展示了Cookie::isDiscard方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: assertEquals
TEST(CookieDecoderTest, testDecodingMultipleCookies) {
String c1 = "myCookie=myValue;max-age=50;path=/apathsomewhere;domain=.adomainsomewhere;secure;comment=this is a comment;version=2;commentURL=\"http://aurl.com\";port='80,8080';discard;";
String c2 = "myCookie2=myValue2;max-age=0;path=/anotherpathsomewhere;domain=.anotherdomainsomewhere;comment=this is another comment;version=2;commentURL=http://anotherurl.com;";
String c3 = "myCookie3=myValue3;max-age=0;version=2;";
Set<Cookie> cookies = CookieDecoder.decode(c1 + c2 + c3);
assertEquals(3, cookies.size());
Iterator<Cookie> it = cookies.iterator();
Cookie cookie = it.next();
assertNotNull(cookie);
assertEquals("myValue", cookie.getValue());
assertEquals("this is a comment", cookie.getComment());
assertEquals("http://aurl.com", cookie.getCommentUrl());
assertEquals(".adomainsomewhere", cookie.getDomain());
assertTrue(cookie.isDiscard());
assertEquals(50, cookie.getMaxAge());
assertEquals("/apathsomewhere", cookie.getPath());
assertEquals(2, cookie.getPorts().size());
assertTrue(cookie.getPorts().contains(80));
assertTrue(cookie.getPorts().contains(8080));
assertTrue(cookie.isSecure());
assertEquals(2, cookie.getVersion());
cookie = it.next();
assertNotNull(cookie);
assertEquals("myValue2", cookie.getValue());
assertEquals("this is another comment", cookie.getComment());
assertEquals("http://anotherurl.com", cookie.getCommentUrl());
assertEquals(".anotherdomainsomewhere", cookie.getDomain());
assertFalse(cookie.isDiscard());
assertEquals(0, cookie.getMaxAge());
assertEquals("/anotherpathsomewhere", cookie.getPath());
assertTrue(cookie.getPorts().isEmpty());
assertFalse(cookie.isSecure());
assertEquals(2, cookie.getVersion());
cookie = it.next();
assertNotNull(cookie);
assertEquals("myValue3", cookie.getValue());
assertNull(cookie.getComment());
assertNull(cookie.getCommentUrl());
assertNull(cookie.getDomain());
assertFalse(cookie.isDiscard());
assertEquals(0, cookie.getMaxAge());
assertNull(cookie.getPath());
assertTrue(cookie.getPorts().isEmpty());
assertFalse(cookie.isSecure());
assertEquals(2, cookie.getVersion());
}