summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-11-17 06:25:52 (GMT)
committerMontel Laurent <montel@kde.org>2016-11-17 06:25:52 (GMT)
commite85794b78461498cb610fa4914cafbfad3f00b32 (patch)
tree397757b36821943598124f0f4b9b85450b03c80c
parent47f41e3b296850f3670cc5a189760959394342c0 (diff)
implement clear method
-rw-r--r--webengineviewer/src/checkphishingurl/autotests/createphishingurldatabasejobtest.cpp38
-rw-r--r--webengineviewer/src/checkphishingurl/autotests/createphishingurldatabasejobtest.h2
-rw-r--r--webengineviewer/src/checkphishingurl/createphishingurldatabasejob.cpp14
-rw-r--r--webengineviewer/src/checkphishingurl/createphishingurldatabasejob.h1
4 files changed, 55 insertions, 0 deletions
diff --git a/webengineviewer/src/checkphishingurl/autotests/createphishingurldatabasejobtest.cpp b/webengineviewer/src/checkphishingurl/autotests/createphishingurldatabasejobtest.cpp
index 85fd591..295f11b 100644
--- a/webengineviewer/src/checkphishingurl/autotests/createphishingurldatabasejobtest.cpp
+++ b/webengineviewer/src/checkphishingurl/autotests/createphishingurldatabasejobtest.cpp
@@ -51,6 +51,44 @@ void CreatePhishingUrlDataBaseJobTest::initTestcase()
qRegisterMetaType<WebEngineViewer::UpdateDataBaseInfo>();
}
+void CreatePhishingUrlDataBaseJobTest::shouldClearUpdateDataBaseInfo()
+{
+ WebEngineViewer::UpdateDataBaseInfo info;
+ WebEngineViewer::UpdateDataBaseInfo info2;
+ QCOMPARE(info, info2);
+ info.clear();
+ QCOMPARE(info, info2);
+
+ WebEngineViewer::UpdateDataBaseInfo value;
+ QVector<WebEngineViewer::Addition> additionList;
+ WebEngineViewer::Addition tmp;
+ tmp.prefixSize = 4;
+ tmp.hashString = QByteArrayLiteral("rnGLoQ==");
+ additionList.append(tmp);
+ QVector<WebEngineViewer::Removal> removalList;
+ WebEngineViewer::Removal tmpRemoval;
+ tmpRemoval.indexes = QList<int>() << 0 << 2 << 4;
+ removalList.append(tmpRemoval);
+ value.minimumWaitDuration = QStringLiteral("593.440s");
+ value.threatType = QStringLiteral("MALWARE");
+ value.threatEntryType = QStringLiteral("URL");
+ value.responseType = QStringLiteral("PARTIAL_UPDATE");
+ value.platformType = QStringLiteral("WINDOWS");
+ value.newClientState = QStringLiteral("ChAIBRADGAEiAzAwMSiAEDABEAFGpqhd");
+ value.sha256 = QStringLiteral("YSgoRtsRlgHDqDA3LAhM1gegEpEzs1TjzU33vqsR8iM=");
+ value.additionList = additionList;
+ value.removalList = removalList;
+
+ info = value;
+ QCOMPARE(info, value);
+ info2 = info;
+ QCOMPARE(info, info2);
+ info2.clear();
+ info.clear();
+ QCOMPARE(info, info2);
+
+}
+
void CreatePhishingUrlDataBaseJobTest::shouldCreateRequest_data()
{
QTest::addColumn<QString>("databasestate");
diff --git a/webengineviewer/src/checkphishingurl/autotests/createphishingurldatabasejobtest.h b/webengineviewer/src/checkphishingurl/autotests/createphishingurldatabasejobtest.h
index a3c9908..d98f711 100644
--- a/webengineviewer/src/checkphishingurl/autotests/createphishingurldatabasejobtest.h
+++ b/webengineviewer/src/checkphishingurl/autotests/createphishingurldatabasejobtest.h
@@ -35,6 +35,8 @@ private Q_SLOTS:
void shouldParseResult_data();
void shouldParseResult();
void initTestcase();
+
+ void shouldClearUpdateDataBaseInfo();
};
#endif // CREATEPHISHINGURLDATABASEJOBTEST_H
diff --git a/webengineviewer/src/checkphishingurl/createphishingurldatabasejob.cpp b/webengineviewer/src/checkphishingurl/createphishingurldatabasejob.cpp
index b7cbff1..1593668 100644
--- a/webengineviewer/src/checkphishingurl/createphishingurldatabasejob.cpp
+++ b/webengineviewer/src/checkphishingurl/createphishingurldatabasejob.cpp
@@ -324,6 +324,20 @@ void CreatePhishingUrlDataBaseJob::parseResult(const QByteArray &value)
deleteLater();
}
+void UpdateDataBaseInfo::clear()
+{
+ additionList.clear();
+ removalList.clear();
+ minimumWaitDuration.clear();
+ threatType.clear();
+ threatEntryType.clear();
+ responseType.clear();
+ platformType.clear();
+ newClientState.clear();
+ sha256.clear();
+
+}
+
bool UpdateDataBaseInfo::operator==(const UpdateDataBaseInfo &other) const {
const bool val = (additionList == other.additionList) &&
(removalList == other.removalList) &&
diff --git a/webengineviewer/src/checkphishingurl/createphishingurldatabasejob.h b/webengineviewer/src/checkphishingurl/createphishingurldatabasejob.h
index f80102f..ea82852 100644
--- a/webengineviewer/src/checkphishingurl/createphishingurldatabasejob.h
+++ b/webengineviewer/src/checkphishingurl/createphishingurldatabasejob.h
@@ -67,6 +67,7 @@ struct UpdateDataBaseInfo {
QString platformType;
QString newClientState;
QString sha256;
+ void clear();
bool operator==(const UpdateDataBaseInfo &other) const;
};