summaryrefslogtreecommitdiffstats
path: root/tests/auto
diff options
context:
space:
mode:
authorEdward Welbourne <edward.welbourne@qt.io>2021-01-21 13:57:19 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-02-03 15:51:34 +0000
commitab669173f83e8bc74b13662d3501f13adcb30a5f (patch)
tree0df83f225410c2bb55b20c5302a4c2598d569c93 /tests/auto
parent7e6adc11156bc911969299ef1cebf1566f0b351f (diff)
Update public suffix list to today's latest
Fetched from the authoritative source, verified the content matches that of the current master revision in the github repository. Amend one cookie jar test to find the last group in the last chunk correctly - each group arises from a non-empty hsah-table entry, but the last few hash-table entries may be empty, in which case the last group isn't just before the last index, it's earlier by the number of empty hash table entries. In the process, amend this test and the related test of the end of the first chunk to iterate all the entries in the group (in the present version, as it happens, each end-group has just one entry, but that may vary). Task-number: QTBUG-90214 Change-Id: I6da365a6ca558124f8275e392735071dc77e04bb Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> (cherry picked from commit ad16f79e5fac13f8a9dab8604de6adb6c46fe7bd) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'tests/auto')
-rw-r--r--tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp31
1 files changed, 18 insertions, 13 deletions
diff --git a/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp b/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp
index 0257884b65..4f6b5b3dec 100644
--- a/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp
+++ b/tests/auto/network/access/qnetworkcookiejar/tst_qnetworkcookiejar.cpp
@@ -480,22 +480,27 @@ void tst_QNetworkCookieJar::effectiveTLDs_data()
QTest::newRow("yes-platform.sh") << "eu.platform.sh" << true;
QTest::newRow("no-platform.sh") << "something.platform.sh" << false;
- int i;
- for (i = 0; tldIndices[i] < tldChunks[0]; i++) { }
- Q_ASSERT(i < tldCount);
- int TLDsInFirstChunk = i;
-
- const char *lastGroupFromFirstChunk = &tldData[0][tldIndices[TLDsInFirstChunk - 1]];
- QTest::addRow("lastGroupFromFirstChunk: %s", lastGroupFromFirstChunk)
- << lastGroupFromFirstChunk
- << true;
+ int inFirst = 0; // First group is guaranteed to be in first chunk.
+ while (tldIndices[inFirst] < tldChunks[0])
+ ++inFirst;
+ Q_ASSERT(inFirst < tldCount);
+ const char *lastGroupFromFirstChunk = &tldData[0][tldIndices[inFirst - 1]];
+ const char *cut = &tldData[0][tldChunks[0]];
+ for (const char *entry = lastGroupFromFirstChunk; entry < cut; entry += strlen(entry) + 1)
+ QTest::addRow("lastGroupFromFirstChunk: %s", entry) << entry << true;
Q_ASSERT(tldChunkCount > 1); // There are enough TLDs to fill 64K bytes
+ // The tldCount + 1 entries in tldIndices are indexed by hash value and some
+ // hash cells may be empty: we need to find the last non-empty hash cell.
+ int tail = tldCount;
+ while (tldIndices[tail - 1] == tldIndices[tail])
+ --tail;
+ Q_ASSERT(tldIndices[tail] == tldChunks[tldChunkCount - 1]);
const char *lastGroupFromLastChunk =
- &tldData[tldChunkCount-1][tldIndices[tldCount - 1] - tldChunks[tldChunkCount - 2]];
- QTest::addRow("lastGroupFromLastChunk: %s", lastGroupFromLastChunk)
- << lastGroupFromLastChunk
- << true;
+ &tldData[tldChunkCount-1][tldIndices[tail - 1] - tldChunks[tldChunkCount - 2]];
+ const char *end = &tldData[tldChunkCount-1][tldIndices[tail] - tldChunks[tldChunkCount - 2]];
+ for (const char *entry = lastGroupFromLastChunk; entry < end; entry += strlen(entry) + 1)
+ QTest::addRow("lastGroupFromLastChunk: %s", entry) << entry << true;
}
void tst_QNetworkCookieJar::effectiveTLDs()