summaryrefslogtreecommitdiffstats
path: root/tests/auto/network
diff options
context:
space:
mode:
authorMårten Nordheim <marten.nordheim@qt.io>2020-05-06 18:24:07 +0200
committerMårten Nordheim <marten.nordheim@qt.io>2020-08-06 20:56:42 +0200
commitad1a5bf63fa63532c3267d4f365286dc78288651 (patch)
treea7f026b0397f95e1e2a44ce8acd61b60e3c59e51 /tests/auto/network
parentaf1544bda242d02690bd092f1d1ed7ca57659529 (diff)
QDecompressHelper: Add brotli support
Task-number: QTBUG-83269 Change-Id: If23b098ee76a4892e4c2c6ce5c635688d8d9138d Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
Diffstat (limited to 'tests/auto/network')
-rw-r--r--tests/auto/network/access/http2/tst_http2.cpp5
-rw-r--r--tests/auto/network/access/qdecompresshelper/4G.brbin0 -> 3361 bytes
-rw-r--r--tests/auto/network/access/qdecompresshelper/tst_qdecompresshelper.cpp16
-rw-r--r--tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp6
4 files changed, 27 insertions, 0 deletions
diff --git a/tests/auto/network/access/http2/tst_http2.cpp b/tests/auto/network/access/http2/tst_http2.cpp
index 2e59480c90..775c9604b9 100644
--- a/tests/auto/network/access/http2/tst_http2.cpp
+++ b/tests/auto/network/access/http2/tst_http2.cpp
@@ -796,6 +796,11 @@ void tst_Http2::contentEncoding_data()
contentEncodingData.emplace_back(
"deflate", QByteArray::fromBase64("eJzLSM3JyVcozy/KSQEAGgsEXQ=="), "hello world");
+#if QT_CONFIG(brotli)
+ contentEncodingData.emplace_back("br", QByteArray::fromBase64("DwWAaGVsbG8gd29ybGQD"),
+ "hello world");
+#endif
+
// Loop through and add the data...
for (const auto &data : contentEncodingData) {
const char *name = data.contentEncoding.data();
diff --git a/tests/auto/network/access/qdecompresshelper/4G.br b/tests/auto/network/access/qdecompresshelper/4G.br
new file mode 100644
index 0000000000..dabd553ed7
--- /dev/null
+++ b/tests/auto/network/access/qdecompresshelper/4G.br
Binary files differ
diff --git a/tests/auto/network/access/qdecompresshelper/tst_qdecompresshelper.cpp b/tests/auto/network/access/qdecompresshelper/tst_qdecompresshelper.cpp
index 4f54839ec0..a1fbe60d3e 100644
--- a/tests/auto/network/access/qdecompresshelper/tst_qdecompresshelper.cpp
+++ b/tests/auto/network/access/qdecompresshelper/tst_qdecompresshelper.cpp
@@ -90,6 +90,12 @@ void tst_QDecompressHelper::encodingSupported()
QVERIFY(accepted.contains("gzip"));
int expected = 2;
+#if QT_CONFIG(brotli)
+ QVERIFY(QDecompressHelper::isSupportedEncoding("br"));
+ QVERIFY(accepted.contains("br"));
+ ++expected;
+#endif
+
QCOMPARE(expected, accepted.size());
}
@@ -115,6 +121,12 @@ void tst_QDecompressHelper::sharedDecompress_data()
QTest::newRow("deflate-hello-world")
<< QByteArray("deflate") << QByteArray::fromBase64("eJzLSM3JyVcozy/KSQEAGgsEXQ==")
<< QByteArray("hello world");
+
+#if QT_CONFIG(brotli)
+ QTest::newRow("brotli-hello-world")
+ << QByteArray("br") << QByteArray::fromBase64("DwWAaGVsbG8gd29ybGQD")
+ << QByteArray("hello world");
+#endif
}
void tst_QDecompressHelper::decompress_data()
@@ -322,6 +334,10 @@ void tst_QDecompressHelper::decompressBigData_data()
QTest::newRow("gzip-4G") << QByteArray("gzip") << QString(":/4G.gz") << fourGiB;
QTest::newRow("deflate-5G") << QByteArray("deflate") << QString(":/5GiB.txt.inflate")
<< fiveGiB;
+
+#if QT_CONFIG(brotli)
+ QTest::newRow("brotli-4G") << QByteArray("br") << (srcDir + "/4G.br") << fourGiB;
+#endif
}
void tst_QDecompressHelper::decompressBigData()
diff --git a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
index 0868ec04f8..109d4ce406 100644
--- a/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
+++ b/tests/auto/network/access/qnetworkreply/tst_qnetworkreply.cpp
@@ -9264,6 +9264,12 @@ void tst_QNetworkReply::contentEncoding_data()
QTest::newRow("deflate-hello-world")
<< QByteArray("deflate") << QByteArray::fromBase64("eJzLSM3JyVcozy/KSQEAGgsEXQ==")
<< QByteArray("hello world");
+
+#if QT_CONFIG(brotli)
+ QTest::newRow("brotli-hello-world")
+ << QByteArray("br") << QByteArray::fromBase64("DwWAaGVsbG8gd29ybGQD")
+ << QByteArray("hello world");
+#endif
}
void tst_QNetworkReply::contentEncoding()