diff options
author | Andras Becsi <andras.becsi@theqtcompany.com> | 2015-05-19 13:36:49 +0200 |
---|---|---|
committer | Andras Becsi <andras.becsi@theqtcompany.com> | 2015-07-16 09:46:09 +0000 |
commit | 5139958132a9f7116d6aad8a94656aa7741d7d58 (patch) | |
tree | dee37d61ebdbe0285eedd0294a496ed2d687faef /src/core/type_conversion.h | |
parent | 80bceea0a7b3f9b8f52a6ddc481e61ad3e43d85f (diff) |
Add cookie API tests
This tests the part of the cookie API that can be tested locally.
The notification about third-party cookies (acceptCookieFromUrl)
can not be tested locally since it requires cookies to be set from
a different domain than the main frame, which requires a remote
host or a local web server with support for virtual DNS.
Testing requires the ability to set cookies for local pages loaded
through the qrc scheme.
We could eventually extend this in the future to enable setting cookies
on registered custom schemes, but for that we might have to implement
our own cookie store.
Since Chromium's cookie store relies on source url's to manage cookies
and qrc:// cookies do not specify a domain, a specific source url is
needed to be able to delete an individual cookie that has been set by
a page loaded through qrc://.
This patch requires a new function on QNetworkCookie to be able to
forward the source url of the cookie to Chromium.
Change-Id: I97dd04b27fbb8ec63060f9b741ad65c29a773a6c
Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
Diffstat (limited to 'src/core/type_conversion.h')
-rw-r--r-- | src/core/type_conversion.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/core/type_conversion.h b/src/core/type_conversion.h index d49edd203..9e5461888 100644 --- a/src/core/type_conversion.h +++ b/src/core/type_conversion.h @@ -158,7 +158,8 @@ inline QNetworkCookie toQt(const net::CanonicalCookie & cookie) { QNetworkCookie qCookie = QNetworkCookie(QByteArray::fromStdString(cookie.Name()), QByteArray::fromStdString(cookie.Value())); qCookie.setDomain(toQt(cookie.Domain())); - qCookie.setExpirationDate(toQt(cookie.ExpiryDate())); + if (!cookie.ExpiryDate().is_null()) + qCookie.setExpirationDate(toQt(cookie.ExpiryDate())); qCookie.setHttpOnly(cookie.IsHttpOnly()); qCookie.setPath(toQt(cookie.Path())); qCookie.setSecure(cookie.IsSecure()); |