summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-11-20 07:11:16 (GMT)
committerMontel Laurent <montel@kde.org>2016-11-20 07:11:16 (GMT)
commitcb62494470bc56b85b16592228891bb437d4bc22 (patch)
treefdf6b6f632947855029940211e6cdc6aac513a61
parent3b52378d13d2166e426aa7ae73d82939aa617136 (diff)
Add new autotest
-rw-r--r--webengineviewer/src/checkphishingurl/autotests/CMakeLists.txt12
-rw-r--r--webengineviewer/src/checkphishingurl/autotests/searchfullhashjobtest.cpp34
-rw-r--r--webengineviewer/src/checkphishingurl/autotests/searchfullhashjobtest.h33
-rw-r--r--webengineviewer/src/checkphishingurl/searchfullhashjob.cpp2
4 files changed, 77 insertions, 4 deletions
diff --git a/webengineviewer/src/checkphishingurl/autotests/CMakeLists.txt b/webengineviewer/src/checkphishingurl/autotests/CMakeLists.txt
index b815118..10b56c4 100644
--- a/webengineviewer/src/checkphishingurl/autotests/CMakeLists.txt
+++ b/webengineviewer/src/checkphishingurl/autotests/CMakeLists.txt
@@ -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
+ )
diff --git a/webengineviewer/src/checkphishingurl/autotests/searchfullhashjobtest.cpp b/webengineviewer/src/checkphishingurl/autotests/searchfullhashjobtest.cpp
new file mode 100644
index 0000000..dbb7aeb
--- /dev/null
+++ b/webengineviewer/src/checkphishingurl/autotests/searchfullhashjobtest.cpp
@@ -0,0 +1,34 @@
+/*
+ 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)
diff --git a/webengineviewer/src/checkphishingurl/autotests/searchfullhashjobtest.h b/webengineviewer/src/checkphishingurl/autotests/searchfullhashjobtest.h
new file mode 100644
index 0000000..fa63705
--- /dev/null
+++ b/webengineviewer/src/checkphishingurl/autotests/searchfullhashjobtest.h
@@ -0,0 +1,33 @@
+/*
+ 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
diff --git a/webengineviewer/src/checkphishingurl/searchfullhashjob.cpp b/webengineviewer/src/checkphishingurl/searchfullhashjob.cpp
index bfd9522..c5ef41f 100644
--- a/webengineviewer/src/checkphishingurl/searchfullhashjob.cpp
+++ b/webengineviewer/src/checkphishingurl/searchfullhashjob.cpp
@@ -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"));