diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2009-03-26 15:00:53 (GMT) |
---|---|---|
committer | Peter Hartmann <peter.hartmann@trolltech.com> | 2009-03-30 15:44:23 (GMT) |
commit | 37b61133eed38dbb8a7b87fce18b6ea016469fdc (patch) | |
tree | 7962d40e18be48613e1d3c82d72972df55d8a3d0 /tests/auto/qnetworkcookie | |
parent | ece28c5e497c5a7ce1f7671094c5ff3e58d176c5 (diff) | |
download | Qt-37b61133eed38dbb8a7b87fce18b6ea016469fdc.zip Qt-37b61133eed38dbb8a7b87fce18b6ea016469fdc.tar.gz Qt-37b61133eed38dbb8a7b87fce18b6ea016469fdc.tar.bz2 |
Fix parsing of multiple cookies that are separated by a newline
Signed-off-by: Peter Hartmann <peter.hartmann@trolltech.com>
Diffstat (limited to 'tests/auto/qnetworkcookie')
-rw-r--r-- | tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp b/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp index 2187b61..36a4b45 100644 --- a/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp +++ b/tests/auto/qnetworkcookie/tst_qnetworkcookie.cpp @@ -680,6 +680,26 @@ void tst_QNetworkCookie::parseMultipleCookies_data() list << cookie; QTest::newRow("network1") << "id=51706646077999719 bb=\"K14144t\"_AAQ\"ototrK_A_ttot44AQ4KwoRQtoto| adv=; Domain=.bluestreak.com; expires=Tuesday 05-Dec-2017 09:11:07 GMT; path=/;" << list; + QNetworkCookie cookieA; + cookieA.setName("a"); + cookieA.setValue("b"); + + QNetworkCookie cookieB; + cookieB.setName("c"); + cookieB.setValue("d"); + + // NewLine + cookieA.setExpirationDate(QDateTime(QDate(2009, 3, 10), QTime(7, 0, 0, 0), Qt::UTC)); + cookieB.setExpirationDate(QDateTime(QDate(2009, 3, 20), QTime(7, 0, 0, 0), Qt::UTC)); + list = QList<QNetworkCookie>() << cookieA << cookieB; + QTest::newRow("real-0") << "a=b; expires=Tue Mar 10 07:00:00 2009 GMT\nc=d; expires=Fri Mar 20 07:00:00 2009 GMT" << list; + QTest::newRow("real-1") << "a=b; expires=Tue Mar 10 07:00:00 2009 GMT\n\nc=d; expires=Fri Mar 20 07:00:00 2009 GMT" << list; + QTest::newRow("real-2") << "a=b; expires=Mar 10 07:00:00 2009 GMT, Tue\nc=d; expires=Fri Mar 20 07:00:00 2009 GMT" << list; + + // Match firefox's behavior + cookieA.setPath("/foo"); + list = QList<QNetworkCookie>() << cookieA << cookieB; + QTest::newRow("real-3") << "a=b; expires=Mar 10 07:00:00 2009 GMT, Tue; path=/foo\nc=d; expires=Fri Mar 20 07:00:00 2009 GMT" << list; } void tst_QNetworkCookie::parseMultipleCookies() |