mirror of
https://invent.kde.org/network/falkon.git
synced 2024-11-14 02:52:12 +01:00
[Autotests] Added new test for forced SslV3 for not-working servers
This commit is contained in:
parent
ad1296e170
commit
5d1f560c5f
|
@ -66,7 +66,8 @@ HEADERS += \
|
||||||
adblocktest.h \
|
adblocktest.h \
|
||||||
updatertest.h \
|
updatertest.h \
|
||||||
pactest.h \
|
pactest.h \
|
||||||
passwordbackendtest.h
|
passwordbackendtest.h \
|
||||||
|
networktest.h
|
||||||
|
|
||||||
SOURCES += \
|
SOURCES += \
|
||||||
qztoolstest.cpp \
|
qztoolstest.cpp \
|
||||||
|
@ -77,4 +78,5 @@ SOURCES += \
|
||||||
adblocktest.cpp \
|
adblocktest.cpp \
|
||||||
updatertest.cpp \
|
updatertest.cpp \
|
||||||
pactest.cpp \
|
pactest.cpp \
|
||||||
passwordbackendtest.cpp
|
passwordbackendtest.cpp \
|
||||||
|
networktest.cpp
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "updatertest.h"
|
#include "updatertest.h"
|
||||||
#include "pactest.h"
|
#include "pactest.h"
|
||||||
#include "passwordbackendtest.h"
|
#include "passwordbackendtest.h"
|
||||||
|
#include "networktest.h"
|
||||||
|
|
||||||
#include <QtTest/QtTest>
|
#include <QtTest/QtTest>
|
||||||
|
|
||||||
|
@ -46,6 +47,7 @@ int main(int argc, char *argv[])
|
||||||
RUN_TEST(AdBlockTest)
|
RUN_TEST(AdBlockTest)
|
||||||
RUN_TEST(UpdaterTest)
|
RUN_TEST(UpdaterTest)
|
||||||
RUN_TEST(PacTest)
|
RUN_TEST(PacTest)
|
||||||
|
RUN_TEST(NetworkTest)
|
||||||
|
|
||||||
RUN_TEST(DatabasePasswordBackendTest)
|
RUN_TEST(DatabasePasswordBackendTest)
|
||||||
RUN_TEST(DatabaseEncryptedPasswordBackendTest)
|
RUN_TEST(DatabaseEncryptedPasswordBackendTest)
|
||||||
|
|
63
tests/autotests/networktest.cpp
Normal file
63
tests/autotests/networktest.cpp
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
/* ============================================================
|
||||||
|
* QupZilla - WebKit based browser
|
||||||
|
* Copyright (C) 2014 David Rosca <nowrep@gmail.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ============================================================ */
|
||||||
|
#include "networktest.h"
|
||||||
|
|
||||||
|
#include <QUrl>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
#include <QNetworkReply>
|
||||||
|
#include <QSslConfiguration>
|
||||||
|
#include <QEventLoop>
|
||||||
|
|
||||||
|
void NetworkTest::initTestCase()
|
||||||
|
{
|
||||||
|
m_manager = new QNetworkAccessManager;
|
||||||
|
|
||||||
|
QSslConfiguration conf = QSslConfiguration::defaultConfiguration();
|
||||||
|
conf.setProtocol(QSsl::SslV3);
|
||||||
|
QSslConfiguration::setDefaultConfiguration(conf);
|
||||||
|
}
|
||||||
|
|
||||||
|
void NetworkTest::cleanupTestCase()
|
||||||
|
{
|
||||||
|
delete m_manager;
|
||||||
|
}
|
||||||
|
|
||||||
|
void NetworkTest::sslv3test_data()
|
||||||
|
{
|
||||||
|
QTest::addColumn<QUrl>("url");
|
||||||
|
|
||||||
|
// Sites that loads only with SslV3 forced and have it forced in NetworkManager
|
||||||
|
QTest::newRow("centrum.sk") << QUrl("https://user.centrum.sk/");
|
||||||
|
QTest::newRow("oneaccount.com") << QUrl("https://service.oneaccount.com/onlineV2/OSV2?event=login&pt=3");
|
||||||
|
QTest::newRow("hdi.de") << QUrl("https://www.hdi.de/");
|
||||||
|
QTest::newRow("office-webapps") << QUrl("https://skydrive.live.com/view.aspx?resid=4FE8716FF67627C7!1218&cid=4fe8716ff67627c7&app=Word&wdo=2");
|
||||||
|
}
|
||||||
|
|
||||||
|
void NetworkTest::sslv3test()
|
||||||
|
{
|
||||||
|
QFETCH(QUrl, url);
|
||||||
|
|
||||||
|
QNetworkReply *reply = m_manager->get(QNetworkRequest(url));
|
||||||
|
|
||||||
|
QEventLoop loop;
|
||||||
|
connect(m_manager, SIGNAL(finished(QNetworkReply*)), &loop, SLOT(quit()));
|
||||||
|
loop.exec();
|
||||||
|
|
||||||
|
QCOMPARE(QNetworkReply::NoError, reply->error());
|
||||||
|
QCOMPARE(false, reply->readAll().isEmpty());
|
||||||
|
}
|
40
tests/autotests/networktest.h
Normal file
40
tests/autotests/networktest.h
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
/* ============================================================
|
||||||
|
* QupZilla - WebKit based browser
|
||||||
|
* Copyright (C) 2014 David Rosca <nowrep@gmail.com>
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
* ============================================================ */
|
||||||
|
#ifndef NETWORKTEST_H
|
||||||
|
#define NETWORKTEST_H
|
||||||
|
|
||||||
|
#include <QObject>
|
||||||
|
#include <QtTest/QtTest>
|
||||||
|
#include <QNetworkAccessManager>
|
||||||
|
|
||||||
|
class NetworkTest : public QObject
|
||||||
|
{
|
||||||
|
Q_OBJECT
|
||||||
|
|
||||||
|
private slots:
|
||||||
|
void initTestCase();
|
||||||
|
void cleanupTestCase();
|
||||||
|
|
||||||
|
void sslv3test_data();
|
||||||
|
void sslv3test();
|
||||||
|
|
||||||
|
private:
|
||||||
|
QNetworkAccessManager *m_manager;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif // NETWORKTEST_H
|
Loading…
Reference in New Issue
Block a user