Commit cb624944 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Add new autotest

parent 3b52378d
......@@ -10,14 +10,14 @@ ecm_add_test(checkphishingurljobtest.cpp ../checkphishingurljob.cpp ../checkphi
ecm_add_test(checkphishingurlfromlocaldatabasejobtest.cpp ../checkphishingurlutil.cpp ../checkphishingurlfromlocaldatabasejob.cpp ${testwebengineviewer_webengine_common_SRCS}
TEST_NAME checkphishingurlfromlocaldatabasetest
NAME_PREFIX "webengineview-checkphishingurl-"
NAME_PREFIX "webengineview-checkphishingurlfromlocaldatabasejob-"
LINK_LIBRARIES Qt5::Test Qt5::WebKitWidgets KF5::WebEngineViewer Qt5::Sql
)
ecm_add_test(createphishingurldatabasejobtest.cpp ../checkphishingurlutil.cpp ../createphishingurldatabasejob.cpp ${testwebengineviewer_webengine_common_SRCS}
TEST_NAME createphishingurldatabasejobtest
NAME_PREFIX "webengineview-checkphishingurl-"
NAME_PREFIX "webengineview-createphishingurldatabasejob-"
LINK_LIBRARIES Qt5::Test Qt5::WebKitWidgets KF5::WebEngineViewer
)
......@@ -25,6 +25,12 @@ ecm_add_test(createphishingurldatabasejobtest.cpp ../checkphishingurlutil.cpp ..
ecm_add_test(localdatabasemanagertest.cpp ../checkphishingurlutil.cpp ../localdatabasemanager.cpp ${testwebengineviewer_webengine_common_SRCS}
TEST_NAME localdatabasemanagertest
NAME_PREFIX "webengineview-checkphishingurl-"
NAME_PREFIX "webengineview-localdatabasemanager-"
LINK_LIBRARIES Qt5::Test Qt5::WebKitWidgets KF5::WebEngineViewer Qt5::Sql
)
ecm_add_test(searchfullhashjobtest.cpp ../checkphishingurlutil.cpp ../searchfullhashjob.cpp ${testwebengineviewer_webengine_common_SRCS}
TEST_NAME searchfullhashjobtest
NAME_PREFIX "webengineview-searchfullhashjob-"
LINK_LIBRARIES Qt5::Test Qt5::WebKitWidgets KF5::WebEngineViewer
)
/*
Copyright (C) 2016 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#include "searchfullhashjobtest.h"
#include <QTest>
SearchFullHashJobTest::SearchFullHashJobTest(QObject *parent)
: QObject(parent)
{
}
SearchFullHashJobTest::~SearchFullHashJobTest()
{
}
QTEST_MAIN(SearchFullHashJobTest)
/*
Copyright (C) 2016 Laurent Montel <montel@kde.org>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
version 2 of the License, or (at your option) any later version.
This library 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
Library General Public License for more details.
You should have received a copy of the GNU Library General Public License
along with this library; see the file COPYING.LIB. If not, write to
the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
Boston, MA 02110-1301, USA.
*/
#ifndef SEARCHFULLHASHJOBTEST_H
#define SEARCHFULLHASHJOBTEST_H
#include <QObject>
class SearchFullHashJobTest : public QObject
{
Q_OBJECT
public:
explicit SearchFullHashJobTest(QObject *parent = Q_NULLPTR);
~SearchFullHashJobTest();
};
#endif // SEARCHFULLHASHJOBTEST_H
......@@ -132,7 +132,7 @@ void SearchFullHashJob::start()
Q_EMIT result(WebEngineViewer::SearchFullHashJob::BrokenNetwork, mUrl);
deleteLater();
} else if (canStart()) {
QUrl safeUrl = QUrl(QStringLiteral("https://safebrowsing.googleapis.com/v4/threatMatches:find"));
QUrl safeUrl = QUrl(QStringLiteral("https://safebrowsing.googleapis.com/v4/fullHashes:find"));
safeUrl.addQueryItem(QStringLiteral("key"), WebEngineViewer::CheckPhishingUrlUtil::apiKey());
QNetworkRequest request(safeUrl);
request.setHeader(QNetworkRequest::ContentTypeHeader, QStringLiteral("application/json"));
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment