当前位置: 首页>>代码示例>>C++>>正文


C++ Cookie::isDiscard方法代码示例

本文整理汇总了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());
}
开发者ID:1suming,项目名称:cetty2,代码行数:47,代码来源:CookieDecoderTest.cpp


注:本文中的Cookie::isDiscard方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。