Changeset View
Changeset View
Standalone View
Standalone View
webenginepart/autotests/webenginepartcookiejar_test.h
Show All 20 Lines | |||||
21 | * Boston, MA 02110-1301, USA. | 21 | * Boston, MA 02110-1301, USA. | ||
22 | */ | 22 | */ | ||
23 | 23 | | |||
24 | #ifndef TESTWEBENGINEPARTCOOKIEJAR_H | 24 | #ifndef TESTWEBENGINEPARTCOOKIEJAR_H | ||
25 | #define TESTWEBENGINEPARTCOOKIEJAR_H | 25 | #define TESTWEBENGINEPARTCOOKIEJAR_H | ||
26 | 26 | | |||
27 | #include <QObject> | 27 | #include <QObject> | ||
28 | #include <QDateTime> | 28 | #include <QDateTime> | ||
29 | #include <QDBusError> | ||||
29 | 30 | | |||
30 | class QWebEngineCookieStore; | 31 | class QWebEngineCookieStore; | ||
31 | class WebEnginePartCookieJar; | 32 | class WebEnginePartCookieJar; | ||
32 | class QNetworkCookie; | 33 | class QNetworkCookie; | ||
33 | class QWebEngineProfile; | 34 | class QWebEngineProfile; | ||
34 | class QDBusInterface; | 35 | class QDBusInterface; | ||
35 | 36 | | |||
36 | class TestWebEnginePartCookieJar : public QObject | 37 | class TestWebEnginePartCookieJar : public QObject | ||
Show All 18 Lines | 55 | private Q_SLOTS: | |||
55 | 56 | | |||
56 | void init(); | 57 | void init(); | ||
57 | void initTestCase(); | 58 | void initTestCase(); | ||
58 | void cleanup(); | 59 | void cleanup(); | ||
59 | void testCookieAddedToStoreAreAddedToKCookieServer_data(); | 60 | void testCookieAddedToStoreAreAddedToKCookieServer_data(); | ||
60 | void testCookieAddedToStoreAreAddedToKCookieServer(); | 61 | void testCookieAddedToStoreAreAddedToKCookieServer(); | ||
61 | void testCookieRemovedFromStoreAreRemovedFromKCookieServer_data(); | 62 | void testCookieRemovedFromStoreAreRemovedFromKCookieServer_data(); | ||
62 | void testCookieRemovedFromStoreAreRemovedFromKCookieServer(); | 63 | void testCookieRemovedFromStoreAreRemovedFromKCookieServer(); | ||
64 | void testPersistentCookiesAreAddedToStoreOnCreation(); | ||||
65 | void testSessionCookiesAreNotAddedToStoreOnCreation(); | ||||
63 | 66 | | |||
64 | private: | 67 | private: | ||
dfaure: Remove | |||||
65 | 68 | | |||
69 | /** | ||||
70 | * @brief Adds a cookie to KCookieServer | ||||
71 | * | ||||
72 | * The cookie is supposed to be in `QWebEngineStore` "format", that is its domain must not be empty; | ||||
73 | * a domain not starting with a dot means that the domain field wasn't given in the `Set-Cookie` header. | ||||
74 | * | ||||
75 | * @param _cookie the cookie to add | ||||
76 | * @param host the host where the cookie come from | ||||
77 | * @return QDBusError the error returned by DBus when adding the cookie. If no error occurred, this object | ||||
78 | * will be invalid | ||||
79 | */ | ||||
80 | QDBusError addCookieToKCookieServer(const QNetworkCookie &_cookie, const QString &host); | ||||
66 | void deleteCookies(const QList<CookieData> &cookies); | 81 | void deleteCookies(const QList<CookieData> &cookies); | ||
67 | QList<CookieData> findTestCookies(); | 82 | QList<CookieData> findTestCookies(); | ||
68 | QString m_cookieName; | | |||
69 | 83 | | |||
84 | //Cookie expiration dates returned by KCookieServer always have msecs set to 0 | ||||
85 | static QDateTime currentDateTime(){return QDateTime::fromSecsSinceEpoch(QDateTime::currentMSecsSinceEpoch()/1000);} | ||||
dfaure: Move to cpp file, no need to be here in header. | |||||
86 | | ||||
87 | QString m_cookieName; | ||||
70 | QWebEngineCookieStore *m_store; | 88 | QWebEngineCookieStore *m_store; | ||
71 | WebEnginePartCookieJar *m_jar; | 89 | WebEnginePartCookieJar *m_jar; | ||
72 | QWebEngineProfile *m_profile; | 90 | QWebEngineProfile *m_profile; | ||
73 | QDBusInterface *m_server; | 91 | QDBusInterface *m_server; | ||
74 | }; | 92 | }; | ||
75 | 93 | | |||
76 | #endif // TESTWEBENGINEPARTCOOKIEJAR_H | 94 | #endif // TESTWEBENGINEPARTCOOKIEJAR_H |
Remove