mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-11 01:22:10 +01:00
[CookiesTest] Make the test pass after last commit
This commit is contained in:
parent
d0d1fa1844
commit
e0780b7779
|
@ -49,11 +49,13 @@ public:
|
||||||
private slots:
|
private slots:
|
||||||
void saveCookies();
|
void saveCookies();
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
bool rejectCookie(const QString &domain, const QNetworkCookie &cookie) const;
|
|
||||||
bool matchDomain(QString cookieDomain, QString siteDomain) const;
|
bool matchDomain(QString cookieDomain, QString siteDomain) const;
|
||||||
bool listMatchesDomain(const QStringList &list, const QString &cookieDomain) const;
|
bool listMatchesDomain(const QStringList &list, const QString &cookieDomain) const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool rejectCookie(const QString &domain, const QNetworkCookie &cookie) const;
|
||||||
|
|
||||||
bool m_allowCookies;
|
bool m_allowCookies;
|
||||||
bool m_filterTrackingCookie;
|
bool m_filterTrackingCookie;
|
||||||
bool m_blockThirdParty;
|
bool m_blockThirdParty;
|
||||||
|
|
|
@ -16,9 +16,21 @@
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
* ============================================================ */
|
* ============================================================ */
|
||||||
#include "cookiestest.h"
|
#include "cookiestest.h"
|
||||||
#include "cookiejar.h"
|
#include "settings.h"
|
||||||
|
|
||||||
#include <QtTest/QtTest>
|
#include <QtTest/QtTest>
|
||||||
|
#include <QDir>
|
||||||
|
|
||||||
|
void CookiesTest::initTestCase()
|
||||||
|
{
|
||||||
|
Settings::createSettings(QDir::tempPath() + "/QupZilla-test.ini");
|
||||||
|
m_cookieJar = new CookieJar_Tst;
|
||||||
|
}
|
||||||
|
|
||||||
|
void CookiesTest::cleanupTestCase()
|
||||||
|
{
|
||||||
|
delete m_cookieJar;
|
||||||
|
}
|
||||||
|
|
||||||
void CookiesTest::domainMatchingTest_data()
|
void CookiesTest::domainMatchingTest_data()
|
||||||
{
|
{
|
||||||
|
@ -50,7 +62,7 @@ void CookiesTest::domainMatchingTest()
|
||||||
QFETCH(QString, siteDomain);
|
QFETCH(QString, siteDomain);
|
||||||
QFETCH(bool, result);
|
QFETCH(bool, result);
|
||||||
|
|
||||||
QCOMPARE(CookieJar::matchDomain(cookieDomain, siteDomain), result);
|
QCOMPARE(m_cookieJar->matchDomain(cookieDomain, siteDomain), result);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CookiesTest::listMatchesDomainTest_data()
|
void CookiesTest::listMatchesDomainTest_data()
|
||||||
|
@ -82,5 +94,5 @@ void CookiesTest::listMatchesDomainTest()
|
||||||
QFETCH(QString, cookieDomain);
|
QFETCH(QString, cookieDomain);
|
||||||
QFETCH(bool, result);
|
QFETCH(bool, result);
|
||||||
|
|
||||||
QCOMPARE(CookieJar::listMatchesDomain(list, cookieDomain), result);
|
QCOMPARE(m_cookieJar->listMatchesDomain(list, cookieDomain), result);
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,17 +20,43 @@
|
||||||
|
|
||||||
#include <QObject>
|
#include <QObject>
|
||||||
|
|
||||||
|
#include "cookiejar.h"
|
||||||
|
|
||||||
|
class CookieJar_Tst : public CookieJar
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
explicit CookieJar_Tst()
|
||||||
|
: CookieJar(QString())
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool matchDomain(QString cookieDomain, QString siteDomain) const
|
||||||
|
{
|
||||||
|
return CookieJar::matchDomain(cookieDomain, siteDomain);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool listMatchesDomain(const QStringList &list, const QString &cookieDomain) const
|
||||||
|
{
|
||||||
|
return CookieJar::listMatchesDomain(list, cookieDomain);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class CookiesTest : public QObject
|
class CookiesTest : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
|
void initTestCase();
|
||||||
|
void cleanupTestCase();
|
||||||
|
|
||||||
void domainMatchingTest_data();
|
void domainMatchingTest_data();
|
||||||
void domainMatchingTest();
|
void domainMatchingTest();
|
||||||
|
|
||||||
void listMatchesDomainTest_data();
|
void listMatchesDomainTest_data();
|
||||||
void listMatchesDomainTest();
|
void listMatchesDomainTest();
|
||||||
|
|
||||||
|
private:
|
||||||
|
CookieJar_Tst *m_cookieJar;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // COOKIESTEST_H
|
#endif // COOKIESTEST_H
|
||||||
|
|
Loading…
Reference in New Issue
Block a user