25void CookiesTest::initTestCase()
30void CookiesTest::cleanupTestCase()
35void CookiesTest::domainMatchingTest_data()
37 QTest::addColumn<QString>(
"cookieDomain");
38 QTest::addColumn<QString>(
"siteDomain");
39 QTest::addColumn<bool>(
"result");
48 QTest::newRow(
"test1") <<
".example.com" <<
"www.example.com" <<
true;
49 QTest::newRow(
"test2") <<
".example.com" <<
"example.com" <<
true;
50 QTest::newRow(
"test3") <<
"example.com" <<
"www.example.com" <<
true;
51 QTest::newRow(
"test4") <<
".example.com" <<
"anotherexample.com" <<
false;
52 QTest::newRow(
"test5") <<
"test.example.com" <<
"example.com" <<
false;
53 QTest::newRow(
"test6") <<
".www.example.com" <<
"www.example.com" <<
true;
54 QTest::newRow(
"test7") <<
".www.example.com" <<
"example.com" <<
false;
55 QTest::newRow(
"test_empty") <<
".www.example.com" <<
"" <<
false;
56 QTest::newRow(
"test_empty2") <<
"" <<
"example.com" <<
false;
59void CookiesTest::domainMatchingTest()
61 QFETCH(QString, cookieDomain);
62 QFETCH(QString, siteDomain);
65 QCOMPARE(m_cookieJar->
matchDomain(cookieDomain, siteDomain), result);
68void CookiesTest::listMatchesDomainTest_data()
70 QTest::addColumn<QStringList>(
"list");
71 QTest::addColumn<QString>(
"cookieDomain");
72 QTest::addColumn<bool>(
"result");
75 list <<
QSL(
"www.example.com") <<
QSL(
"accounts.google.com");
77 list2 <<
QSL(
"anotherexample.com") <<
QSL(
"a.b.x.google.com");
79 QTest::newRow(
"test1") << list <<
".www.example.com" <<
true;
80 QTest::newRow(
"test2") << list <<
".google.com" <<
false;
81 QTest::newRow(
"test3") << list <<
".accounts.google.com" <<
true;
82 QTest::newRow(
"test4") << list <<
".example.com" <<
false;
83 QTest::newRow(
"test5") << list2 <<
"example.com" <<
false;
84 QTest::newRow(
"test6") << list2 <<
"tst.anotherexample.com" <<
true;
85 QTest::newRow(
"test7") << list2 <<
"b.x.google.com" <<
false;
86 QTest::newRow(
"test8") << list2 <<
"c.a.b.x.google.com" <<
true;
87 QTest::newRow(
"test9") << list2 <<
".a.b.x.google.com" <<
true;
88 QTest::newRow(
"test_empty") << list2 <<
"" <<
false;
91void CookiesTest::listMatchesDomainTest()
93 QFETCH(QStringList, list);
94 QFETCH(QString, cookieDomain);
#define FALKONTEST_MAIN(Test)
bool matchDomain(const QString &cookieDomain, const QString &siteDomain) const
bool listMatchesDomain(const QStringList &list, const QString &cookieDomain) const