summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-11-16 12:34:10 (GMT)
committerMontel Laurent <montel@kde.org>2016-11-16 12:34:10 (GMT)
commit549224ca465d59d94e40e6af547c2e171579ecce (patch)
treef61d872ca929223d8f62c26a978f36785297111a
parent24d9949bb419ac95590d82e2f2401488a3589280 (diff)
Add more autotest
-rw-r--r--webengineviewer/src/checkphishingurl/autotests/CMakeLists.txt8
-rw-r--r--webengineviewer/src/checkphishingurl/autotests/checkphishingurlfromlocaldatabasejobtest.cpp10
-rw-r--r--webengineviewer/src/checkphishingurl/autotests/checkphishingurlfromlocaldatabasejobtest.h3
-rw-r--r--webengineviewer/src/checkphishingurl/autotests/createphishingurldatabasejobtest.cpp55
-rw-r--r--webengineviewer/src/checkphishingurl/autotests/createphishingurldatabasejobtest.h36
5 files changed, 100 insertions, 12 deletions
diff --git a/webengineviewer/src/checkphishingurl/autotests/CMakeLists.txt b/webengineviewer/src/checkphishingurl/autotests/CMakeLists.txt
index a98876c..1dcf1e6 100644
--- a/webengineviewer/src/checkphishingurl/autotests/CMakeLists.txt
+++ b/webengineviewer/src/checkphishingurl/autotests/CMakeLists.txt
@@ -1,5 +1,6 @@
set(testwebengineviewer_webengine_common_SRCS)
ecm_qt_declare_logging_category(testwebengineviewer_webengine_common_SRCS HEADER webengineviewer_debug.h IDENTIFIER WEBENGINEVIEWER_LOG CATEGORY_NAME org.kde.pim.webengineviewer)
+add_definitions( -DCHECKPHISHINGURL_DATA_DIR="${CMAKE_CURRENT_SOURCE_DIR}/data" )
ecm_add_test(checkphishingurljobtest.cpp ../checkphishingurljob.cpp ${testwebengineviewer_webengine_common_SRCS}
TEST_NAME checkphishingurljobtest
@@ -12,3 +13,10 @@ ecm_add_test(checkphishingurlfromlocaldatabasejobtest.cpp ../checkphishingurlfr
NAME_PREFIX "webengineview-checkphishingurl-"
LINK_LIBRARIES Qt5::Test Qt5::WebKitWidgets KF5::WebEngineViewer
)
+
+
+ecm_add_test(createphishingurldatabasejobtest.cpp ../createphishingurldatabasejob.cpp ${testwebengineviewer_webengine_common_SRCS}
+ TEST_NAME createphishingurldatabasejobtest
+ NAME_PREFIX "webengineview-checkphishingurl-"
+ LINK_LIBRARIES Qt5::Test Qt5::WebKitWidgets KF5::WebEngineViewer
+ )
diff --git a/webengineviewer/src/checkphishingurl/autotests/checkphishingurlfromlocaldatabasejobtest.cpp b/webengineviewer/src/checkphishingurl/autotests/checkphishingurlfromlocaldatabasejobtest.cpp
index 4be38f6..9548956 100644
--- a/webengineviewer/src/checkphishingurl/autotests/checkphishingurlfromlocaldatabasejobtest.cpp
+++ b/webengineviewer/src/checkphishingurl/autotests/checkphishingurlfromlocaldatabasejobtest.cpp
@@ -21,6 +21,7 @@
#include "../checkphishingurlfromlocaldatabasejob.h"
#include <QTest>
+
CheckPhishingUrlFromLocalDataBaseJobTest::CheckPhishingUrlFromLocalDataBaseJobTest(QObject *parent)
: QObject(parent)
{
@@ -32,14 +33,5 @@ CheckPhishingUrlFromLocalDataBaseJobTest::~CheckPhishingUrlFromLocalDataBaseJobT
}
-void CheckPhishingUrlFromLocalDataBaseJobTest::shouldCreateRequest_data()
-{
-
-}
-
-void CheckPhishingUrlFromLocalDataBaseJobTest::shouldCreateRequest()
-{
-
-}
QTEST_MAIN(CheckPhishingUrlFromLocalDataBaseJobTest)
diff --git a/webengineviewer/src/checkphishingurl/autotests/checkphishingurlfromlocaldatabasejobtest.h b/webengineviewer/src/checkphishingurl/autotests/checkphishingurlfromlocaldatabasejobtest.h
index 158b9b8..cf89ec5 100644
--- a/webengineviewer/src/checkphishingurl/autotests/checkphishingurlfromlocaldatabasejobtest.h
+++ b/webengineviewer/src/checkphishingurl/autotests/checkphishingurlfromlocaldatabasejobtest.h
@@ -28,9 +28,6 @@ class CheckPhishingUrlFromLocalDataBaseJobTest : public QObject
public:
explicit CheckPhishingUrlFromLocalDataBaseJobTest(QObject *parent = Q_NULLPTR);
~CheckPhishingUrlFromLocalDataBaseJobTest();
-private Q_SLOTS:
- void shouldCreateRequest_data();
- void shouldCreateRequest();
};
#endif // CHECKPHISHINGURLFROMLOCALDATABASEJOB_H
diff --git a/webengineviewer/src/checkphishingurl/autotests/createphishingurldatabasejobtest.cpp b/webengineviewer/src/checkphishingurl/autotests/createphishingurldatabasejobtest.cpp
new file mode 100644
index 0000000..890e924
--- /dev/null
+++ b/webengineviewer/src/checkphishingurl/autotests/createphishingurldatabasejobtest.cpp
@@ -0,0 +1,55 @@
+/*
+ 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 "createphishingurldatabasejobtest.h"
+
+#include <QTest>
+
+QByteArray readJsonFile(const QString &jsonFile)
+{
+ QFile file(QLatin1String(CHECKPHISHINGURL_DATA_DIR) + QLatin1Char('/') + jsonFile);
+ file.open(QIODevice::ReadOnly);
+ Q_ASSERT(file.isOpen());
+ const QByteArray data = file.readAll();
+ Q_ASSERT(!data.isEmpty());
+ return data;
+}
+
+
+CreatePhishingUrlDataBaseJobTest::CreatePhishingUrlDataBaseJobTest(QObject *parent)
+ : QObject(parent)
+{
+
+}
+
+CreatePhishingUrlDataBaseJobTest::~CreatePhishingUrlDataBaseJobTest()
+{
+
+}
+
+void CreatePhishingUrlDataBaseJobTest::shouldCreateRequest_data()
+{
+}
+
+void CreatePhishingUrlDataBaseJobTest::shouldCreateRequest()
+{
+}
+
+
+QTEST_MAIN(CreatePhishingUrlDataBaseJobTest)
diff --git a/webengineviewer/src/checkphishingurl/autotests/createphishingurldatabasejobtest.h b/webengineviewer/src/checkphishingurl/autotests/createphishingurldatabasejobtest.h
new file mode 100644
index 0000000..fbf1ca7
--- /dev/null
+++ b/webengineviewer/src/checkphishingurl/autotests/createphishingurldatabasejobtest.h
@@ -0,0 +1,36 @@
+/*
+ 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 CREATEPHISHINGURLDATABASEJOBTEST_H
+#define CREATEPHISHINGURLDATABASEJOBTEST_H
+
+#include <QObject>
+
+class CreatePhishingUrlDataBaseJobTest : public QObject
+{
+ Q_OBJECT
+public:
+ explicit CreatePhishingUrlDataBaseJobTest(QObject *parent = Q_NULLPTR);
+ ~CreatePhishingUrlDataBaseJobTest();
+private Q_SLOTS:
+ void shouldCreateRequest_data();
+ void shouldCreateRequest();
+};
+
+#endif // CREATEPHISHINGURLDATABASEJOBTEST_H